Commit Graph

3555 Commits

Author SHA1 Message Date
Chun-wei Fan
3dd65859a7 gio: Fix build on Windows
The newly-introduced functions, g_content_type_get_symbolic_icon() and
g_content_type_get_generic_icon_name() don't seem to be for Windows, at
least for now.  So filter them out from gio.symbols on Windows.

Also, glocalfileinfo.c calls g_content_type_get_symbolic_icon() in
get_icon(), so only build that code when on Unix, for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=684278
2012-09-19 10:32:05 +08:00
Ryan Lortie
ce3dddb622 GApplication: document differences from libunique
People implementing GApplication often waste a lot of time by trying to
use it as if it were libunique.  Add a note to the docs about the
difference.
2012-09-18 10:14:35 -04:00
Dieter Verfaillie
db22102038 gresource tests: fix VPATH builds emitting errors during dependency generation
Adding the --sourcedir option fixes these:
/path/to/src/gio/tests/test2.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test3.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test4.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
/path/to/src/gio/tests/test.gresource.xml: Error on line 5 char 1: Failed to locate 'test1.txt' in current directory.
2012-09-17 15:29:59 +02:00
Colin Walters
d6cbb29f59 CVE-2012-3524: Hardening for being run in a setuid environment
Some programs attempt to use libglib (or even libgio) when setuid.
For a long time, GTK+ simply aborted if launched in this
configuration, but we never had a real policy for GLib.

I'm not sure whether we should advertise such support.  However, given
that there are real-world programs that do this currently, we can make
them safer with not too much effort.

Better to fix a problem caused by an interaction between two
components in *both* places if possible.

This patch adds a private function g_check_setuid() which is used to
first ensure we don't run an external dbus-launch binary if
DBUS_SESSION_BUS_ADDRESS isn't set.

Second, we also ensure the local VFS is used in this case.  The
gdaemonvfs extension point will end up talking to the session bus
which is typically undesirable in a setuid context.

Implementing g_check_setuid() is interesting - whether or not we're
running in a privilege-escalated path is operating system specific.
Note that GTK+'s code to check euid versus uid worked historically on
Unix, more modern systems have filesystem capabilities and SELinux
domain transitions, neither of which are captured by the uid
comparison.

On Linux/glibc, the way this works is that the kernel sets an
AT_SECURE flag in the ELF auxiliary vector, and glibc looks for it on
startup.  If found, then glibc sets a public-but-undocumented
__libc_enable_secure variable which we can use.  Unfortunately, while
it *previously* worked to check this variable, a combination of newer
binutils and RPM break it:
http://www.openwall.com/lists/owl-dev/2012/08/14/1

So for now on Linux/glibc, we fall back to the historical Unix version
until we get glibc fixed.

On some BSD variants, there is a issetugid() function.  On other Unix
variants, we fall back to what GTK+ has been doing.

Reported-By: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-13 18:34:29 -04:00
William Jon McCann
cc3238a9c9 Add api to get the generic icon name for a mime type
https://bugzilla.gnome.org/show_bug.cgi?id=683744
2012-09-13 12:50:02 -04:00
Matthias Clasen
6a50dc511b Drop GVFS_INOTIFY_DIAG debug feature
Just not a good idea to have this in production code.
2012-09-11 20:24:30 -04:00
Thomas Bechtold
c9a3cd6d8b Fix gdbus connection annotations
g_dbus_connection_call_with_unix_fd_list_sync () and
g_dbus_connection_call_sync () should allow None for the
bus_name parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=683771

Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-09-11 13:16:32 +01:00
LRN
59ad2acfc5 gwin32mount.c: Fix syntax error
Signed-off-by: Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=683641
2012-09-09 10:49:45 -04:00
Dan Winship
d68609f9fd Revert "xdgmime: plug a small leak"
This reverts commit 4e7031f073.

The string actually does get freed somewhere else, at least in some
cases. Can be looked at again later if this reintroduces a leak.

https://bugzilla.gnome.org/show_bug.cgi?id=683270
2012-09-03 10:07:31 -04:00
Dan Winship
beb0f9c150 gio/tests: fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:41:23 -04:00
Dan Winship
17bb9d542c gio/tests/cancellable: fix to still work when running slowly
The test was assuming that all cancelled ops would finish within a
certain amount of time, but this often failed under valgrind. Instead,
just run the loop until all of the ops have actually finished.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
568f737708 gio/tests: port some stuff to g_test_expect_message()
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
039ecf2bc6 g_file_copy: plug a leak
The fallback copy code was leaking the GFileInfo if it didn't have
G_FILE_ATTRIBUTE_STANDARD_TYPE.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Dan Winship
fa58cef826 GDesktopAppInfo: fix leaks
g_desktop_app_info_ensure_saved() was leaking the file contents.

_g_desktop_app_info_launch_uris_internal() was leaking the session bus
on error.

https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Dan Winship
4e7031f073 xdgmime: plug a small leak
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Paolo Borelli
2d85894bc5 Fix gtk-doc for g_app_info_get_supported_types 2012-09-02 12:25:50 +02:00
Aleksander Morgado
724c8a1846 gdbus-codegen: avoid error when wrong interface is provided to --annotate
If the interface given cannot be matched, `iface_obj' was left uninitialized and
the iface_obj == None check would end up crashing:

Traceback (most recent call last):
  File "/usr/bin/gdbus-codegen", line 41, in <module>
    sys.exit(codegen_main.codegen_main())
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 175, in codegen_main
    apply_annotations(all_ifaces, opts.annotate)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 146, in apply_annotations
    apply_annotation(iface_list, iface, None, None, None, None, key, value)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 64, in apply_annotation
    if iface_obj == None:
UnboundLocalError: local variable 'iface_obj' referenced before assignment

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683088
2012-09-01 11:53:19 -04:00
Martin Pitt
55f7061097 Bump max time in test_method_calls_on_proxy() test
On slower platforms, the overhead of the 240 D-BUS Sleep calls is larger than
the current maximum of 6 seconds. A run on a Panda board sometimes fails with

  ERROR:/build/buildd/glib2.0-2.33.8/./gio/tests/gdbus-threading.c:409:test_method_calls_on_proxy:
  assertion failed (elapsed_msec < 6000): (7365 < 6000)

Bump maximum time to 8 seconds to be more resilient to this.

https://bugzilla.gnome.org/show_bug.cgi?id=682222
2012-08-31 18:03:26 +02:00
William Jon McCann
40b4fae42e Add ability to get symbolic icon for content type
https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
William Jon McCann
a15a071f35 Add symbolic icon support to gfileinfo
https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
William Jon McCann
a2dca48bf7 Add symbolic icon support to drive, volume, and mount
We need symbolic icon support for display in Nautilus.

https://bugzilla.gnome.org/show_bug.cgi?id=682101
2012-08-30 11:04:43 -04:00
Rui Matos
88d181ef18 gdbus-tool: Check return value of strrchr()
Fixes a crash when invoking gdbus like:

$ gdbus emit --session -o / -s Foo

https://bugzilla.gnome.org/show_bug.cgi?id=682965
2012-08-30 11:51:49 +02:00
Cosimo Cecchi
9bca5bb49f appinfo: fix annotations for g_app_info_launch and g_app_info_launch_uris
The files/uris parameters for these functions can be NULL, so we need an
allow-none annotation here.
2012-08-29 14:46:11 -04:00
Colin Walters
6e64ba58b9 Switch all open() calls to use g_open()
Because it now handles EINTR.  And we should do so.  While most people
use Linux, which tries very hard to avoid propagating EINTR back up
into userspace, it can still happen.

https://bugzilla.gnome.org/show_bug.cgi?id=682833
2012-08-28 13:56:59 -04:00
Colin Walters
2542b6f604 xdgmime: Handle EINTR in open()
https://bugzilla.gnome.org/show_bug.cgi?id=682833
2012-08-28 13:56:58 -04:00
Cosimo Cecchi
62570a52b1 gio: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:25 -04:00
Matthias Clasen
60d2cb665e Use G_DEFINE_QUARK for quarks in GIO 2012-08-28 00:08:08 -04:00
Daiki Ueno
030ebfb93b gsettings-tool: make list-recursively really recurse
https://bugzilla.gnome.org/show_bug.cgi?id=682586
2012-08-28 00:08:06 -04:00
Matthias Clasen
a552989410 GFile: Cosmetic doc changes 2012-08-28 00:08:05 -04:00
Matthias Clasen
0149f44f4a Fix the GDBusProxy async test
Patch by Mike Gorse, bug
https://bugzilla.gnome.org/show_bug.cgi?id=674805
2012-08-28 00:08:05 -04:00
Matthias Clasen
7e07ea8189 Make async permission tests work 2012-08-28 00:08:05 -04:00
Mike Gorse
375943ea21 Fix the gdbus-proxy async test
The async test had several problems:
- It created a proxy and did not launch a main loop, meaning that its
  callback would usually not get called, or, if it did get called, the
test harness would have taken down the connection already, causing an
assertion failure when the proxy had an error.
- It was dependent on the proxy test to set up the server and would fail
  because some properties were modified by that test.

https://bugzilla.gnome.org/show_bug.cgi?id=674805
2012-08-28 00:08:04 -04:00
Dan Winship
b901aaf673 Update .gitignores 2012-08-26 14:40:22 -04:00
Stef Walter
7518f7a674 Revert "gtlscertificate: Add certificate-bytes and private-key-bytes props"
* In order to add contstruct properties to an abstract base
   calls, and retain ABI stability, the base class must add a
   default implementation of those properties.
 * We cannot add a default implementation of certificate-bytes
   or private-key-bytes since certificate and private-key properties
   are writable on construct-only.

This reverts commit 541c985869.

https://bugzilla.gnome.org/show_bug.cgi?id=682081
2012-08-21 13:30:02 +02:00
Stef Walter
a8c784df58 gdbus: Fix double free and use after free of object path
* This occurs when the 'g-object-path' property is read
   on a GDBusObjectSkeleton

https://bugzilla.gnome.org/show_bug.cgi?id=682075
2012-08-21 13:21:26 +02:00
Cosimo Cecchi
0d8a81b722 mount-op: use gint64 instead of guint64 for time_left and bytes_left
Since those can be -1, they need to be signed.

https://bugzilla.gnome.org/show_bug.cgi?id=682284
2012-08-21 10:55:28 +02:00
Ryan Lortie
59394b3e1e Revert the GMarkup attribute collect changes
We need to have some more discussion on this topic.

This reverts commits 86329ba44f and
8d40389d15.

https://bugzilla.gnome.org/show_bug.cgi?id=665634
2012-08-20 18:34:13 -04:00
Lars Uebernickel
07fadc7932 GMenuModel: add test for the new GMenuItem API 2012-08-20 16:26:25 -04:00
Ryan Lortie
6798fcdd0f GMenuItem: add constructor to copy from model
Add g_menu_item_new_from_model() for constructing a GMenuItem that is a
copy of a menu item that's in a GMenuModel.
2012-08-20 16:26:25 -04:00
Ryan Lortie
99478dd893 GMenuItem: add getter APIs
GMenuItem has been write-only up to this point.  Add some APIs for
reading back values as well.
2012-08-20 16:26:25 -04:00
Ryan Lortie
ad79b0f8ef GMenuModel: remove a type safety bug
There was a /* XXX */ in the code here to do proper typechecking of the
GVariant in the menu model when using g_menu_model_get_item_attribute().
We have g_variant_check_format_string() now, so use it.
2012-08-20 16:26:25 -04:00
Marc-André Lureau
d9f6314f57 win32: add pipe-io-cancel-test
Test that win32 streams can be cancelled.
It can even be tested with wine on Linux!

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
b9b2cf6a66 win32: add pipe-io-concurrent
Implement test case suggested by Ryan Lortie on bug:
https://bugzilla.gnome.org/show_bug.cgi?id=679288

"There is a potential race here that's really unlikely to happen, but
here we go: We are trying to read from the same socket in two threads.
Some data comes. That causes the poll() in both threads (above) to
finish running. Then the cancellable is checked above. We now find
ourselves here. Only one thread will read the data. The other will
block on this function. Then the user may cancel the cancellable while
we are blocked here, but we will stay blocked...."
2012-08-20 17:10:31 +02:00
Marc-André Lureau
1c1ba8b512 win32: add pipe-io-overlap-test 2012-08-20 17:10:31 +02:00
Marc-André Lureau
b9d7b80897 win32: make gio stream cancellable
v2:
 - fix cancellation of concurrent readers
 - replace g_assert() usage with g_warn_if_fail()
v3:
 - fix indentation
 - fix loop code to not leak (silly me)

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
4b5d762d5d win32: handle ERROR_MORE_DATA
If a named pipe is being read in message mode and the next message is
longer than the nNumberOfBytesToRead parameter specifies, ReadFile
returns FALSE and GetLastError returns ERROR_MORE_DATA.

Since the API doesn't allow to return both a GError and the number of
bytes read so far, it makes more sense to return nread, and let the
client call GetLastError() himself to check if ERROR_MORE_DATA.

The current alternative loses the nread information.

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Marc-André Lureau
23d80a04da win32: use overlapped events for streams
Any file handle created with FLAG_OVERLAPPED must have
ReadFile()/WriteFile() called with an OVERLAPPED structure.
Failing to do so will give unspecified results, invalid read/write or
corruption.

Without FLAG_OVERLAPPED, it is not possible to read and write
concurrently, even with two seperate threads, created by 2 input and
output gio streams. Also, only with FLAG_OVERLAPPED may an IO
operation be asynchronous and thus be cancellable.

We may want to call ReOpenFile() to make sure the FLAG is set, but
this API is only available since Vista+.

According to MSDN doc, adding the OVERLAPPED argument for IO operation
on handles without FLAG_OVERLAPPED is allowed, and indeed the existing
test still passes.

v2:
- update GetLastError() after _g_win32_overlap_wait_result ()
- split the unrelated ERROR_MORE_DATA handling

https://bugzilla.gnome.org/show_bug.cgi?id=679288
2012-08-20 17:10:31 +02:00
Matthias Clasen
cbf346ce53 Remove some more 'the the' 2012-08-19 02:27:04 -04:00
Matthias Clasen
efd822bb07 Improve test coverage for GSocketConnection 2012-08-19 02:26:42 -04:00
Matthias Clasen
cc5d7ccdba Improve test coverage for unix socket addresses 2012-08-19 02:26:05 -04:00
Matthias Clasen
63eaeb223b Improve test coverage for resources 2012-08-19 02:25:37 -04:00
Matthias Clasen
beea8c5c84 Improve test coverage for filter streams 2012-08-19 02:25:21 -04:00
Matthias Clasen
b22f4a2dd2 Improve test coverage for unix streams 2012-08-19 02:25:02 -04:00
Matthias Clasen
3afec2b872 Improve test coverage for pollable streams 2012-08-19 02:24:44 -04:00
Matthias Clasen
eeb4951c47 Improve GSettings test coverage 2012-08-19 02:24:04 -04:00
Matthias Clasen
f89e9deaec Improve GAppInfo test coverage 2012-08-19 02:23:32 -04:00
Matthias Clasen
35bf77445b Add some GInetAddress tests 2012-08-19 02:22:59 -04:00
Matthias Clasen
867ad1cebc Add some GPermission tests 2012-08-19 02:22:33 -04:00
Matthias Clasen
2687d921e1 Cosmetic change
gtk-doc doesn't need <!-- --> anymore to recognize plural
forms of links.
2012-08-19 02:21:02 -04:00
Matthias Clasen
4dbcd27eee Make GPermission more forgiving
It is not great if calling g_permission_acquire on a simple
permission object just segfaults. This commit arranges for
this to return a G_IO_ERROR_NOT_SUPPORTED error.
2012-08-19 02:19:27 -04:00
Matthias Clasen
4a8740d0d2 It is 'registered', not 'registred' 2012-08-18 23:17:47 -04:00
Matthias Clasen
e27367f341 Exterminate 'the the' 2012-08-18 23:15:58 -04:00
Chun-wei Fan
2954f70d39 Fix build on Visual C++
-glib/gmarkup.c: Use G_VA_COPY() instead of va_copy() as va_copy() may not
 be universally available.
-gio/gtestdbus.c: Include io.h on Windows for close()
2012-08-17 19:22:43 +08:00
Matthias Clasen
b13a79aeb4 Adapt schema tests to changed error messages 2012-08-17 01:15:08 -04:00
Matthias Clasen
86329ba44f gdbus: Use g_markup_collect_known_attributes() in GDBus introspection
In order to be able to cope with the introspection XML
from the Telepathy specification, which uses attributes
like tp:type and tp:name-for-bindings, we need to ignore
unknown attributes when parsing.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=665634
2012-08-16 23:41:19 -04:00
Matthias Clasen
21aff13d22 Fix 'make report'
Turns out this doesn't work unless every Makefile.am includes
Makefile.decl.
2012-08-16 23:23:16 -04:00
Matthias Clasen
6bee6dbce5 Miscellaneous string fixes
Typo and punctuation fixes, and some rewording, based
on a patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 23:02:41 -04:00
Matthias Clasen
e4dc223e9d Make capitalisation of "UNIX" consistent in translatable strings
Based on a patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 22:47:43 -04:00
Matthias Clasen
191f09b044 Change "dash" to "hyphen" in translatable strings
GSchemas use hyphens, not dashes.
Patch by Philip Withnall, bug
https://bugzilla.gnome.org/review?bug=628193
2012-08-16 22:23:20 -04:00
Matthias Clasen
4e55bebb7a Fix leak in GWinHttpVfs
Patch by Ole André Vadla Ravnås, bug
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2012-08-16 22:17:46 -04:00
Matthias Clasen
6ef1e56479 Fix leak in GFileAttributeInfoList
Patch by Ole André Vadla Ravnås, bug
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2012-08-16 22:15:54 -04:00
Owen W. Taylor
d7e1d51fc9 Add tests for g_file_make_directory_with_parents()
Add tests to catch recent regressions with g_file_make_directory_with_parents()

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:08 -04:00
Owen W. Taylor
f899358156 g_file_make_directory_with_parents: clean up logic
Simplify logic by only looking at whether we have a GError and
not also using return codes.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:06 -04:00
Owen W. Taylor
5291190f46 g_file_make_directory_with_parents(): fix a corner case
If g_file_get_parent() unexpectedly failed, we could return
FALSE but with no error.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:05 -04:00
Owen W. Taylor
732470a359 g_file_make_directory_with_parents: refix error propagation
The patch from b0bce4ad triggered segfaults - see:

 http://redmine.yorba.org/issues/5656

We were clearing the error before dereferencing it in the next
go-around of the while loop - this wasn't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16 18:08:03 -04:00
Javier Jardón
f8a5fc2e2e Revert "Use upstream gettext instead the glib one"
Commited by mistake
This reverts commit e930e3b3aa.
2012-08-15 02:46:16 +09:00
Javier Jardón
e930e3b3aa Use upstream gettext instead the glib one 2012-08-15 01:41:11 +09:00
Stef Walter
541c985869 gtlscertificate: Add certificate-bytes and private-key-bytes props
* These properties contain the same data as certificate and
   private-key, but as GBytes

https://bugzilla.gnome.org/show_bug.cgi?id=681319
2012-08-06 22:23:20 +02:00
Matthias Clasen
b55a2a2005 Don't use GIO in GTestDBus setup
Using GIO here may cause the gvfs module to be loaded, which
in turn gets onto the session bus to talk to gvfsd - not ideal
if you are trying to control the session bus life cycle. Instead,
just use old-fashioned glib file utils.
2012-08-06 12:08:21 -04:00
Matthias Clasen
cc80ae321f Solaris build fix for GIO
Solaris/OpenSolaris/OpenIndiana define FIONREAD in sys/filio.h.
This commit adds a configure check for this header, and includes
it conditionally in gio/gsocket.c.

Patch by Fabian Groffen, bug 675524.
2012-08-06 11:55:59 -04:00
Dan Winship
bd883f8dc7 gio/tests/g-icon.c: fix some path checks on win32
Some of the tests needed to be modified to use G_DIR_SEPARATOR_S
rather than hardcoded "/"s.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:31:52 -04:00
Dan Winship
291853bea3 gicon: make g_icon_new_for_string() recognize win32 paths
(but for compatibility, make it still recognize unix paths on win32
too)

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:39 -04:00
Dan Winship
26f1e0938e gio/tests/file: skip the file monitor tests if using GPollFileMonitor
test_create_delete() assumes that if it creates a file and then
immediately deletes it, that the file monitor will notice this and
record it as a create followed by a delete. But that won't work with
GPollFileMonitor, which will just think nothing changed. So skip the
test in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:38 -04:00
Dan Winship
2793b39ea3 gio/tests/g-file.c: fix some path checks on win32
Some of the tests needed to be modified to use G_DIR_SEPARATOR_S
rather than hardcoded "/"s.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:37 -04:00
Dan Winship
5c91af7e41 glocalfile: fix g_file_get_parse_name() on win32
When getting the parse name for a file: URI on win32, we were not
translating "\" to "/", resulting in incorrect output.

https://bugzilla.gnome.org/show_bug.cgi?id=669331
2012-08-06 11:27:36 -04:00
Matthias Clasen
b2ddbd8f55 Plug a minor memory leak in GDBusObjectProxy
As pointed out by Patrick Ohly in bug 680505,
GDBusObjectProxy was forgetting to free its object_path.
2012-08-06 11:03:42 -04:00
Brian Koning
10474aca34 Remove extra newline chars in local g_application_command_line_print/err
The extra newline chars in the local implementation of g_application_command_line_print and g_application_command_line_printerr() cause an unwanted newline after printed strings. This patch removes the newline chars to make the functions consistent with their documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=680459
2012-08-06 10:17:30 -04:00
Pavel Vasin
151b198b93 GDBusActionGroup: hold ref until async init done
to avoid use-after-free if GDBusActionGroup was finalized

https://bugzilla.gnome.org/show_bug.cgi?id=679509
2012-08-06 10:08:13 -04:00
Pavel Vasin
b2d848e3cb gio/tests/actions: test for bug679509 2012-08-06 10:08:11 -04:00
Stef Walter
49b35f0930 gtlscertificate: Don't confuse certificate and public key in docs
* A certificate sorta acts as a public key, but more specifically
   it contains a public key (in its subjectPublicKeyInfo) field.
 * Documentation was confusing and could have read like the
   certificate and certificate-pem properties were returning the
   public key part of the certificate.

https://bugzilla.gnome.org/show_bug.cgi?id=681158
2012-08-06 10:44:52 +02:00
Matthias Clasen
e2470ec6db docs: Don't put links in section titles 2012-08-03 23:36:45 -04:00
Stef Walter
6ddf40f301 gtlscertificate: Add g_tls_certificate_is_same() function
* Certificate equality in PKIX in general is equality between
   the DER encoding of the certificates.

https://bugzilla.gnome.org/show_bug.cgi?id=681116
2012-08-03 18:58:30 +02:00
Stef Walter
b913b0c29e gtlsdatabase: Don't complain if no callbacks for async functions
https://bugzilla.gnome.org/show_bug.cgi?id=681118
2012-08-03 17:39:10 +02:00
David Zeuthen
800ca21e55 GDBusError: Fix up G_STATIC_ASSERT guidance
This was reported in bug 680994.

https://bugzilla.gnome.org/show_bug.cgi?id=680994

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-08-01 11:57:22 -04:00
Dan Winship
b3f9637337 gthreadpool: set default max_unused_threads and max_idle_time values
GThreadPool defaulted to 0 for max_unused_threads (meaning thread-pool
threads would exit immediately if there was not already another task
waiting for them), and 0 for max_idle_time (meaning unused threads
would linger forever, though this is only relevant if you changed
max_unused_threads).

However, GIOScheduler changed the global defaults to 2 and 15*1000,
respectively, arguing that these were more useful defaults. And they
are, so let's use them.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-31 14:37:56 -04:00
Owen W. Taylor
b0bce4ad41 g_file_make_directory_with_parents: Fix error propagation
When creating a directory fails for some reason other than
the parent not existing, don't clear the error before we try
to propagate it.

To reproduce, run 'ostadmin init' on /ostree or otherwise try to
run the function on a directory with a parent directory where the
current user is not allowed to write.

https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-07-30 18:29:26 +02:00
Colin Walters
d7829ced53 GFile: Note semantics of g_file_delete()
Particularly for someone programming on Unix, this helps them
understand that we will unlink symbolic links, and not follow them.
2012-07-30 05:11:08 -04:00
Colin Walters
14a1c20177 GFile: Add g_file_delete_async()
This looks like it was stubbed out but not implemented; the vtable
entry dates to commit 3781343738 which
is just alex's initial merge of gio into glib.

I was working on some code that wants an asynchronous rm -rf
equivalent, and so yeah, this is desirable.

https://bugzilla.gnome.org/show_bug.cgi?id=680760
2012-07-30 05:01:06 -04:00
Chun-wei Fan
1ae7c7d982 gio/Makefile.am: Filter out gcontenttype.c for MSVC builds
gcontenttype.c was split into gcontenttype.c and gcontenttype-win32.c
in commit 32192ee9 ("Split gcontenttype.c"), so we don't want to include
gcontenttype.c in the Visual C++ build as it is no longer a source file
meant for Windows.

Thanks to Thomas H.P. Anderson for pointing this out.
2012-07-19 23:15:59 +08:00
Dan Winship
2855b827da gio/tests/converter-stream: add a new test, rename an old one
Add a test that the decompressor input streams handle truncated data
correctly. (They do; I wrote the test thinking there was a bug there,
but there isn't.)

Also, rename the "corruption" tests to "roundtrip", since "corruption"
makes it sound like we're testing how the converters deal with
corrupted data, as opposed to merely testing that they don't corrupt
data themselves. And fix the bug reference.
2012-07-17 16:21:03 -04:00
Dan Winship
09c18537f4 g_cancellable_source_new: don't use a file descriptor
Rather than implementing GCancellableSource by polling on its fd,
implement it by just waking its GMainContext up from the "cancelled"
signal handler, thereby helping to reduce file descriptor usage.
Suggested by Ryan Lortie.

https://bugzilla.gnome.org/show_bug.cgi?id=680121
2012-07-17 15:32:48 -04:00
Stef Walter
a0b71839ee GIOScheduler: Fix access after free in "cancelled" handler
* GCancellable can be "cancelled" more than once if
   g_cancellable_reset() is called.
 * Don't assume that because the "cancelled" signal fired
   it won't fire again.

https://bugzilla.gnome.org/show_bug.cgi?id=680111
2012-07-17 13:47:26 -04:00
Dan Winship
d90ad18055 GAsyncInitable: partially revert the init_finish changes
g_async_initable_real_init_finish() was previously handling all
GSimpleAsyncResults, even if they weren't created by
g_async_initable_real_init_async(), and libnm-glib accidentally relied
on that behavior. So remove the g_simple_async_result_is_valid()
check.
2012-07-17 09:15:44 -04:00
Cosimo Cecchi
99f26ab08f mount-operation: add a Since tag to the show-unmount-progress signal 2012-07-11 20:26:16 -04:00
Cosimo Cecchi
44375ad7c5 mount-operation: add show-unmount-progress signal
The actual implementation will be in gvfs.

https://bugzilla.gnome.org/show_bug.cgi?id=676111
2012-07-11 19:57:42 -04:00
Rui Matos
eda1735029 GDBusNodeInfo: remove a spurious for loop
https://bugzilla.gnome.org/show_bug.cgi?id=679671
2012-07-11 03:27:29 +02:00
Rui Matos
6f23c33831 GDBusNodeInfo: the XML string must contain exactly one node element
Make the documentation clear about this.

https://bugzilla.gnome.org/show_bug.cgi?id=679671
2012-07-11 03:27:29 +02:00
Colin Walters
f7abd3ce13 Add g_spawn_check_exit_status()
Many (if not "almost all") programs that spawn other programs via
g_spawn_sync() or the like simply want to check whether or not the
child exited successfully, but doing so requires use of
platform-specific functionality and there's actually a fair amount of
boilerplate involved.

This new API will help drain a *lot* of mostly duplicated code in
GNOME, from gnome-session to gdm.  And we can see that some bits even
inside GLib were doing it wrong; for example checking the exit status
on Unix, but ignoring it on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=679691
2012-07-10 18:03:56 -04:00
Dan Winship
82d914d808 gio: add g_async_result_is_tagged()
Rather than doing a two step first-check-the-GAsyncResult-subtype-then-
check-the-tag, add a GAsyncResult-level method so that you can do them
both at once, simplifying the code for "short-circuit" async return
values where the vmethod never gets called.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:20 -04:00
Dan Winship
f8532a13e2 gio: Add g_async_result_legacy_propagate_error()
Finish deprecating the "handle GSimpleAsyncResult errors in the
wrapper function" idiom (and protect against future GSimpleAsyncResult
deprecation warnings) by adding a "legacy" GAsyncResult method
to do it in those classes/methods where it had been traditionally
done.

(This applies only to wrapper methods; in cases where an _async
vmethod explicitly uses GSimpleAsyncResult, its corresponding _finish
vmethod still uses g_simple_async_result_propagate_error.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:49:14 -04:00
Dan Winship
538b2f106d gio: handle GSimpleAsyncResult errors in _finish vmethods
Originally, the standard idiom with GSimpleAsyncResult was to handle
all errors in the _finish wrapper function, so that vmethods only had
to deal with successful results. But this means that chaining up to a
parent _finish vmethod won't work correctly. Fix this by also checking
for errors in all the relevant vmethods. (We have to redundantly check
in both the vmethod and the wrapper to preserve compatibility.)

https://bugzilla.gnome.org/show_bug.cgi?id=667375
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:47:55 -04:00
Dan Winship
a98d26c9bb GFile: remove some unnecessary code
The "mainloop_barrier" in copy_async_thread() is unnecessary, since
the g_simple_async_result_complete_in_idle() will be queued after all
of the g_io_scheduler_job_send_to_mainloop_async()s, and sources with
the same priority will run in the order in which they were queued.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10 10:47:49 -04:00
Torsten Schönfeld
a511a706de gio: Add type macros for GFileAttributeInfoList and GFileAttributeMatcher
https://bugzilla.gnome.org/show_bug.cgi?id=616892
2012-07-08 00:47:01 +02:00
David Zeuthen
c09bf3e6b9 gdbus-codegen: improve casting a tiny wee bit
The in commit b79fbc5c3f for fixing
-Wstrict-aliasing warnings was a little too brutal, make it a bit
better.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-07 17:10:46 -04:00
David Zeuthen
b79fbc5c3f gdbus-codegen: neuter warnings when using -Wstrict-aliasing
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
David Zeuthen
d728eae85f gdbus-codegen: don't shadow variable
This avoids a warning when building with -Wshadow

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
Ryan Lortie
ed492a5de2 GSettings: be more careful about keys names with /
Prevent attempts to access keys ending with slashes that exist in the
schema file as references to child schemas.

Also: don't emit change signals for these same keys.
2012-07-06 13:44:17 -04:00
David Zeuthen
d72116d8b7 gdbus-codegen: Don't generate invalid GObject property names
For a D-Bus property with name "Type" (fairly common), we used to
generate a GObject property with name "type-" and C accessors
get_type_() (to avoid clashing with the GType getter), set_type_()
(for symmetri).

However, the rules for GObject property names are fairly rigid and
specifically prohibit names ending in a dash.

Therefore change things so the chosen GObject property name is "type"
but preserve the naming rules for the C getter and setter (for the
same reasons: avoiding name clashing and symmetri).

This change does break the API of generated code (but only on the
GObject property level, the C symbols are not changed) but strictly
speaking the behavior was undefined since "type-" was an invalid
GObject property name.

Also add a test case for this.

Bug 679473.

https://bugzilla.gnome.org/show_bug.cgi?id=679473

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 09:26:41 -04:00
Matthias Clasen
04af05fd1f Drop unneeded includes 2012-07-03 21:14:41 -04:00
Matthias Clasen
32192ee9e4 Split gcontenttype.c
Instead of a giant #if G_OS_WIN32 #else #endif around the entire
file, just split it into gcontenttype.c and gcontenttype-win32.c.
2012-07-03 21:13:32 -04:00
Marc-André Lureau
af3b1674cd win32: fix build after bug 674452 2012-07-03 21:01:31 -04:00
Simon Feltman
03611f7c06 Updated codegen to work with python3.
Most changes were just replacing usage of "has_key" with "in".
Also updated the sorting function which was simplified and
changed to a "key" function instead of "cmp" (which is no longer
supported in python3. Verified everything builds with
python 2.7 and 3.

https://bugzilla.gnome.org/show_bug.cgi?id=678066
2012-07-01 11:14:54 -04:00
Johan Dahlin
08cfcdc81a Use the same Python as we found in configure
Don't assume /usr/bin/python is python 2.x, on newer Ubuntu versions
it's actually python 3.x.
2012-06-29 11:59:33 -03:00
Martin Pitt
d023b81a7a Fix /contenttype/guess test
After fixing bug 674452 this test case now reliably fails, as "ABC abc" is text
and definitively not PowerPoint. It previously worked as g_content_type_guess()
was reading beyond the boundary of the data due to specifying -1 as data
length.

Update that test case to expect a PO template instead, and add two more with a
definitive PO template syntax and some binary data. We do not currently have a
MIME magic for PowerPoint, so we cannot actually detect it with certainty, but
at least make sure that the returned MIME type is correct.

https://bugzilla.gnome.org/show_bug.cgi?id=678941
2012-06-28 15:57:22 +02:00
Alexander Larsson
c35106fcc4 Fix the mimetype default fix
We need to ignore the defaults.list item only when there
was a mimetype handler found in a previous mimetype, not
if one was found for the same mimetype as the one that
is listed in defaults.list (same for the new-style defaults).
2012-06-28 15:38:06 +02:00
Alexander Larsson
f14c0112d0 Fix default app lookup wrt parent types and defaults.list
There was an issue when looking up the default handler
for a type where a supertype was listed in defaults.list.
We would pick the default for the parent type even if
there was a handler for the more specific type.

In the case of the new-style defaults marking (
"Default Applications" in mimeapps.list) we were already
checking for a more specific handler befor using a default,
but we also need to do a similar check for the defaults.list
case.

https://bugzilla.gnome.org/show_bug.cgi?id=678944
2012-06-28 15:05:03 +02:00
Stef Walter
1ae3080640 GTlsInteraction: Fix incorrect locking of mutex
* Fix incorrect locking of mutex in g_tls_interaction_invoke_ask_password()

https://bugzilla.gnome.org/show_bug.cgi?id=678758
2012-06-28 14:43:12 +02:00
Martin Pitt
139c1ce988 gio/tests/contenttype: Call g_content_type_guess() with valid data len
g_content_type_guess() requires specifying a valid data length. Fixes a
segfault when running the test.

Also add an explicit check for this and return XDG_MIME_TYPE_UNKNOWN when
data_size is specified as -1, to avoid crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=674452
2012-06-27 16:00:27 +02:00
Martin Pitt
72af44cb12 Allow slightly too small poll duration in /socket/timed_wait test
Sometimes the poll duration in the /socket/timed_wait test is slightly lower
than the requested 100000, causing failures like

ERROR:/build/buildd/glib2.0-2.33.2/./gio/tests/socket.c:619:test_timed_wait:
  assertion failed (poll_duration > = 100000): (99240 >= 100000)
FAIL

Adjust the test to also allow some jitter in the "too small" direction, similar
to the already existing span for "slightly too large".

https://bugzilla.gnome.org/show_bug.cgi?id=678881
2012-06-26 18:34:08 +02:00
Colin Walters
d6aa3b3bdd GTestDBus: Don't call into gvfs
https://bugzilla.gnome.org/show_bug.cgi?id=678808
2012-06-26 12:26:05 -04:00
Colin Walters
130c249eac Fix previous commit 2012-06-25 19:37:05 -04:00
Colin Walters
b837cdde69 gio/tests/actions: Plug a memory leak 2012-06-25 18:14:10 -04:00
Colin Walters
b65194e8df GIOScheduler: Disconnect from cancellable after job completes
This was causing crashes when a cancellable was canceled after the job
had completed.

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 17:07:16 -04:00
Ryan Lortie
115ca3d897 Revert "GIOScheduler: Avoid constant iteration over pending job list"
This reverts commit 2839297686.

Conflicts:

	gio/gioscheduler.c

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 16:19:03 -04:00
Lars Uebernickel
1354ef2540 GDbusActionGroup: always set strict when _query_action fails 2012-06-25 18:29:01 +02:00
Matthias Clasen
c5561ff699 Remove a few redundant ;s 2012-06-23 17:59:37 -04:00
Phil Clayton
02eed18a4e Add missing annotation to GDBusConnection::closed
Add annotation (allow-none) to the parameter error.

https://bugzilla.gnome.org/show_bug.cgi?id=677952
2012-06-23 17:54:33 -04:00
Colin Walters
991d07d66a GIOScheduler: Use a GList, not GSList for jobs
In general, code using g_slist_delete_link() is broken, because it
potentially requires an O(n) traversal.  Just switch to GList in this
case.

The performance hit here was exacerbated by the fact that we were
holding a mutex that needed to be accessed by all threads.

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-22 11:46:06 -04:00
Colin Walters
2839297686 GIOScheduler: Avoid constant iteration over pending job list
The iteration over the list (while holding a mutex) was a serious
performance hit for asynchronous I/O.  We can just use
g_cancellable_connect().

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-22 11:46:06 -04:00
Colin Walters
ccd30d6816 gresourcefile.c: Remove stray semicolon 2012-06-22 10:32:25 -04:00
Colin Walters
c1ada372e9 gmenu: Remove stray semicolon in g_menu_clear_item() 2012-06-22 10:32:25 -04:00
Colin Walters
598c3d233a tests: Add missing initializer for return value 2012-06-22 10:32:25 -04:00
Colin Walters
f626cb3c16 tests: Add missing va_end() 2012-06-22 10:32:25 -04:00
Stef Walter
8ed955ceba gresolver: More robust parsing of DNS responses
* Handle truncated responses, and invalid names

https://bugzilla.gnome.org/show_bug.cgi?id=675966
2012-06-22 08:29:51 +02:00
Matthew Barnes
49e5075707 Add g_dbus_object_manager_server_is_exported()
Returns whether a GDBusObjectSkeleton is exported on a
GDBusObjectManagerServer.

https://bugzilla.gnome.org/show_bug.cgi?id=678539
2012-06-21 23:41:54 -04:00
Colin Walters
aae1633d0f GUnixVolumeMonitor: Make use of new g_list_copy_deep() 2012-06-21 18:32:23 -04:00
Dan Winship
e0f4b2b03b gio/tests/proxy-test: fix cleanup
make sure the proxy threads are in the "waiting for a connection"
state when we do the final cleanup, or else there are race conditions
involving which thread processes the GCancellable cancellation first.
2012-06-21 15:13:06 -04:00
Matthias Clasen
e9ec1ad068 Install bash completion files in /usr/share/
The bash-completion code nowadays expects completion files to
be installed in  /usr/share/bash-completion/completions, and
expects them to be named like the command they are completing
for.

https://bugzilla.gnome.org/show_bug.cgi?id=677782
2012-06-21 06:11:58 -04:00
Dan Winship
80b6074aa2 gio/tests/pollable: add can_poll() assertions
Assert that socket streams and socket/pipe-based unix streams are
pollable, and file-based unix streams are not.

https://bugzilla.gnome.org/show_bug.cgi?id=677770
2012-06-20 10:14:01 -04:00
Dan Winship
7d0db04223 gdbus: fix generated code to not warn under -Wfloat-equal
https://bugzilla.gnome.org/show_bug.cgi?id=678333
2012-06-20 08:20:50 -04:00
Chun-wei Fan
98f201b73b Bug 678332-gio/gconverterinputstream.c: Fix build
Apparently the previous change to this file broke GCC builds, so fix that.
2012-06-19 16:35:26 +08:00
Chun-wei Fan
875854411a Bug 678332-GIO: Fix build on Windows/non-GCC
-gconverterinputstream.c: Avoid GCCism by not using non-standard pointer
 arithmetic on void*, but do a cast to char * as that seems to be what the
 variable was used for.
-gtestdbus.c: Don't include unistd.h unconditionally, and use g_usleep()
 instead of usleep(), as usleep() is not universally available.
2012-06-19 12:04:28 +08:00
William Jon McCann
ee19ddcb14 Update to use XDG cache home for thumbnails
https://bugzilla.gnome.org/show_bug.cgi?id=675168
2012-06-13 14:46:13 -04:00
Benjamin Otte
5ff95679b8 glib-compile-resources: Forward errors from spawned processes
We just grab stderr from gdk-pixbuf-to-csource and xmllint and include
it in the error message. It's the best we can do.
2012-06-13 18:54:54 +02:00
Dan Winship
0866e1ede9 update .gitignore 2012-06-12 07:09:53 -04:00
Dan Winship
14eb3d3590 gunixoutputstream: add missing can_poll() implementation
https://bugzilla.gnome.org/show_bug.cgi?id=677770
2012-06-12 07:08:26 -04:00
Murray Cumming
b9ec5699cd Remove trailing commas from enums 2012-06-12 10:35:52 +02:00
David Zeuthen
3e706ef88b GDBusProxy: Treat org.freedesktop.systemd1.Masked error as non-fatal
This is useful otherwise we'll fail if a systemd service is
masked. See bug 677718 for details.

https://bugzilla.gnome.org/show_bug.cgi?id=677718

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-06-08 13:30:48 -04:00
Tomas Bzatek
032e8dabd1 gdbus: Implement g_dbus_connection_get_last_serial()
This patch brings an ability to retrieve serial number of the last
message sent within the current thread.

https://bugzilla.gnome.org/show_bug.cgi?id=676825
2012-06-06 19:44:39 +02:00
Daniel Macks
f3ff037bd1 Pass -framework sub-flag without embedded whitespace
The "-framework" linker flag takes a second word as a parameter. If
they are passed separated with whitespace, some flag-handling routines
may not know to keep the two words together as a single unit. Use
-Wl,, to pass multiple words without embedded whitespace.

https://bugzilla.gnome.org/show_bug.cgi?id=566994
2012-06-05 21:26:58 -04:00
Martin Pitt
e4a8f12e77 g_dbus_gvariant_to_gvalue(): Add missing out annotation 2012-06-05 18:50:36 +02:00
Matthias Clasen
3e1b972c93 Improve GResource test coverage 2012-06-04 06:04:29 -04:00
Matthias Clasen
c7de2dd0e3 Improve GSocketAddress test coverage 2012-06-04 06:04:29 -04:00
Matthias Clasen
721366d088 Improve GNetworkMonitor test coverage 2012-06-04 06:04:29 -04:00
Matthias Clasen
4ad5210b35 Improve GIcon test coverage 2012-06-04 06:04:29 -04:00
Matthias Clasen
3129bac14c Formatting cleanups 2012-06-04 06:04:28 -04:00
Matthias Clasen
eeb5140ad2 Improve GMenu test coverage 2012-06-04 06:04:28 -04:00
Matthias Clasen
0a1079d171 Improve GApplication test coverage 2012-06-04 06:04:28 -04:00
Matthias Clasen
642e89f356 Improve GActionGroup test coverage 2012-06-04 06:04:27 -04:00
Matthias Clasen
a53a1b65b5 Improve GIcon test coverage 2012-06-04 06:04:27 -04:00
Matthias Clasen
26a1056bde Expand GAppInfo tests 2012-06-04 06:04:26 -04:00
Dan Winship
69e12cd3d5 GConverterInputStream: fix an edge case
Reading from a GConverterInputStream with both input_buffer and
converted_buffer non-empty would return bogus data (the data from
converted_buffer would essentially get skipped over, though the
returned nread reflected what the count would be if it hadn't been).

This was never noticed before because (a) it can't happen if all of
your reads are at least as large as either the internal buffer size or
the remaining length of the stream (which covers most real-world use),
and (b) it can't happen if all of your reads are 1 byte (which covers
most of tests/converter-test). (And (c) it only happens for some
converters/input streams.) But this was happening occasionally in
libsoup when content-sniffing a gzipped response, because the
SoupContentSnifferStream would first read 512 bytes (to sniff), and
then pass through larger reads after that.

Fixed and added a test to converter-test.

https://bugzilla.gnome.org/show_bug.cgi?id=676478
2012-05-30 09:02:33 -04:00
Christian Persch
0fd9863abe build: Add missing AM_V_GEN to silence the build 2012-05-29 19:10:57 +02:00
Christian Persch
4979c1d075 application: Add dbus register/unregister hooks
When the application is using its D-Bus backend, it is useful to be able
to export extra D-Bus objects at the right time, i.e. *before* the application
tries to own the bus name. This is accomplished here by adding a hook
in GApplicationClass for this; and a corresponding hook that will be called
on unregistration to undo whatever the register hook did.

Bug #675509.
2012-05-29 19:01:42 +02:00
Colin Walters
175864b83c gappinfo: Fix uninitialized-variable gcc warning 2012-05-26 11:53:14 -04:00
Colin Walters
151e37816b Annotate API introduced for 2.34 with GLIB_AVAILABLE_IN_2_34
https://bugzilla.gnome.org/show_bug.cgi?id=676816
2012-05-26 10:13:30 -04:00
Colin Walters
1cc7162c95 Annotate API introduced for 2.32 with GLIB_AVAILABLE_IN_2_32
https://bugzilla.gnome.org/show_bug.cgi?id=676816
2012-05-26 10:13:30 -04:00
Colin Walters
a963712646 Annotate API introduced for 2.30 with GLIB_AVAILABLE_IN_2_30
I didn't do this comprehensively, since there's a lot of it, mainly
due to the GDBus object manager stuff, but anyone trying to use
that would fail fast due to lack of the gdbus code generator.

My main goal was to get API additions to existing classes like
g_data_input_stream_read_line_utf8(), as well as the lower level new
API like glib-unix.h.

https://bugzilla.gnome.org/show_bug.cgi?id=676816
2012-05-26 10:13:30 -04:00
Marc-Antoine Perennou
9c86e1168c gio: fix symbol name
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2012-05-26 10:35:05 +02:00
Dan Winship
800d6ff111 gio: add GBytes-based input/output stream methods
Using a caller-supplied buffer for g_input_stream_read() doesn't
translate well to the semantics of many other languages, and using a
non-refcounted buffer for read_async() and write_async() makes it
impossible to manage the memory correctly currently in
garbage-collected languages.

Fix both of these issues by adding a new set of methods that work with
GBytes objects rather than plain buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=671139
2012-05-24 17:48:13 -04:00
Christian Persch
4b456635e4 Revert "application: Don't print a critical warning here"
This reverts commit 1541478bac.
2012-05-24 17:51:35 +02:00
Christian Persch
ee1965b888 application: Save a few bytes in the library
There's really no need to put useless whitespace into the .so.
2012-05-24 17:34:08 +02:00
Christian Persch
1541478bac application: Don't print a critical warning here
It's a runtime error, not a programming error.
2012-05-24 17:33:37 +02:00
Colin Walters
44d4990442 GMemoryOutputStream: Add API to return data as a GBytes
Matches the corresponding additions to GMemoryInputStream.

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2012-05-21 13:45:15 -04:00
Colin Walters
1bedf24879 GMemoryInputStream: Add API to accept GBytes
And s/Chunk/GBytes/ internally.  GBytes is really a perfect match for
GMemoryInputStream.

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2012-05-21 13:45:15 -04:00
Debarshi Ray
6e32f0a601 gio: The tmpl parameter to g_file_new_tmp can be NULL
Fixes: https://bugzilla.gnome.org/676208
2012-05-21 17:54:25 +02:00
Dan Winship
8df2b96a69 proxy-test: work even when the upstream DNS lies
Rather than depending on the host's DNS configuration to properly
return an error for a non-existent hostname, just substitute in
a dummy GResolver implementation that does it for us.
2012-05-18 12:18:23 -04:00
Dan Winship
555cd1923f g_app_info_launch_default_for_uri: don't use GFile if we don't have to
GFile doesn't handle some "real" URIs, so check if there's a default
handler for the URI scheme first, and only use g_file_new_for_uri()
and g_file_query_default_handler() if not. Eg, this fixes the case of
opening http URIs with "%2F" in the path.

https://bugzilla.gnome.org/show_bug.cgi?id=666386
2012-05-18 12:17:28 -04:00
Holger Berndt
0e6d9df35c Document that g_app_info_create_from_commandline() does unquoting according to fd.o
https://bugzilla.gnome.org/show_bug.cgi?id=676277
2012-05-18 15:20:40 +02:00
Dan Winship
17e95c59c9 gnetworkmonitornetlink: don't leak the list of networks
https://bugzilla.gnome.org/show_bug.cgi?id=676265
2012-05-17 13:48:56 -04:00
Matthias Clasen
787f808783 gsettings: add reset-recursively to bash completion
https://bugzilla.gnome.org/show_bug.cgi?id=675832
2012-05-17 00:44:36 -04:00
Dan Winship
447a25ea50 update .gitignore 2012-05-16 12:00:44 -04:00
Giovanni Campagna
0417ddab6f GAppInfo: add a mechanism to query supported content types
This essentially adds an accessor for the MimeType field in desktop files,
to retrieve the list of all mime types supported by an application.
The interface though is part of GAppInfo, so it could be implemented
in the future by other backends.

https://bugzilla.gnome.org/show_bug.cgi?id=674111
2012-05-16 12:42:12 +02:00
Dan Winship
e011d2c921 Add g_type_ensure() and use it rather than playing games with volatile
https://bugzilla.gnome.org/show_bug.cgi?id=605976
2012-05-15 13:46:38 -04:00
Paolo Borelli
2a4235d0f3 gfile: add g_return_if_fail to g_file_make_directory_with_parents() 2012-05-15 17:39:38 +02:00
Colin Walters
5a57144d57 gfile: Plug memory leak in g_file_make_directory_with_parents()
The logic here is pretty twisted, but basically we were leaking a ref
for each non-existent parent.  The clearest way to fix this was to
move to more explicit refcounting logic; when a variable is pointing
to an object, it holds a ref.

https://bugzilla.gnome.org/show_bug.cgi?id=675446
2012-05-15 11:07:33 -04:00
Lars Uebernickel
ebc3b928a3 docs: reference g_menu_item_new in gmenu convenience menuitem API 2012-05-10 09:35:03 -07:00
Christian Persch
486d563049 application: Clarification about 'primary instance'
For non-unique applications, the 'primary instance' is the current
instance.
2012-05-02 20:15:39 +02:00
Ryan Lortie
b31d872081 tests: temporarily disable GDBus async proxy test
It has never worked properly and, with the new GDBus testing stuff, it's
occasionally failing.

https://bugzilla.gnome.org/show_bug.cgi?id=672248
2012-05-01 15:16:05 -07:00
Ryan Lortie
56ca8add10 contenttype test: don't pass -1 as length
g_content_type_guess() takes a gsize, not a gssize, and -1 does not mean
"I am passing a NULL terminated string".
2012-05-01 15:16:05 -07:00
Ryan Lortie
eb5381b862 GApplication: add accessor for DBus information
Provide public access to the GDBusConnect and object path that
GApplication is using.  Prevents others from having to guess these
things for themselves based on the application ID.

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:43:06 -04:00
Ryan Lortie
16f92a33ac GApplication: allow null application_id
GApplication application ID is now permitted to be NULL, in which case
G_APPLICATION_NON_UNIQUE will be implicitly enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=671249
2012-04-30 17:38:15 -04:00
Dan Winship
7d4d0668b3 Update gio/tests/.gitignore 2012-04-30 09:28:42 -04:00
Dan Winship
c37273dccb fix warnings 2012-04-30 09:28:42 -04:00
Dan Winship
fd3ec4df87 Fix several recently-introduced bugs in g_output_stream_write_async()
g_output_stream_write_async() was not initializing the newly-added
members of the WriteData structure, causing various problems.

Also, g_input_stream_read_async() was now leaking its cancellable. Fix
that as well.

https://bugzilla.gnome.org/show_bug.cgi?id=674612
2012-04-27 09:27:38 -04:00
Debarshi Ray
3f816dc5d1 GAppInfo: overwrite the DISPLAY only if it is set in the launch context
If the launch context is a GAppLaunchContext, and not a
GdkAppLaunchContext, then g_app_launch_context_get_display will return
NULL because the get_display virtual method is undefined. The DISPLAY
might still be inherited from the parent process, in which case
overwriting it with NULL breaks the launch.

This is a regression introduced in:
de834bed30

Fixes: https://bugzilla.gnome.org/672786
2012-04-26 23:10:41 +02:00
Alexander Larsson
79724bf80c Dist gio/dbus-daemon.xml and fix dependency for builddir != srcdir 2012-04-26 10:06:18 +02:00
Colin Walters
063ec9a75d build: Fix 'make dist' regression
Commit f084b60377 incorrectly set
DIST_SUBDIRS for the toplevel Makefile.am.  In general actually we
don't need to set it, because modern automake automatically sets
it by looking at conditionals for SUBDIRS.

Tested-by: Rico Tzschichholz <ricotz@t-online.de>

https://bugzilla.gnome.org/show_bug.cgi?id=667806
2012-04-25 15:41:48 -04:00
Dan Winship
87cc77a198 gsocket: test if family is <= 0, not < 0
If all members of GSocketFamily are supported on the platform, then
all of its values will be positive, and so the enum might become
unsigned, in which case testing for "family < 0" might cause warnings.
But we want to return an error if family == 0 (aka
G_SOCKET_FAMILY_INVALID) anyway, so just tweak the test accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=674592
2012-04-25 10:46:44 -04:00
Dieter Verfaillie
b053f990c9 win32: More srcdir != builddir fixing 2012-04-24 16:39:21 +02:00
Alexander Larsson
62905cda0b win32: Fix build with srcdir != builddir
Missed this part in the last commit
2012-04-24 14:53:49 +02:00
Alexander Larsson
88bfc9b289 win32: Fix build of gdbus-daemon-generated.[ch]
gdbus-daemon-generated.[ch] failed to build because it depended
on gdbus-2.0/codegen/gdbus-codegen which was build during the SUBDIRS part
of the build, however SUBDIRS are done *after* processing BUILT_SOURCES,
and these files are in BUILT_SOURCES.

The fix is simple, instead of running the gdbus-codegen code we
run the gdbus-codegen.in code, which works fine for uninstalled execution.

I also removed Makefile from the dependencies to avoid rebuilding the file
in tarballs, as Makefiles are written at configure time. We should be able to
ship the prebuilt files in the tarballs.
When running uninstalled
2012-04-24 14:09:54 +02:00
Maciej Piechotka
a44e801983 Make GDataOutputStream implement GSeekable
https://bugzilla.gnome.org/show_bug.cgi?id=673034
2012-04-23 10:57:12 +02:00
Maciej Piechotka
43895e3089 Make GBufferedOutputStream implement GSeekable
https://bugzilla.gnome.org/show_bug.cgi?id=673034
2012-04-23 10:57:07 +02:00
Maciej Piechotka
90739baec0 Make GBufferedInputStream implement GSeekable
https://bugzilla.gnome.org/show_bug.cgi?id=673034
2012-04-23 10:57:01 +02:00
Dan Winship
2a37bc0dc6 gio: add a proxy test program
Test GProxy, GProxyResolver, GProxyAddress, and
GProxyAddressEnumerator, plus GSocketClient's proxy-resolving
codepaths.
2012-04-22 15:24:36 -04:00
Dan Winship
bcaa0a3820 gio: Add more information to GProxyAddress
Add two new methods to GProxyAddress for recovering information about
the destination URI that the proxy was created for (and modify
GProxyAddressEnumerator to set that information when creating the
GProxyAddress).
2012-04-22 15:24:29 -04:00
Dan Winship
8c7025e723 gio: fix error handling in async case of GProxyAddressEnumerator
In the async case, a failed DNS lookup was causing the proxy
resolution to bail out immediately, rather than just moving on to the
next potential proxy (which might not need us to do the DNS lookup
beforehand). Fix that.
2012-04-22 15:23:40 -04:00
Alexander Larsson
5fb44f70dc win32: Implement _g_dbus_get_machine_id using machine guid
This is what libdbus uses, so we're compatible.
2012-04-20 15:02:48 +02:00
Alexander Larsson
dccce38367 win32: Support autolaunching dbus daemon 2012-04-20 15:02:48 +02:00
Alexander Larsson
bd148e127a Add _g_io_win32_get_module to get the gio HMODULE 2012-04-20 15:02:48 +02:00
Alexander Larsson
74214e2997 GTestDBus: Allow to specify the dbus-daemon binary
The env var G_TEST_DBUS_DAEMON lets you change dbus-daemon to
whatever you want. This is useful to test with gdbus-daemon
2012-04-20 15:02:48 +02:00
Alexander Larsson
0d8b1b14d2 Add gdbus-daemon test app 2012-04-20 15:02:48 +02:00
Alexander Larsson
25581738a8 Add GDBusDAaemon, an implementation of a message bus
This is mostly complete, sans support for activation. However, its
not as picky as the libdbus implementation in terms like validation
and limits checking, nor is it as tested.

Its can be useful to test gdbus if dbus-daemon is not availible, but
its main reason for existance is to implement a default session bus
on win32 so that e.g. GApplication is guaranteed to work.
2012-04-20 15:02:48 +02:00
Benjamin Otte
b38f1c7aff resourcefile: Set display name
Fixes resource filenames not being printed in CSS warnings for GTK.

https://bugzilla.gnome.org/show_bug.cgi?id=674345
2012-04-20 14:32:41 +02:00
Matthias Clasen
289e3b9143 More beautiful fix
A comma on a line by itself is too ugly to stand.
2012-04-19 17:15:14 -04:00
Alexander Larsson
bb78753a66 Fix non-win32 build error in my recent commit 2012-04-19 20:46:08 +02:00
Alexander Larsson
21e049b253 Tests: Move dbus specific tests to if HAVE_DBUS_DAEMON
These used to only be built on unix, but if you have dbus-daemon on
win32 we should really build them there too.
2012-04-19 18:19:10 +02:00
Alexander Larsson
234ddf131b Fix test building on win32 2012-04-19 18:19:10 +02:00
Alexander Larsson
58e613bfc7 GTestDBus: Make work on win32
Win32 doesn't have things like fork so the existing code has no way
of working. Instead we swap it all out for a custom implementation
on win32.
2012-04-19 18:19:01 +02:00
Alexander Larsson
0d9a7f2117 Remove ununsed include 2012-04-19 10:24:08 +02:00
Alexander Larsson
82aecce301 gdbus: Escape nonce files in dbus addressess
Otherwise the colon in c:\blah made for trouble
2012-04-19 10:24:08 +02:00
Alexander Larsson
b77af49b0a Fix race in gdbus-connection test
We need to flush the AddMatches before even connecting to the bus, or we
risk missing the NameOwnerChanged from the new connections.
2012-04-19 10:24:08 +02:00
Alexander Larsson
ff92fe9593 Support initial underscores in dbus codegen namespace
Before these were considered lowercase and thus got duplicated.
2012-04-19 10:24:08 +02:00
Xavier Claessens
415a8d81f6 Use GTestDBus in all GDBus unit tests
To make port easier, this rewrites dbus-sessionbus.c using a
GTestDBus singleton internally.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:07:39 +02:00
Xavier Claessens
95bf3d1194 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:06:26 +02:00
Xavier Claessens
2e3d50631f Add private _g_bus_get_singleton_if_exists() function
This is used by g_test_dbus_down() to ensure the GDBusConnection
gets disposed, but not create one if the singleton already got
disposed.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:06:21 +02:00
David Zeuthen
98569e53e3 Revert "Add a private copy of gio/tests/gdbus-tests.c,h to gio/"
This reverts commit 07bbc87615.
2012-04-18 13:48:27 -04:00
David Zeuthen
26d4da2352 Revert "Add private _g_bus_get_singleton_if_exists() function"
This reverts commit f8a8e90398.
2012-04-18 13:48:09 -04:00
David Zeuthen
a6f83d73e5 Revert "Add GTestDBus object"
This reverts commit 1b5f70b5b0.
2012-04-18 13:47:51 -04:00
David Zeuthen
9dce93514e GMenuModel: Don't leak GDBusConnection in test
See https://bugzilla.gnome.org/show_bug.cgi?id=672985#c89

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-18 13:33:00 -04:00
Xavier Claessens
1b5f70b5b0 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

session_bus_up/down() are now just wrappers around a GTestDBus singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00
Xavier Claessens
f8a8e90398 Add private _g_bus_get_singleton_if_exists() function
This is used by g_test_dbus_down() to ensure the GDBusConnection
gets disposed, but not create one if the singleton already got
disposed.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00
Xavier Claessens
07bbc87615 Add a private copy of gio/tests/gdbus-tests.c,h to gio/
https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00
David Zeuthen
7f5f47ae15 gdbus-codegen: Don't leak stuff in tests
Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-17 17:51:55 -04:00
David Zeuthen
eedb6d8366 GDBusObjectProxy: Don't leak connection
Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-17 17:51:55 -04:00
David Zeuthen
3964e708e9 GDBusObjectManagerClient: Don't leak object proxy when handling D-Bus signal
It's g_object_unref(), not g_object_ref(). Ugh.

Therefore, use g_clear_object().

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-17 17:51:55 -04:00
Dan Winship
00ee06e6a3 gio: use GPollable* to implement fallback read_async/write_async
If a GInputStream does not provide a read_async() implementation, but
does implement GPollableInputStream, then instead of doing
read-synchronously-in-a-thread, just use
g_pollable_input_stream_read_nonblocking() and
g_pollable_input_stream_create_source() to implement an async read in
the same thread. Similarly for GOutputStream.

Remove a bunch of existing read_async()/write_async() implementations
that are basically equivalent to the new fallback method.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
2012-04-17 12:33:12 -04:00
Dan Winship
82ec4dcaed gio: implement GPollableInput/OutputStream in more stream types
Implement GPollableInputStream in GMemoryInputStream and
GConverterInputStream, and likewise implement GPollableOutputStream in
the corresponding output streams.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
2012-04-17 12:33:12 -04:00
Dan Winship
111ba203c2 gpollableutils: utility functions for pollable stream implementations
Move g_pollable_source_new() here from gpollableinputstream.c, add
g_pollable_source_new_full(), and add some new methods to do either
blocking or nonblocking reads depending on a boolean argument.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
2012-04-17 12:33:12 -04:00
Dan Winship
7e95777a6a gio: minor GPollableInputStream / GPollableOutputStream fixes
Make g_pollable_input_stream_read() and
g_pollable_output_stream_write() look a little bit more like the
non-pollable versions in terms of error handling, etc. Also, use the
read_fn and write_fn virtual methods directly rather than calling
g_input_stream_read()/g_output_stream_write(), to avoid problems with
re-entrancy involving the "pending" flag.

Also belatedly add single-include guards to the header files.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
2012-04-17 12:33:12 -04:00
Dan Winship
adea9fb252 GConverterInputStream: fix an infinite loop when fill_buffer returns an error
The loop was using a GConverterResult variable where it meant to use a
gssize, and since GConverterResult was ending up as an unsigned type,
this meant the (res < 0) check always failed.
2012-04-17 12:33:12 -04:00
Christian Persch
8869de3857 gdbus-codegen: Avoid warnings in generated code
Initialising a "gchar *" struct member from a string literal may produce
a warning; add an explicit cast to fix that.

Bug #664275.
2012-04-16 22:39:34 +02:00
Christian Persch
5ef34e5f11 resources: compiler: Fix resources on big endian architectures
Resources are always little endian, so the gvdb is byteswapped. When looking
up the value, it would return a new byteswapped variant, making the data
returned from do_lookup() invalid once that variant is unref'd. Since
byteswapping doesn't matter for the "ay" data anyway, just use
gvdb_table_get_raw_value() instead and only byteswap the length and flag
values.

https://bugzilla.gnome.org/show_bug.cgi?id=673409
2012-04-16 22:39:34 +02:00
Kalev Lember
b3b32be1e1 Only build gmenumodel test on unix
It depends on gdbus-sessionbus.c which only builds on unix.
2012-04-16 18:46:12 +03:00
Stef Walter
666374c16f Add support for MX, TXT, NS and SOA records to GResolver
* Add resolver functions for looking up DNS records of
   various types. Currently implemented: MX, TXT, SOA, SRV, NS
 * Return records as GVariant tuples.
 * Make the GSrvTarget lookups a wrapper over this new
   functionality.
 * Rework the resolver test so that it has support for
   looking up MX, NS, SOA, TXT records, and uses GOptionContext

https://bugzilla.gnome.org/show_bug.cgi?id=672944
2012-04-16 15:51:39 +02:00
Colin Walters
f084b60377 build: Add --disable-modular-tests build option
This patch solves two problems:

First, it allows builders to optionally cut the circular dependency
between dbus and glib by disabling the modular tests (just like how
the tests can be disabled in dbus).

Second, the tests are entirely pointless to build if cross-compiling.

It also moves us slightly closer to the long term future we want where
the tests are a separate ./configure invocation and run against the
INSTALLED glib, not the one in the source tree. This would allow us to
run the tests constantly, not just when glib is built.

https://bugzilla.gnome.org/show_bug.cgi?id=667806
2012-04-15 11:15:54 -04:00
Cosimo Cecchi
1e2ca76464 fileinfo: document the correct type for trash::orig-path
The correct type for this attribute, as set by GVfs, is
G_FILE_ATTRIBUTE_TYPE_BYTE_STRING (which is the correct type for file
paths anyway).

https://bugzilla.gnome.org/show_bug.cgi?id=674074
2012-04-14 13:09:33 -04:00
David Zeuthen
6a9341d851 GDBusAuth: Handle when no there is no auth observer present
I obviously fucked up when adding the ::allow-mechanism signal, sorry.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-14 12:40:57 -04:00
David Zeuthen
b9d1fe7db2 Check that auth methods work and interoperate with libdbus-1
See https://bugzilla.gnome.org/show_bug.cgi?id=673943

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-14 12:33:14 -04:00
David Zeuthen
9496565a4c GSocketControlMessage: Don't warn about unknown messages
If we do this, the tests added in bug 673943 will cause warnings.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-14 12:32:23 -04:00
David Zeuthen
ce81bd87c5 GDBusAuthObserver: Add a way to control what authentication mechanisms to use
This is related to https://bugzilla.gnome.org/show_bug.cgi?id=673943
but also useful in a lot of other contexts.
2012-04-14 11:52:20 -04:00
Giovanni Campagna
bb7f3e0cbd GDesktopAppInfo: add an accessor for StartupWMClass
Components using GIO to do window to application matching can
use that field to retrieve potential candidates.

https://bugzilla.gnome.org/show_bug.cgi?id=673659
2012-04-14 02:44:25 +02:00
Kalev Lember
e13fc58535 GResource docs: fix typo 2012-04-13 13:22:46 +03:00
Ryan Lortie
192892b52c GSettings docs: clarify what is a good path
Add an explicit note to the docs about choosing paths based on domain
names, not ones like "/apps/", "/desktop/" or "/system/".
2012-04-12 20:04:32 -04:00
Ryan Lortie
6560b37450 glib-compile-schemas: warn about bad dconf paths
For quite some time the recommended usage of GSettings and dconf has
been to use paths like /org/gnome/example/.  Use of /apps/ has spilled
over from GConf and is continuing to make its way into a number of
applications as they port.

glib-compile-schemas will now warn about these types of paths being
used.  This generates a lot of noise, but hopefully it will reduce the
number of ported applications making this mistake.
2012-04-12 19:55:34 -04:00
Alexander Larsson
386f0f29fd Fall back to SO_PEERCRED if credentials passing fails
Turns out libdbus doesn't send struct ucred credentials on linux, but
just relies on the SO_PEERCRED support. However, gdbus does send, and
expect to recieve a ucred credential. So, when libdbus talks to a
gdbus server the authentication fails to send the credentials.

We fix this by falling back to g_socket_get_credentials() if we don't
get any credential messages.
2012-04-12 16:50:20 +02:00
Alexander Larsson
ec91ed00f1 Detect "empty" socket credentials on Linux
Linux uses struct ucred to pass over socket credentials. Historically
this has always worked in recievemsg, if SO_PASSCRED was set on the socket,
even if the remote side didn't pass any credits. But this change broke that:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=16e5726269611b71c930054ffe9b858c1cea88eb;hp=a9e9fd7182332d0cf5f3e601df3e71dd431b70d7

However, it doesn't actually fail getting the credentials, it just returns
an "empty" one, as initialized by cred_to_ucred() at:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=net/core/sock.c;h=b29ab61b029cf7f76fda992ecfcb8dcaa06b0483;#l756

So, we detect this and fail the credentials reading.

This actually happened in real life with gdbus acting as a server, as
gdbus expected an ucred but libdbus didn't send one.
2012-04-12 16:43:49 +02:00
William Hua
69d929e67f Be more precise about Carbon v. Cocoa. 2012-04-11 23:25:09 -04:00
Jeremy Huddleston
5739d896f8 Don't use fast enumeration in old version of Mac OS.
Signed-off-by: William Hua <william@attente.ca>
2012-04-11 10:31:59 -04:00
Jeremy Huddleston
51a2661da6 Link with Foundation framework on OSX.
Signed-off-by: William Hua <william@attente.ca>
2012-04-11 10:31:59 -04:00
Will Thompson
c037879bd1 gdbus: test case for 673612
When presented with an array of empty arrays of 8-byte-aligned types,
GDBus would incorrectly apply the 8-byte alignment when reading back.

https://bugzilla.gnome.org/show_bug.cgi?id=673612

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-10 16:39:49 -04:00
Will Thompson
113f4abb67 GDBusMessage: do not align for grandchildren of empty arrays.
D-Bus arrays are serialized as follows:

1. align to a 4-byte boundary (for the length)
2. uint32: the length of the serialized body in bytes
3. padding for the alignment of the body type (not included in the length)
4. the body.

Note that 3. is a no-op unless the body type is an 8-byte aligned type
(uint64, int64, double, struct, dict_entry), since you are always on a
4-byte boundary from aligning and writing the length.

So, an empty aax (that is, an array containing zero arrays of int64)
is serialized as follows:

1. align to a 4-byte boundary
2. length of the contents of this (empty) array, in bytes (0)
3. align to a 4-byte boundary (the child array's alignment requirement)
4. there is no body.

But previously, GDBus would recurse in step three to align not just for
the type of the child array, but for the nonexistent child array's
contents. This only affects the algorithm when the grandchild type has
8-byte alignment and the reader happened to not already be on an 8-byte
boundary, in which case 4 bytes were spuriously skipped.

https://bugzilla.gnome.org/show_bug.cgi?id=673612

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-10 16:39:47 -04:00
Will Thompson
e28d3ef921 GDBusMessage: print more debug info about alignment
Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-10 16:39:45 -04:00
Matthias Clasen
43806fca69 settings: Improve test coverage 2012-04-08 10:24:51 -04:00
Matthias Clasen
3072e7afee gdbusserver: Improve test coverage 2012-04-08 10:24:51 -04:00
Matthias Clasen
26145b9708 icon: Improve test coverage 2012-04-08 10:24:51 -04:00
Matthias Clasen
a8c869e945 contenttype: Improve test coverage
Excercise more parts of the guessing machinery.
These tests rely on the mime database being present.
2012-04-08 10:24:51 -04:00
Matthias Clasen
1e2cf010e7 networkaddress: Improve test coverage 2012-04-08 10:24:51 -04:00
Matthias Clasen
5632e9fc9c networkaddress: Fix userinfo parsing in uris
The code that is checking the userinfo part was accidentally
given a pointer to the end of the userinfo, so it was not
checking the right portion of the string at all.
2012-04-08 10:24:51 -04:00
Matthias Clasen
6a57bf1243 Make the dbus menu tests independent from the session bus
With this change,
DBUS_SESSION_BUS_ADDRESS= make check
succeed here.
2012-04-08 10:24:50 -04:00
Matthias Clasen
d036960d30 ifdef out some unused code
Nothing wrong with leaving debug spew in the code, but we should
not build it if it is not used.
2012-04-08 10:24:50 -04:00
Matthias Clasen
5ce66bed3d Formatting cleanup 2012-04-06 21:22:17 -04:00
Matthias Clasen
e52cf81042 Don't return values from void functions
Sun CC does not take that lightly.
2012-04-06 20:41:19 -04:00
Matthias Clasen
d0b429af48 Revert "GDesktopAppInfo: add an accessor for StartupWMClass"
This reverts commit 3ccc4cf91d.
2012-04-06 19:15:53 -04:00
Giovanni Campagna
3ccc4cf91d GDesktopAppInfo: add an accessor for StartupWMClass
Components using GIO to do window to application matching can
use that field to retrieve potential candidates.

https://bugzilla.gnome.org/show_bug.cgi?id=673659
2012-04-07 00:22:02 +02:00
Dieter Verfaillie
2655262889 Fix malformed GTK-Doc comment blocks: remove repeated comment blocks.
gio/gproxyresolver.h: GProxyResolver already documented in gio/giotypes.h
gio/gtlsbackend.h: GTlsBackend already documented in gio/gtlsbackend.c
gio/gtlsclientconnection.h: GTlsClientConnection already documented in gio/gtlsclientconnection.c
gio/gtlsconnection.h: GTlsConnection already documented in gio/gtlsconnection.c
gio/gunixconnection.h: GTcpConnection already documented in gio/giotypes.h
glib/gversion.h: GLIB_CHECK_VERSION already documented in glib/gversion.c

Found these thanks to the improved gobject-introspection
GTK-Doc comment block/annotation parser.
See https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:46 -03:00
Dieter Verfaillie
ce7f1a0789 Fix malformed GTK-Doc comment blocks: don't confuse GTK-Doc parsers.
Found these thanks to the improved gobject-introspection
GTK-Doc comment block/annotation parser.
See https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:45 -03:00
Dieter Verfaillie
0183c1f8a1 Fix malformed GTK-Doc comment blocks: invalid parameters and tags.
Found these thanks to the improved gobject-introspection
GTK-Doc comment block/annotation parser.
See https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:42 -03:00
Dieter Verfaillie
fefe5d9a20 Fix malformed GTK-Doc comment blocks: correct struct name.
Found these thanks to improved gobject-introspection GTK-Doc
comment block/annotation parser from:
https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:42 -03:00
Dieter Verfaillie
60fb0f5ea8 Fix malformed GTK-Doc comment blocks: unmark non GTK-Doc comment block.
Found these thanks to improved gobject-introspection GTK-Doc
comment block/annotation parser from:
https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:40 -03:00
Dieter Verfaillie
8e740f726f Fix malformed GTK-Doc comment blocks: add missing colons.
Found these thanks to improved gobject-introspection GTK-Doc
comment block/annotation parser from:
https://bugzilla.gnome.org/show_bug.cgi?id=672254

https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-04-05 10:23:39 -03:00
Dan Winship
88781d5906 Fix some gtk-doc stuff 2012-04-04 15:23:31 -04:00
Matthias Clasen
69d6987995 Switch to using a mainloop when waiting for connection close
GDBus heavily relies on idles for some of its cleanup operations,
and not running a mainloop leads to things not getting cleaned
up properly, which in turn leads to test failures, since the
session bus singleton does not get removed.
2012-04-04 15:02:48 -04:00
Matthias Clasen
f1d4d3a4a5 Improve GApplication tests
Make GApplication tests manage their dbus connections.
2012-04-04 15:02:48 -04:00
Matthias Clasen
a52c0a06c8 Make basic-application test more robust
This program is only used indirectly from gapplication.c in
tests, but that is no reason to let it segfault when it is
run from the commandline without arguments.
2012-04-04 15:02:48 -04:00
Matthias Clasen
9171894a59 GActionMap: correct critical warnings
These warnings were copied from GSimpleActionGroup, but the function
names were not updated. Correct that.
2012-04-04 15:02:48 -04:00
Matthias Clasen
4259587fec Add tests for action-related gapplication api 2012-04-04 15:02:48 -04:00
Matthias Clasen
8a4744f7fd Add a test for g_application_quit 2012-04-04 15:02:48 -04:00
Dan Winship
47adef84da Fix warnings caused by an ifdeffed-out test case 2012-04-04 10:47:04 -04:00
Rodrigo Moya
118c42e747 Always include G_SOCKET_FAMILY_UNIX value in GSocketFamily
This is needed because glib-mkenums doesn't handle #ifdef values in
enums, and so it needs to have all values always defined in the enum.
When not available, define the missing values to a negative value.
2012-04-04 11:39:03 +02:00
Will Thompson
f2c77ee718 g_input_stream_read[_finish]: document returning 0 on EOF
g_input_stream_read() does state that it returns 0 on end of file, but
not in the Returns: line, so it's easy to miss on a quick skim-read.

g_input_stream_read_async() documents that g_input_stream_read_finish()
returns 0 on end of file, but g_input_stream_read_finish() itself does
not.

https://bugzilla.gnome.org/show_bug.cgi?id=673174
2012-04-02 18:10:35 +01:00
Matthias Clasen
9ea9471d26 Improve GBusObjectManager test coverage 2012-04-02 09:09:10 -04:00
Antoine Jacoutot
1494544958 gresource: libelf, try pkg-config first then fall-back to AC_CHECK_LIB
On some systems gelf.h may not be stored under the top level include
directory in which case we need to add the correct include paths in
cflags by using pkg-config(1).
2012-03-31 20:22:51 +02:00
Robert Ancell
4143842eb4 Add missing allow-none annotations for function parameters.
Found using:
find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-03-31 20:34:28 +11:00
Christian Persch
e3cc48f289 resources: compiler: Respect absolute paths
When a <file> already has an absolute path, use it directly instead of trying to
locate it in the --sourcedir directories.

https://bugzilla.gnome.org/show_bug.cgi?id=672541
2012-03-29 17:43:43 +02:00
Dan Winship
cbb95038cf GFileMonitor: fix docs bug 2012-03-27 12:45:27 -04:00
Bastien Nocera
9b0734a09c all: s/availible/available/ 2012-03-27 11:01:00 +02:00
Alexander Larsson
aed6d01d14 Only build actions test on unix
It depends on gdbus-sessionbus.c which only builds on unix.
2012-03-20 10:18:32 +01:00
Marco Trevisan (Treviño)
322c6e9344 GDBusConnection: Avoid dereferencing vtable for unregistered objects
https://bugzilla.gnome.org/show_bug.cgi?id=671988

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-03-19 17:12:00 -04:00
Ryan Lortie
2afbc425eb GDBus: set no-reply flag on calls with no callback
If g_dbus_connection_call() or g_dbus_proxy_call() are given a NULL
callback then set the no-reply flag on the outgoing D-Bus message.

https://bugzilla.gnome.org/show_bug.cgi?id=672239
2012-03-19 12:41:23 -04:00
Ryan Lortie
c3125ee36d GDBusProxy: report an error instead of leaking it
GDBusProxy sets an error on a GSimpleAsyncResult and then returns
without dispatching the result for completion (and leaks the result in
the process).  Fix that.

Also add a testcase.  Unfortunately, adding the testcase uncovered
bug #672248.  We can work around that by reordering the tests.

https://bugzilla.gnome.org/show_bug.cgi?id=672249
2012-03-19 12:41:18 -04:00
Dieter Verfaillie
e2b47ae9e0 Fix out of tree build for MinGW/MSYS
When building with MinGW/MSYS with srcdir != builddir the build fails:
- to locate the generated .def files
- creating libglib-gdb.py
- creating libgobject-gdb.py

Solved this by explicitly instructing these files to be generated
in $(builddir)/...

https://bugzilla.gnome.org/show_bug.cgi?id=653167
2012-03-17 23:10:01 -04:00
Tomas Bzatek
f3fca56b7e gio: Only show mounts in /run/media/$USER
And reflect the recent changes + sync with gvfs+udisks2 rules.

https://bugzilla.gnome.org/show_bug.cgi?id=669797
2012-03-16 18:54:09 +01:00
David Zeuthen
f025c9c4f4 GDBusConnection: Don't store GCancellable in qdata
Now that we're using g_simple_async_result_set_check_cancellable() we
no longer need this terrible hack of carrying the GCancellable on the
GSimpleAsyncResult using qdata. See bug 672013 for more details.

https://bugzilla.gnome.org/show_bug.cgi?id=672013

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-03-15 14:04:39 -04:00
Ryan Lortie
e3c7fdd7a4 GDBus: make use of reliable async cancellation
Call g_simple_async_result_set_check_cancellable() after all
GSimpleAsyncResult creation in order to take advantage of the new
reliable cancellation feature.

The guarantee of reliable cancellation fixes a bug in dbusmenu (which
was already assuming that cancellation was reliable).  See this bug:
https://bugs.launchpad.net/ubuntu/+source/libdbusmenu/+bug/953562

https://bugzilla.gnome.org/show_bug.cgi?id=672013

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-03-15 14:01:35 -04:00
Ryan Lortie
4804094472 GSimpleAsyncResult: support reliable cancellation
Add a function g_simple_async_result_set_check_cancellable() to provide
a GCancellable that is checked for being cancelled during the call to
g_simple_async_result_propagate_error().

This gives asynchronous operation implementations an easy way to
provide reliable cancellation of those operations -- even in the case
that a positive result has occured and is pending dispatch at the time
the operation is cancelled.

https://bugzilla.gnome.org/show_bug.cgi?id=672013
2012-03-14 08:36:11 -04:00
Ryan Lortie
81aaf53567 GSocketMsgFlags: annotate as a flags
This was being incorrectly guessed as an enum.  Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=671942
2012-03-12 16:44:00 -04:00
Ryan Lortie
3fa7358487 gio-querymodules: unlink instead of writing empty cache
If there are no modules installed then the most appropriate thing is to
have no cachefile instead of an empty one.  This unbreaks the "clean
directory after 'make uninstall'" check that automake does.

https://bugzilla.gnome.org/show_bug.cgi?id=671664
2012-03-08 12:07:03 -05:00
Cosimo Cecchi
7cf50ceb85 tests: fix GAction test for headless run 2012-03-06 22:11:22 -05:00
David Zeuthen
6e8caec6d9 GUnix{Input,Output}Stream: Only release cancelable poll-fd if we allocated it
Otherwise we get criticals a'la

 GLib-GIO-CRITICAL **: g_cancellable_release_fd: assertion `cancellable->priv->fd_refcount > 0' failed

when reading/writing to certain kinds of file descriptors.

Patch reviewed by Dan Winship on IRC.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-03-05 13:00:28 -05:00
Matthias Clasen
e9c399a65b Fix distcheck 2012-03-05 06:18:24 -05:00
Michael Biebl
cc2104e87a build: Fix failure on "make distclean"
https://bugzilla.gnome.org/show_bug.cgi?id=671270
2012-03-03 21:39:35 +01:00
Ryan Lortie
a5caa564b7 GApplication: fix name unregister logic
We were attempting to unregister our ownership of our D-Bus name even in
the case that we were non-unique (ie: we didn't actually own the name).
Rework the logic a bit to prevent that: for non-unique, we leave
impl->bus_name as NULL and we only register/unregister if it is
non-NULL.
2012-03-03 11:48:12 -05:00
David Zeuthen
10fbfcf090 Add G_VOLUME_IDENTIFIER_KIND_CLASS identifier
If an application (such as Nautilus) wants to show a sidebar with
devices group into different groups such as "Devices" and "Network",
it's currently up to the application itself to do the classification
(for example by looking at the URI scheme for the activation root,
e.g. smb://).

This patch adds a new identifier G_VOLUME_IDENTIFIER_KIND_CLASS that
can be set by volume monitors and used by applications.

See https://bugzilla.gnome.org/show_bug.cgi?id=668295

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-03-01 14:06:43 -05:00
Andoni Morales Alastruey
c5b6f774c4 gsocket: fix compilation when ENOTSOCK and WSANOTSOCK are both defined 2012-02-29 11:29:23 +01:00
David Zeuthen
7a4a973cfd GDBusConnection: Don't leak message reply in error path
This was reported in bug 670909.

https://bugzilla.gnome.org/show_bug.cgi?id=670909

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-02-27 14:53:13 -05:00
Ryan Lortie
eeccd3866a GDBusMenuModel: plug a leak of a GHashTable 2012-02-27 14:01:10 -05:00
David King
3e7f42654f docs: Clarify how to unset a GFileInfo attribute
https://bugzilla.gnome.org/show_bug.cgi?id=592666
2012-02-26 22:22:05 -05:00
Thomas Hindoe Paaboel Andersen
4ce98d3b59 docs: g_file_new_tmp: template was renamed to tmpl 2012-02-26 07:35:12 -05:00
Jonh Wendell
abac7df573 Make some strings translatable 2012-02-25 18:58:09 -02:00
Jonh Wendell
feaf828a92 Fixed a typo 2012-02-25 10:18:40 -02:00
Daiki Ueno
21457abdcc Hide global variable for signal ID in gdbusproxy.c.
Also a similar fix for gdbusserver.c.

https://bugzilla.gnome.org/show_bug.cgi?id=670721
2012-02-23 22:19:00 -05:00
Ryan Lortie
ed51975899 GApplication: add g_application_quit()
A long requested feature; this quits the application immediately,
ignoring the hold count.

https://bugzilla.gnome.org/show_bug.cgi?id=670485
2012-02-21 01:20:39 +01:00
David King
c5f8f6f8f4 docs: Fix GTlsBackend typo GTyep → GType 2012-02-21 01:10:54 +01:00
David King
a290fff9a2 docs: Fix GTlsDatabase typos 2012-02-21 01:10:54 +01:00
David King
c490a75a18 docs: Fix GApplicationCommandLine typo 2012-02-21 01:10:54 +01:00
David King
69ecc4b496 docs: Fix define typos in GApplication 2012-02-21 01:10:54 +01:00
David King
fba11825a3 docs: Fix typo in GActionGroup 2012-02-21 01:10:54 +01:00
David King
6129a1c2d5 docs: Fix GActionGroup exporter typo 2012-02-21 01:10:54 +01:00
David King
87c76bdbb6 docs: Remove some old GMenu documentation 2012-02-21 01:10:54 +01:00
David King
83392caa72 docs: Fix typo GAsyncReady → GAsyncResult
Also GSimpleAsyncReady → GSimpleAsyncResult.
2012-02-21 01:10:54 +01:00
David King
37fd4d86ab docs: Remove mention of GFileAttributeValue
Instead mention GFileAttributeInfo.
2012-02-21 01:10:54 +01:00
David King
8ee2cadd7f docs: Fix some GDBusConnection typos 2012-02-21 01:10:54 +01:00
David King
11154ff5c1 docs: Fix typo GConvertFlags → GConverterFlags 2012-02-21 01:10:54 +01:00
David King
59e1c77b8d docs: Fix typo export → unexport 2012-02-21 01:10:54 +01:00
David King
13bc546657 docs: Fix GDBusProxy typo name → g-name 2012-02-21 01:10:54 +01:00
David King
ae3ae3699b docs: Fix typo in GFileInputStream
g_seekable_stream_can_seek() → g_seekable_can_seek().
2012-02-21 01:10:54 +01:00
David King
e70b72f5a1 docs: Fix method names in GMenu and GMenuModel 2012-02-21 01:10:54 +01:00
David King
43a3a5edfc docs: Fix GNetworkAddress typo
g_network_address_parse_host() → g_network_address_parse().
2012-02-21 01:10:54 +01:00
David King
4653c6074f docs: Add documentation for supports_hostname in GProxy
Also fix a typo has → as.
2012-02-21 01:10:54 +01:00
David King
5d64eb4cb8 docs: Correct GSocketClient::event link 2012-02-21 01:10:54 +01:00
David King
2616b6eb8e docs: Fix some typos in GVolume 2012-02-21 01:10:54 +01:00
David King
07dc3db69a docs: Fix GFileAttribute link in GFileInfo 2012-02-21 01:10:54 +01:00
David King
8c8657ac34 docs: Correct GUnixMount → GUnixMountEntry 2012-02-21 01:10:54 +01:00
Ryan Lortie
31936039b0 GApplication: disable a broken test
This test made some invalid assumptions that are no longer true.
Disable it until we can figure out a better way.
2012-02-21 01:10:53 +01:00
Dan Winship
726257ab97 gsocket: add g_socket_condition_timed_wait()
https://bugzilla.gnome.org/show_bug.cgi?id=667755
2012-02-20 18:29:51 -05:00
David King
17e7c85d8f docs: Fix g_drive_get_identifier() typo 2012-02-18 11:20:27 +00:00
David King
b50863aafa docs: Add GIOModuleScope and GIOModuleScopeFlags
Fix some typos and add GIOModuleScope and GIOModuleScopeFlags to
gio-sections.txt.
2012-02-18 11:11:52 +00:00
David King
4e6c2b88b9 docs: Typo fix GInitiable → GInitable 2012-02-18 09:25:36 +00:00
David King
c29d7d7f53 docs: Typo fixes for GMount 2012-02-18 09:22:31 +00:00
David King
29f3e40e4e docs: Fix a typo in the GSeekable documentation 2012-02-17 16:12:27 +00:00
Ravi Sankar Guntur
275731e200 gio: fix memory leak in g_buffered_output_stream_write_async()
https://bugzilla.gnome.org/show_bug.cgi?id=670085

Signed-off-by: Ravi Sankar Guntur <ravi.g@samsung.com>
2012-02-16 10:19:23 -05:00
Dan Winship
ca05902a58 Add G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS
Add new macros to disable -Wdeprecated-declarations around a piece of
code, using the C99 (and GNU89) _Pragma() operator. Replace the
existing use of #pragma for this in gio, and suppress the warnings in
gvaluearray.c as well.

https://bugzilla.gnome.org/show_bug.cgi?id=669671
2012-02-15 09:54:38 -05:00
Murray Cumming
d4992b3d10 g_application_activate(): Fix typo in docs. 2012-02-15 11:53:03 +01:00
Giovanni Campagna
5b8a6900d3 GDataInputStream: don't segfault on async line reads
If an async line read fails, it returns NULL. In that case, we
must return NULL before validating the line, or we segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=658484
2012-02-14 19:04:07 +01:00
Javier Jardón
7e657d1e5c docs: Fix some typos in gwin32inputstream 2012-02-10 20:09:20 +00:00
Marc-André Lureau
704a2ca02d socket/win32: flush pending read before signaling HUP
Unix and Windows gio GSocket behaves differently when the socket is
closed by the peer. On Unix, the client receives pending data before
receiving HUP. But on Windows, the HUP may come before, resulting in
unreliable and racy code. We should have same behaviour on all
platforms.

According to MSDN documentation: "an application should check for
remaining data upon receipt of FD_CLOSE to avoid any possibility of
losing data."

https://bugzilla.gnome.org/show_bug.cgi?id=669810
2012-02-10 19:07:29 +01:00
Marc-André Lureau
6ca817c3f2 gio/tests: add /socket/close_graceful test
Add a test to check that remaining data is read before the close
event is received.

https://bugzilla.gnome.org/show_bug.cgi?id=669810
2012-02-10 19:07:29 +01:00
Chun-wei Fan
b17b135d9f Dist gio/gconstructor_as_data.h
This will avoid a dependency on a PERL installation for Visual Studio
builds.

Checked with mclasen in
https://bugzilla.gnome.org/show_bug.cgi?id=669538#c2
2012-02-10 08:57:21 +08:00
Chun-wei Fan
d4e3ae990c Bug 669538-glib-compile-resources.c: Include io.h on Windows
This is needed for close() on Windows (Visual C++ specifically) so that
no C4013 (aka Implicit declaration of ...) errors/warnings will be emitted.
2012-02-10 08:53:52 +08:00
Richard Hughes
52d0460096 Allow multiple --sourcedir options to glib-compile-resources 2012-02-09 17:24:43 +00:00
Ryan Lortie
40e9192d72 GApplication: put non-unique apps on D-Bus
For a number of reasons it might be useful to register the object paths
associated with a non-unique application so that the application can at
least field requests to its unique D-Bus name.

https://bugzilla.gnome.org/show_bug.cgi?id=647986
2012-02-09 12:15:49 -05:00
Dan Winship
ca5ed93fde glocalfile: fix error code when opening a directory on win32
g_file_read() was returning G_IO_ERROR_IS_DIRECTORY when you tried to
open a directory on unix, but G_IO_ERROR_PERMISSION_DENIED on win32.
Fix that, and add a test to tests/file.c

Pointed out on IRC by Paweł Forysiuk.

https://bugzilla.gnome.org/show_bug.cgi?id=669330
2012-02-09 06:48:12 -05:00
David Zeuthen
a067df5d72 GDBusProxy: Add G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES flag
This is useful when using certain D-Bus services where the
PropertiesChanged signal does not include the property value such as
e.g. various systemd mechanisms, see e.g.

 https://bugs.freedesktop.org/show_bug.cgi?id=37632

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-02-08 12:49:22 -05:00
Jesse van den Kieboom
1370804f2b Retrieve cwd and environ in local GApplicationCommandLine
https://bugzilla.gnome.org/show_bug.cgi?id=669689
2012-02-08 17:43:53 +01:00
Dan Winship
46affb0cd8 gio: update .gitignore 2012-02-08 08:51:34 -05:00
Christian Persch
30e0a1beac resources: Consolidate creation of GResource into one place 2012-02-05 19:57:10 +01:00
Christian Persch
04df4d45a4 resources: tests: Plug a mem leak
==1265== 84 (8 direct, 76 indirect) bytes in 1 blocks are definitely lost in loss record 793 of 827
==1265==    at 0x4029467: calloc (vg_replace_malloc.c:467)
==1265==    by 0x408479B: standard_calloc (gmem.c:104)
==1265==    by 0x4084846: g_malloc0 (gmem.c:189)
==1265==    by 0x4084B2D: g_malloc0_n (gmem.c:385)
==1265==    by 0x4228A98: g_resource_load (gresource.c:253)
==1265==    by 0x804A56D: test_resource_registred (resources.c:198)
2012-02-05 19:57:10 +01:00
Christian Persch
0ebb6339d1 resources: tests: Plug a mem leak
==509== 700 (20 direct, 680 indirect) bytes in 1 blocks are definitely lost in loss record 828 of 837
==509==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==509==    by 0x4084724: standard_malloc (gmem.c:85)
==509==    by 0x40847C7: g_malloc (gmem.c:159)
==509==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==509==    by 0x405396B: g_bytes_new_with_free_func (gbytes.c:173)
==509==    by 0x405390D: g_bytes_new_take (gbytes.c:122)
==509==    by 0x804A48C: test_resource_data (resources.c:174)
2012-02-05 19:57:10 +01:00
Christian Persch
6789ab2294 resources: tests: Plug a mem leak
==29204== 11,456 (84 direct, 11,372 indirect) bytes in 1 blocks are definitely lost in loss record 859 of 861
==29204==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==29204==    by 0x4084724: standard_malloc (gmem.c:85)
==29204==    by 0x40847C7: g_malloc (gmem.c:159)
==29204==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==29204==    by 0x409B227: g_slice_alloc0 (gslice.c:1029)
==29204==    by 0x41936CF: g_type_create_instance (gtype.c:1872)
==29204==    by 0x417CCC9: g_object_constructor (gobject.c:1839)
==29204==    by 0x417C6F4: g_object_newv (gobject.c:1703)
==29204==    by 0x417CC5A: g_object_new_valist (gobject.c:1820)
==29204==    by 0x417C1DB: g_object_new (gobject.c:1535)
==29204==    by 0x41E5E29: g_converter_input_stream_new (gconverterinputstream.c:204)
==29204==    by 0x4228D38: g_resource_open_stream (gresource.c:363)
2012-02-05 19:57:10 +01:00
Christian Persch
877fe6fb52 resources: Init refcount to 1
This bug was exposed by fixing the following leak in the resources test:

==29204== 11,456 (84 direct, 11,372 indirect) bytes in 1 blocks are definitely lost in loss record 859 of 861
==29204==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==29204==    by 0x4084724: standard_malloc (gmem.c:85)
==29204==    by 0x40847C7: g_malloc (gmem.c:159)
==29204==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==29204==    by 0x409B227: g_slice_alloc0 (gslice.c:1029)
==29204==    by 0x41936CF: g_type_create_instance (gtype.c:1872)
==29204==    by 0x417CCC9: g_object_constructor (gobject.c:1839)
==29204==    by 0x417C6F4: g_object_newv (gobject.c:1703)
==29204==    by 0x417CC5A: g_object_new_valist (gobject.c:1820)
==29204==    by 0x417C1DB: g_object_new (gobject.c:1535)
==29204==    by 0x41E5E29: g_converter_input_stream_new (gconverterinputstream.c:204)
==29204==    by 0x4228D38: g_resource_open_stream (gresource.c:363)
2012-02-05 19:57:10 +01:00
Christian Persch
30e9cccb85 resources: Plug a mem leak
==29204== 7,192 (76 direct, 7,116 indirect) bytes in 1 blocks are definitely lost in loss record 855 of 861
==29204==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==29204==    by 0x4084724: standard_malloc (gmem.c:85)
==29204==    by 0x40847C7: g_malloc (gmem.c:159)
==29204==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==29204==    by 0x409B227: g_slice_alloc0 (gslice.c:1029)
==29204==    by 0x41936CF: g_type_create_instance (gtype.c:1872)
==29204==    by 0x417CCC9: g_object_constructor (gobject.c:1839)
==29204==    by 0x417C6F4: g_object_newv (gobject.c:1703)
==29204==    by 0x417CC5A: g_object_new_valist (gobject.c:1820)
==29204==    by 0x417C1DB: g_object_new (gobject.c:1535)
==29204==    by 0x424E815: g_zlib_decompressor_new (gzlibdecompressor.c:270)
==29204==    by 0x4228DD8: g_resource_lookup_data (gresource.c:422)
2012-02-05 19:57:10 +01:00
Christian Persch
e194a9032f resources: tests: Plug a mem leak
==28778== 700 (20 direct, 680 indirect) bytes in 1 blocks are definitely lost in loss record 842 of 863
==28778==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==28778==    by 0x4084724: standard_malloc (gmem.c:85)
==28778==    by 0x40847C7: g_malloc (gmem.c:159)
==28778==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==28778==    by 0x405396B: g_bytes_new_with_free_func (gbytes.c:173)
==28778==    by 0x405390D: g_bytes_new_take (gbytes.c:122)
==28778==    by 0x804C2B1: test_uri_query_info (resources.c:435)
2012-02-05 19:57:10 +01:00
Christian Persch
108e11875e resources: tests: Plug a mem leak
==28318== 38 (12 direct, 26 indirect) bytes in 1 blocks are definitely lost in loss record 613 of 865
==28318==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==28318==    by 0x4084724: standard_malloc (gmem.c:85)
==28318==    by 0x40847C7: g_malloc (gmem.c:159)
==28318==    by 0x4084AB4: g_malloc_n (gmem.c:361)
==28318==    by 0x4229599: g_resources_enumerate_children (gresource.c:806)
==28318==    by 0x804B39E: test_resource_registred (resources.c:283)
2012-02-05 19:57:10 +01:00
Christian Persch
74c262a8bd resources: tests: Plug a mem leak
==27820== 31 bytes in 1 blocks are definitely lost in loss record 587 of 866
==27820==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==27820==    by 0x4084724: standard_malloc (gmem.c:85)
==27820==    by 0x40847C7: g_malloc (gmem.c:159)
==27820==    by 0x4084AB4: g_malloc_n (gmem.c:361)
==27820==    by 0x409D6A1: g_strdup (gstrfuncs.c:356)
==27820==    by 0x4069FF7: g_get_current_dir (gfileutils.c:2544)
==27820==    by 0x804BCA7: test_resource_module (resources.c:370)
2012-02-05 19:57:09 +01:00
Christian Persch
ffe7a3293f resources: Plug a mem leak
==27020== 44 (24 direct, 20 indirect) bytes in 1 blocks are definitely lost in loss record 684 of 936
==27020==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==27020==    by 0x4084724: standard_malloc (gmem.c:85)
==27020==    by 0x40847C7: g_malloc (gmem.c:159)
==27020==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==27020==    by 0x40BC038: g_variant_get_child_value (gvariant-core.c:969)
==27020==    by 0x40B5277: g_variant_get_variant (gvariant.c:749)
==27020==    by 0x4273182: gvdb_table_value_from_item (gvdb-reader.c:478)
==27020==    by 0x42731E8: gvdb_table_get_value (gvdb-reader.c:509)
==27020==    by 0x4228B36: do_lookup (gresource.c:280)
==27020==    by 0x4228F56: g_resource_get_info (gresource.c:492)
2012-02-05 19:57:09 +01:00
Christian Persch
fa37057169 resources: Plug a mem leak
==26427== 24 bytes in 1 blocks are definitely lost in loss record 608 of 965
==26427==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==26427==    by 0x4084724: standard_malloc (gmem.c:85)
==26427==    by 0x40847C7: g_malloc (gmem.c:159)
==26427==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==26427==    by 0x40BC038: g_variant_get_child_value (gvariant-core.c:969)
==26427==    by 0x40BA89F: g_variant_valist_get (gvariant.c:4482)
==26427==    by 0x40BAC23: g_variant_get_va (gvariant.c:4681)
==26427==    by 0x40BAB29: g_variant_get (gvariant.c:4633)
==26427==    by 0x4228BA5: do_lookup (gresource.c:293)
==26427==    by 0x4228F51: g_resource_get_info (gresource.c:493)
2012-02-05 19:57:09 +01:00
Dan Winship
f43565c822 gio/tests/file: use g_file_new_tmp()
Rather than misusing g_file_open_tmp(), misuse g_file_new_tmp()
instead. Progress! (Also, gets rid of a compile warning about close()
on win32.)
2012-02-03 13:01:19 -05:00
Dan Winship
cc4c1e89f4 gio/tests/socket-common.c: add a missing #ifdef G_OS_UNIX 2012-02-03 12:58:53 -05:00
Dan Winship
d22c36cf00 gioenums.h: clean up a few GIOErrorEnum descriptions 2012-02-03 12:49:48 -05:00
Alexander Larsson
3b8ba958f5 Fix warning to refer to to-pixdata, not xmllint 2012-02-03 15:11:23 +01:00
Alexander Larsson
ac800fa8fe Fix GResourceFile get_parent()
This was erronously losing the last char.
2012-02-03 15:05:43 +01:00
Christian Persch
260a9cc290 resource: tests: Use g_assert_cmp[u]int
... instead of just g_assert(), so when the test does fail, one immediately
can see the actual value the variable had.
2012-02-02 23:44:44 +01:00
Christian Persch
cb1dd2143d resources: compiler: Fix entity processing of xml-stripblanks
Preserve entities instead of replacing them!

Bug #669173.
2012-02-02 23:44:40 +01:00
Christian Persch
296a2a72c6 resources: compiler: Make to-pixbuf failure fatal
Bug #669123.
2012-02-02 23:44:38 +01:00
Ryan Lortie
387ed239e2 gsettings tool: fix a memory error
8852d4e9a0 introduced a memory error by
taking the type of a GVariant, freeing the GVariant and using the type
after the free.

This delays the free until after we've used the type.

https://bugzilla.gnome.org/show_bug.cgi?id=669253
2012-02-02 10:53:50 -05:00
Kalev Lember
552b815365 gio: Convert data-to-c.c to perl
Helper scripts in C can be problematic for cross compiling: the compiler
produces executables for the target platform, which the host is usually
unable to run.

https://bugzilla.gnome.org/show_bug.cgi?id=669224
2012-02-02 16:22:42 +01:00
Benjamin Otte
053b011ccc docs: Clarify GSocketClient reuse policy 2012-02-01 16:25:23 +01:00
Kalev Lember
a60f475b36 gio/tests: Fix out-of-source build
The glib-compile-resources --generate-dependencies call was failing,
although not stopping the build.

Failed to open file 'test2.gresource.xml': No such file or directory
Failed to open file 'test3.gresource.xml': No such file or directory
Failed to open file 'test4.gresource.xml': No such file or directory
Failed to open file 'test.gresource.xml': No such file or directory
2012-02-01 15:53:55 +02:00