Commit Graph

3177 Commits

Author SHA1 Message Date
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