Commit Graph

1738 Commits

Author SHA1 Message Date
Will Thompson
ec31612ea0 _simple_async_result_is_valid: allow tag to be NULL
Because g_simple_async_report_[g]error_in_idle() don't take a source tag
parameter, code that uses them can't currently use
g_simple_async_result_is_valid() (at least, not for the error case).

Bug 602417
2010-08-13 23:15:27 -04:00
Matthias Clasen
e02571e93b Add bug references to some tests 2010-08-13 21:23:23 -04:00
Matthias Clasen
ea8a963936 Document vendor override files
Features without documentation, tsk tsk.
2010-08-13 21:23:22 -04:00
Matthias Clasen
4160c5c74a Add tests for async file replace and load 2010-08-13 19:40:48 -04:00
Matthias Clasen
c003468296 Correct a comment 2010-08-13 17:23:44 -04:00
Matthias Clasen
93bd5298c7 Add an async file create/write/read/delete test 2010-08-13 17:23:44 -04:00
Matthias Clasen
7ed4762190 Fix a typo, and some doc reformatting 2010-08-13 17:23:44 -04:00
Matthias Clasen
effdb785fd Add some long descriptions for filter streams 2010-08-13 17:23:44 -04:00
Matthias Clasen
13e55b84eb Run volumemonitor test with local vfs
This is an attempt to stop the test from hanging on some build bots
in build.gnome.org.
2010-08-13 17:23:44 -04:00
David Zeuthen
d344ff9d67 Bug 626841 – Add test-case for non-socket GIOStream
Also fix a couple of bugs so it actually works.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-13 14:01:36 -04:00
Michael Meeks
9be94e8899 Add test for EAGAIN overflow in gdbusconnection based on David's test. 2010-08-13 17:56:19 +01:00
Matthias Clasen
5d9d3f0318 Add some async file tests 2010-08-13 12:04:21 -04:00
Tor Lillqvist
398f9841ed Fix gio/win32 build after -I flag changes 2010-08-10 16:01:39 +03:00
Matthias Clasen
14e0ad7c53 Don't compile some unused functions in gio/xdgmime/ 2010-08-08 21:32:04 -04:00
Matthias Clasen
584787f580 Improve the async result test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
7c129c9011 Improve dbus address test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
51ad83f711 Make g_dbus_error_unregister_error work 2010-08-07 18:56:12 -04:00
Matthias Clasen
8e236f7ec1 Add some more test about gdbus_error apis 2010-08-07 18:55:21 -04:00
Matthias Clasen
7de6658f74 Make g_simple_async_result_is_valid work without source
The problem was pointed out by Xavier Claessens in bug 626208.
2010-08-07 17:10:17 -04:00
Matthias Clasen
402ad1958c Make the closure variants of name owning and watching actually work
The GClosure API is a bit funky (and badly documented), and requires
you to set a marshaller on the closure, and the marshaller has an
implicit 'this' argument, and the caller is reponsible for unsetting
the values after invoking the closure.

I've added some calls of the _with_closures variants to the
gdbus-names test now.
2010-08-07 17:10:17 -04:00
Ryan Lortie
b91f9274d9 Fix volumemonitor test case
Don't blindly g_object_unref() that which may be NULL.
2010-08-06 13:12:20 -04:00
Ryan Lortie
889a7f81dd gio.symbols: add g_dbus_message_[gs]et_byte_order 2010-08-06 13:11:38 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
Ryan Lortie
ba0208b3a8 Clean up improper #includes
We have a lot of broken #including going on around the tree.  This has
gone unnoticed due to our sloppy use of -I.
2010-08-06 13:05:18 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
David Zeuthen
d52e1c33f7 GDBus: Add `return' debug option
This prints all GDBusMethodInvocation API usage and is normally used
with the `incoming' option. Example:

 # G_DBUS_DEBUG=incoming,return ./polkitd --replace
 Entering main event loop
 Connected to the system bus
 Registering null backend at priority -10
 [...]
 Acquired the name org.freedesktop.PolicyKit1
 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.26
       serial 299
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD ERROR org.freedesktop.PolicyKit1.Error.Failed
       message `Cannot determine session the caller is in'
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.26
       reply-serial 299

 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2402
       serial 25
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD RETURN
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.2402
       reply-serial 25

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 16:59:26 -04:00
David Zeuthen
89a1b571ad GDBusMessage: Validate header fields when serializing/deserializing
The D-Bus spec mentions exactly what header fields are required for
various message types. Add tests for this as well.

Also disallow empty interfaces for signals since the D-Bus spec says
this is Verboten already.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 14:38:51 -04:00
David Zeuthen
6f070be65b GDBusMessage: Add a way to get/set byte order of a message
Also use this in the test cases to check that serialization to and
from both big and little endian works.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 13:34:14 -04:00
David Zeuthen
6e723e8b3e GDBusMessage: Assert various things when serializing to a blob
We use g_assert() instead of setting the GError because it is a
programming error if the GVariant contains invalid data - see commit
5e6f762d61 for where the last hole in
GVariant was closed.

So if we can trust GVariant to only contain valid data (ignoring the
case where unsafe API such as g_variant_new_from_data() is used), why
g_assert() at all with costly g_utf8_validate() checks? Because a) it
is relatively inexpensive; and b) it helps find bugs such as the one
fixed in commit 5e6f762d61.

If performance is a concern we can play games like introducing
environment variables or other machinery to avoid such "costly"
checks. I doubt it will ever be an issue.

Also replace two "Hmm" TODO item with a static assert - the code that
serializes a gdouble into the D-Bus wire format by treating it as a
guint64 is indeed correct - endianess needs to be taken into account
(see the D-Bus reference implementation for similar code). But we want
to make sure that we're indeed using an architecture/compiler where a
gdouble takes up 8 bytes - hence the assertion.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 12:24:22 -04:00
David Zeuthen
5bd34a820e GDBusMessage: Validate UTF-8 strings when serializing from blob
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 11:26:48 -04:00
Dan Winship
e62bc8e8f6 remove a junk line 2010-08-04 07:36:34 -04:00
David Zeuthen
f5cd8ddeaa GDBusConnection: Debug messages when receiving signals and method invocations
Spell out "RECEIVED SIGNAL" instead of "SIGNAL" to emphasize this is
about receiving a signal, not emitting one (which is "SIGNAL
EMISSION"). Also make the "arrows" point in the "right" direction
("<<<<" vs ">>>>") - like this:

 ========================================================================
 GDBus-debug:Signal:
  <<<< RECEIVED SIGNAL org.freedesktop.DBus.NameOwnerChanged
       on object /org/freedesktop/DBus
       sent by name org.freedesktop.DBus

and

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2176

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 15:36:16 -04:00
David Zeuthen
69341e2ba9 glib-compile-schemas: Pass a C string, not a GString wrapper
Commit 5e6f762d61 (introducing UTF-8
validity checks for GVariant instances containing strsings) actually
uncovered a bug in glib-compile-schemas - a GString was passed when a
C string was expected.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 14:32:29 -04:00
David Zeuthen
86d947f01f Fix gdbus-exit-on-close test case
Forgot to update the test case after last commit.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:47:07 -04:00
David Zeuthen
6a492a4519 GDBus: If exiting b/c remote peer disconnected and error is set, print it
This should make things easier to debug:

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:24:48 -04:00
David Zeuthen
3940cc9a11 GDBusProxy: Don't leak a GSimpleAsyncResult when doing async calls
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 11:14:21 -04:00
Matthias Clasen
b2715bbc5e Fix a possible deadlock
the FdSource was calling g_cancellable_disconnect while holding the
main context lock, which is bad news if the ::cancelled handler is
trying to get that lock to wake up the mainloop...

Bug 586432
2010-08-03 10:41:21 -04:00
Emmanuele Bassi
b3de028a43 Update the Git ignore files 2010-08-03 14:21:02 +01:00
Ryan Lortie
ca3b7b75bf GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag
When binding a boolean setting to a boolean property, invert the values.
This avoids the requirement for writing a pair of mapping functions for
this extremely common case.

Add a test.

https://bugzilla.gnome.org/show_bug.cgi?id=625833
2010-08-03 02:09:10 -04:00
Fridrich Štrba
dd2bbc9533 On windows, export also symbols defined in gio/gwin32appinfo.c 2010-08-02 10:16:29 +02:00
Carlos Garcia Campos
892012b951 GDBusConnection: fix message flags in g_dbus_connection_call_sync()
GDBusCallFlags were used instead of GDBusSendMessageFlags for
g_dbus_connection_send_message_with_reply_sync(). Fixes bug #625753.
2010-08-01 17:27:58 +02:00
Milan Crha
d01a437490 Silence valgrind
Initialize all fields of struct msghdr. Bug 625472.
2010-07-31 23:51:45 -04:00
Matthias Clasen
8246bf4bde Improve gdbus test coverage 2010-07-31 00:13:02 -04:00
Matthias Clasen
116b945c94 Fix a typo
Its credentials, not crendentials
2010-07-30 23:44:30 -04:00
Matthias Clasen
eb3e926b09 Fix an off-by-one error 2010-07-30 19:53:29 -04:00
Matthias Clasen
5033be80d1 Add a test for g_dbus_proxy_get_cached_property_names 2010-07-30 19:51:22 -04:00
Matthias Clasen
aa196c60df Improve coverage of buffered output stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
ffa938fc65 Improve coverage of credentials tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
670528c187 Improve coverage of converter stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
9794a648a9 Improve coverage of memory stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
620582e59c Remove redundant include 2010-07-30 19:51:20 -04:00
Matthias Clasen
17d4898d75 Improve coverage of icon tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
7710c50fb2 Improve coverage of application tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
758c3216cd Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
c6b0507167 Reenable unix-streams test 2010-07-30 19:51:20 -04:00
Matthias Clasen
04c7abba11 Work around deadlock in unix-streams test 2010-07-30 19:51:20 -04:00
Matthias Clasen
b463b2ea25 Add tests about file associations 2010-07-30 19:51:20 -04:00
Matthias Clasen
13ac9f94fd Add some more GFile tests 2010-07-30 19:51:19 -04:00
Matthias Clasen
8263d691cb Improve compressor test coverage a bit 2010-07-30 19:51:19 -04:00
Matthias Clasen
b77a19f238 Test g_settings_list_schemas 2010-07-30 19:51:19 -04:00
Matthias Clasen
caa9453b72 Fix a warning 2010-07-30 19:51:18 -04:00
Matthias Clasen
d0750c9d6e Don't leak in converter test 2010-07-30 19:51:18 -04:00
Matthias Clasen
63bdeb0dab Fix an icon test 2010-07-30 19:51:17 -04:00
Matthias Clasen
a8f83ea834 Add tests for GNetworkAddress 2010-07-30 19:51:17 -04:00
Matthias Clasen
e103b93694 Drop an unneeded if 2010-07-30 19:51:17 -04:00
Matthias Clasen
9fc3c980cc Add some volume monitor tests
Although not much of this is easily testable.
2010-07-30 19:51:17 -04:00
David Zeuthen
dbf230991b Bug 625628 – GDBusProxy: wrong property name sorting
https://bugzilla.gnome.org/show_bug.cgi?id=625628

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-30 16:34:13 -04:00
David Zeuthen
aefc6df6bb Fix gschema-compile test
This was broken by commit 1b5b87bfa0

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-30 16:30:34 -04:00
David Zeuthen
d2d97a214d Bug 625584 – Crashes application on unref with signal subscription
Don't do too much work in the finalizer - in particular, there's no
need to send RemoveMatch() messages to the bus daemon since we're
going to sever the connection and the bus will garbage collect
anyway. In this case it crashed the process.

Also add a test case that checks that the appropriate GDestroyNotify
callbacks are called when unreffing a connection with either 1)
exported objects; 2) signal subscriptions or 3) filter functions
.. yes, ideally apps would unregister such callbacks before giving up
their ref but that's not how things work :-)

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-30 16:06:18 -04:00
Ryan Lortie
1b5b87bfa0 GSettings: Mark some strings for cat translation
<vuntz> *miaou*
2010-07-30 21:13:05 +02:00
David Zeuthen
14f17c1388 GDBusConnection: Fix up debug output when completing calls
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-30 11:40:00 -04:00
David Zeuthen
173977a701 GCredentials: use effective uid/gid
Otherwise e.g. setuid root processes can't connect to the system
bus. This was discovered when porting PolicyKit's pkexec(1) command to
a PolicyKit library using GDBus.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-30 11:26:43 -04:00
Eduardo Lima Mitev
8673f0b06c GIO: Add G-I annotations for several methods
Specifically:
 - g_io_stream_get_input/output_stream()
 - g_socket_client_get_local_address()
 - g_socket_connection_get_socket()
 - g_socket_listener_add_address()
 - g_socket_listener_accept_socket()
 - g_socket_listener_accept()
 - g_io_extension_point_get_extensions()
2010-07-29 14:06:00 +02:00
Owen Taylor
015df7e369 [gschema-compile] fix segfault
If files are passed on the command line and we don't set override_files
at all, don't try to read from the array.
2010-07-28 15:15:57 -04:00
David Zeuthen
19ef26c9c5 Use correct type for GDBusServer:active property
It's a boolean, not a string.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-28 12:58:04 -04:00
David Zeuthen
133e87ca87 GDBusConnection: Pass the GObject to g_simple_async_result_new()
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-28 12:51:09 -04:00
Ryan Lortie
a6f1bb4e17 Add support for vendor override files
You can drop a key-file in the schema directory that looks like:

[org.gtk.Example]
key='value'

to override the default value of 'key' in schema 'org.gtk.Example'.
2010-07-28 13:47:34 +02:00
Murray Cumming
633d9efc62 [gio]: gioenums.h: Remove trailing comma again. 2010-07-23 13:25:18 +02:00
Ryan Lortie
d5bd531d96 Cleanup the GSettingsBackend API
This is a substantial ABI break.  Rebuild dconf.
2010-07-22 18:39:50 -04:00
Ryan Lortie
aed440815e GSettings: add g_settings_reset()
Resets a key to its default value.
2010-07-22 17:50:05 -04:00
Benjamin Otte
dd1d1b3510 tests: Use GPOINTER_TO_SIZE() instead of just casting to guint
a) gcc doesn't like this ("Cast to pointer of different size)
b) It compares only half of the pointer
2010-07-22 21:56:20 +02:00
Benjamin Otte
284ea16b9d inotify: Constify function argument
gcc complained...
2010-07-22 21:56:20 +02:00
Ryan Lortie
dc7348b305 Fix very small leak in the GSettings test 2010-07-22 11:49:30 -04:00
Ryan Lortie
23a904fc15 Bug 624991 - GSettings mapping for G_TYPE_STRV
Added default mapping for G_TYPE_STRV based on a patch from Garrett
Regier.

Add a test case.
2010-07-22 11:34:57 -04:00
David Zeuthen
9b0a08449f GDBusAuthObserver: Fix docs
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-20 16:34:28 -04:00
David Zeuthen
7eba41346e Bug 617483 – Credentials passing
- Make GCredentials instance and class structures private so it can't
   be subclassed and we don't have to worry about ABI compat
   issues. This also allows us to get rid of the GCredentialsPrivate
   struct.

 - Add a GCredentialsType enumeration that is used whenever exchanging
   pointers with the user. This allows us to support OSes with
   multiple native credential types. In particular, it allows
   supporting OSes where the native credential evolves or even changes
   over time.

 - Add g_socket_get_credentials() method.

 - Add tests for g_socket_get_credentials(). Right now this is in the
   GDBus peer-to-peer test case but we can change that later.

 - Move GTcpConnection into a separate gtk-doc page as was already
   half-done with GUnixConnection. Also finish the GUnixConnection
   move and ensure send_credentials() and receive_credentials()
   methods are in the docs. Also nuke comment about GTcpConnection
   being empty compared to its superclass.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-20 16:34:18 -04:00
David Zeuthen
b3cf5cbd0b GDBusServer: Avoid handling incoming connections after stop() has been called
Without this fix, we'd sometimes run code after stop() and finalize()
to handle incoming requests. This was observed in the gdbus-peer test
case occasionally crashing:

 $ ./gdbus-peer
 /gdbus/peer-to-peer: OK
 /gdbus/delayed-message-processing: OK
 /gdbus/nonce-tcp:
 GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GDBusServer'
 aborting...

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-20 12:14:30 -04:00
David Zeuthen
2be167f57c GDBus: Add support for D-Bus type 'h' (ie. G_VARIANT_TYPE_HANDLE)
This allows sending and receiving D-Bus messages with instances of the
'h' D-Bus type. Unlike libdbus-1's dbus_message_iter_get_basic()
method, g_variant_get_handle() does not return a duplicated unix file
descriptor (that must be closed with close(2)) - instead, it returns
an index that can be used to get/dup the file descriptor from a
GUnixFDList object that can be obtained from the GDBusMessage object.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-20 11:38:23 -04:00
Ryan Lortie
66388120d2 Move #include <sys/wait.h> down
Until after we include the glib stuff, so that we have G_OS_UNIX
defined.

For some reason <stdlib.h> pulls in <sys/wait.h> on Fedora so this
wasn't a problem, but many others have reported the issue.
2010-07-20 10:49:30 -04:00
David Zeuthen
493d8cb292 GDBus: Introduce G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL
This is preferable to the current magical solution whereby the serial
is only rewritten if non-zero. In particular, it makes it easier to
send the same message on multiple connections without having to reset
the serial number.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 17:05:28 -04:00
David Zeuthen
9d7b00638f GDBus: Forgot to add g_dbus_send_message_flags_get_type() to gio.symbols
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 16:11:20 -04:00
David Zeuthen
0b2b4deac5 GDBus: Add GDBusSendMessageFlags
This is currently unused but might be useful in the future. For
example, it might be nice with a way to bypass the current queue of
outgoing messages - having a flag enumeration allows us to add a
G_DBUS_SEND_MESSAGE_FLAGS_BYPASS_QUEUE etc. etc.

This commit breaks ABI and API. Users of the (rarely used) API to send
messages will have to port to this new API.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 16:07:57 -04:00
David Zeuthen
7190af4394 GDBus: Remove constness from introspection data structures
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 15:45:27 -04:00
David Zeuthen
4a1c5a1b98 GDBus: Add GDBusSignalFlags and use it in g_dbus_connection_signal_subscribe()
This is currently unused but will probably be useful in the
future. For example, we could have a _ARG0_IS_PATH to specify that
arg0 should be used for arg0path.

This commit breaks API and ABI. Users of
g_dbus_connection_signal_subscribe() will need to port to this new
version.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 15:05:10 -04:00
Ryan Lortie
1a06bd8d3f Update the GDBus subtree example for the new API 2010-07-19 15:03:54 -04:00
David Hoyt
c7c573afb6 Bug 624754 – gdbusaddress.c missing sys/wait.h
https://bugzilla.gnome.org/show_bug.cgi?id=624754

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-19 13:53:17 -04:00
David Zeuthen
f30aef9a10 GDBus: Add nonce-tcp: test case
Also fix a couple of TODO items in gdbusaddress.c

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-16 13:22:45 -04:00
Ryan Lortie
fe6338f446 g_warning on inconsistent subtree behaviour
If the subtree introspection function indicates that an interface exists
but then the dispatch function returns a NULL vtable for that interface,
issue a g_warning pointing programmers in the right direction.
2010-07-15 19:38:45 -04:00
Julien Cristau
732ff1b27c gio: don't assume that SOCK_CLOEXEC is supported whenever it's defined
Just because SOCK_CLOEXEC was defined at build time doesn't mean the
kernel we're running on supports it.  So if socket() fails with EINVAL,
try again without the flag.

https://bugzilla.gnome.org/show_bug.cgi?id=624463
2010-07-15 18:06:05 -04:00
Ryan Lortie
8a2d157d49 Bug 624484: GDBusSubtreeDispatchFunc clarification
Pass NULL rather than "/" for the toplevel of a subtree.

Add clarification to the docs about how trees are flat.
2010-07-15 17:32:04 -04:00
Ryan Lortie
ca14ab7ac0 Bug 624483: GDBusSubtreeEnumerateFunc clarification
Clarify a couple of things in the docs:

  1) you must return flat names (no slashes)

  2) g_strfreev() will be called on the result

  3) a benefit of using the DISPATCH_TO_UNENUMERATED flag
2010-07-15 17:32:04 -04:00
Ryan Lortie
e6b5546cf5 Bug 624473: GDBusSubtreeIntrospectFunc return type
Return a NULL terminated C array instead of a GPtrArray

Also, document that %NULL is a permitted return value and clarify its
meaning.

Finally, avoid calling the enumeration function during dispatch when the
G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag was given.
2010-07-15 17:31:59 -04:00
David Zeuthen
48b1fe948c Bug 623810 – Message serialization bug
https://bugzilla.gnome.org/show_bug.cgi?id=623810

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-15 12:20:30 -04:00
Tomeu Vizoso
58f1977151 Add annotations to g_dbus_proxy_new_sync 2010-07-15 15:33:16 +02:00
David Zeuthen
baf383d1b1 GDBusConnection: copy object and subtree virtual tables
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-14 14:46:12 -04:00
David Zeuthen
914b046226 GDBusConnection: Fix up g_dbus_connection_close()
... so it is async, cancelable and returns an error. Also provide a
synchronous version.

This is an API/ABI break but it is expected that only very few
applications use this API.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-14 12:37:32 -04:00
David Zeuthen
14e37ef796 GDBusMessage: Make endianness for D-Bus messages match host byte order
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-14 11:41:09 -04:00
David Zeuthen
497edd8b40 Bug 623815 – Don't check sender for GDBusProxy objects where name is not set
Based on a patch from Peng Huang <shawn.p.huang@gmail.com>, thanks!

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-14 11:19:24 -04:00
Colin Walters
8a2e7d371f Make default-quit not apply if register=FALSE
Callers who are using g_application_unregistered_try_new are
likely wanting to continue doing something else if _register()
fails.  Change the semantics so that passing register=FALSE
unsets default-quit as well.  This means that a later _register()
call will send Activate but continue the process.

https://bugzilla.gnome.org/show_bug.cgi?id=622005
2010-07-14 09:39:47 -04:00
Ryan Lortie
5344c22810 gio/ docs fixup 2010-07-12 18:30:14 -04:00
Ryan Lortie
83d67bf2e7 move glibconfig.h to glib/ 2010-07-12 15:33:05 -04:00
Colin Walters
d2fe46b476 Annotate all custom GIO GSource using g_source_set_name
Naming the sources allows easier debugging with e.g. SystemTap
probes.

https://bugzilla.gnome.org/show_bug.cgi?id=620536
2010-07-10 20:09:34 -04:00
Matthias Clasen
3dca4ce434 One more dubious return 2010-07-10 20:02:47 -04:00
Matthias Clasen
29babb9fc8 Minor cleanup 2010-07-10 18:04:22 -04:00
Matthias Clasen
f8e22856c6 Add a GAppInfoCreate flag for startup-notification
Using this flag, it will be possible to launch apps without a
desktop file, in the same way that gdk_spawn_... lets you do.

Requested in bug 599223.
2010-07-10 17:57:45 -04:00
Matthias Clasen
5f1490e94a Fix sparse warnings
These were listed in bug 623955
2010-07-10 17:21:32 -04:00
Matthias Clasen
41f4aba2d2 Chain up in g_settings_finalize
Requested in bug 623954
2010-07-10 17:12:31 -04:00
Matthias Clasen
551461b23a Fix some leaks in the inotify code
Also avoid creating some unused objects. Patch by Carlos Garnacho,
bug 613057
2010-07-09 08:33:27 -04:00
Matthias Clasen
c24a29e13b Adapt to recent MLS changes
g_file_query_info returns non-NULL more often now.
2010-07-09 07:24:08 -04:00
Matthias Clasen
448ac22e80 Fix an oversight in the previous commit 2010-07-08 16:24:44 -04:00
Matthias Clasen
33f7f6a748 Use glib infrastructure to parse debug flags
Proposed in bug 623319
2010-07-08 16:22:16 -04:00
Matthias Clasen
29850d03e8 Be a bit more picky when deciding if mounts are internal
Complained about in bug 623780.
2010-07-08 15:18:05 -04:00
Matthias Clasen
349aab2bd4 A little more correctness in formatting pids
Requested in bug 623772
2010-07-08 15:11:24 -04:00
Matthias Clasen
fcddf9c2a1 Escape arguments when putting together a cmdline
See bug 623770
2010-07-08 14:58:33 -04:00
Matthias Clasen
607fec50e6 xinclude the dtd
Keeping two copies in sync manually gets tiresome.
2010-07-08 14:38:55 -04:00
Matthias Clasen
c7816005f9 Update the dtd to match the implementation
See bug 623720
2010-07-08 14:29:17 -04:00
Matthias Clasen
71e7b5800a Handle MLS selinux policy better
Following the behaviour of ls here, we should return at least the
file name, if we can't get any other information about a file. To
do this, handle EACCESS on stat() calls.

Patch by Tomas Bzatek, see bug 623692
2010-07-08 14:19:08 -04:00
Matthias Clasen
5adf506d5b Use proper variables
And also make sure we don't read garbage.
2010-07-08 11:33:21 -04:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Ryan Lortie
c243905c95 .gitignore updates 2010-07-07 16:52:41 -04:00
David Zeuthen
abc65b233c GDBus: Hide instance structures for classes we don't want to be subclassed
This also allows us to nuke the priv-> pointers and save a couple of
indirections.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 16:36:51 -04:00
Ryan Lortie
d9e90c3894 GVariant: improve bytestring support
- add G_VARIANT_TYPE_BYTESTRING, _BYTESTRING_ARRAY, _STRING_ARRAY

 - remove g_variant_{new,get}_byte_array functions

 - add g_variant_{new,get,dup}_bytestring{,_array} functions

 - remove undocumented support for deserialising arrays of objectpaths
   or signature strngs using g_variant_get_strv()

 - add and document new format strings '^ay', '^&ay', '^aay' and '^a&ay'

 - update GApplication to use the new API

 - update GSettings binding code to use the new API

 - add tests
2010-07-07 16:25:48 -04:00
David Zeuthen
2d2a321a4b GDBus: Hide class structures for classes we don't want to be subclassed
E.g. move these C structures out of public header files and into their
respective C files. Also nuke padding since this is no longer needed.

This leaves only GDBusProxy as an extendable type.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 15:57:37 -04:00
David Zeuthen
62a1ccf526 Bug 618882 – No way to ensure that a message is sent
Add g_dbus_connection_flush{_finish,sync}().

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 15:03:03 -04:00
David Zeuthen
acc9bb2403 GDBus: Only rewrite serial number if g_dbus_message_get_serial() returns 0
While this a dangerous thing to allow (collissions, reply_serial not
matching up etc.), the added flexibility makes this a good trade-off -
for example, with this feature, it's now a lot easier to build message
routers.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 11:06:23 -04:00
Ryan Lortie
746721293b GSettings: warn if use the 'memory' backend
but only if it was not explicitly selected.
2010-07-07 10:56:57 -04:00
Ryan Lortie
6ae4d31e75 trivial GSettings docs fix 2010-07-07 10:46:13 -04:00
David Zeuthen
a38fed1b43 Bug 623538 – GDBusProxy::g-properties-changed emission for corner cases
Also emit GDBusProxy::g-properties-changed when dropping (when the
name owner vanishes) or populating (when loading properties) the
property cache.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 09:50:44 -04:00
David Zeuthen
ea0607438b Bug 623537 – GDBusProxy has weird checking on NameOwnerChanged
Remove misleading (and always true) check on the name that the
NameOwnerChanged signal is for.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-07 09:07:23 -04:00
Matthias Clasen
99670eaccc Fix some errors in translated strings
gettext can't handle macros, so we have to use literal format
specifiers, unfortunately.
2010-07-07 07:37:42 -04:00
Matthias Clasen
bad9a3718e Clear the buffer initially 2010-07-07 01:00:58 -04:00
Danielle Madeley
be247379f0 Include sys/wait.h for WEXITSTATUS() 2010-07-07 12:47:54 +10:00
David Zeuthen
aab6d9ed1c GDBus: Handle autolaunching on UNIX/Freedesktop OSes
Also add a 'address' G_DBUS_DEBUG option that will print out useful
debug information such as

  GDBus-debug:Address: In g_dbus_address_get_for_bus_sync() for bus type `session'
  GDBus-debug:Address: env var DBUS_SESSION_BUS_ADDRESS is not set
  GDBus-debug:Address: env var DBUS_SYSTEM_BUS_ADDRESS is not set
  GDBus-debug:Address: env var DBUS_STARTER_BUS_TYPE is not set
  GDBus-debug:Address: Running `dbus-launch --autolaunch=05e508961149264c9b750a4c494aa6f7 --binary-syntax --close-stderr' to get bus address (possibly autolaunching)
  GDBus-debug:Address: dbus-launch output:
    0000: 75 6e 69 78  3a 61 62 73  74 72 61 63  74 3d 2f 74    unix:abstract=/t
    0010: 6d 70 2f 64  62 75 73 2d  77 42 41 6f  4b 59 49 52    mp/dbus-wBAoKYIR
    0020: 7a 75 2c 67  75 69 64 3d  30 34 30 64  31 33 66 33    zu,guid=040d13f3
    0030: 30 61 30 62  35 32 63 32  30 66 36 32  63 34 31 63    0a0b52c20f62c41c
    0040: 30 30 30 30  35 30 38 64  00 d2 38 00  00 01 00 40    0000508d..8....@
    0050: 05 00 00 00  00                                       .....
  GDBus-debug:Address: dbus-launch stderr output:
  14542: Autolaunch enabled (using X11).
  14542: --exit-with-session automatically enabled
  14542: Connected to X11 display ':0.0'
  14542: === Parent dbus-launch continues
  14542: Waiting for babysitter's intermediate parent
  14542: Reading address from bus
  14542: Reading PID from daemon
  14542: Saving x11 address
  14542: Created window 88080385
  14542: session file: /root/.dbus/session-bus/05e508961149264c9b750a4c494aa6f7-0
  14542: dbus-launch exiting
  GDBus-debug:Address: Returning address `unix:abstract=/tmp/dbus-wBAoKYIRzu,guid=040d13f30a0b52c20f62c41c0000508d' for bus type `session'

and

  GDBus-debug:Address: In g_dbus_address_get_for_bus_sync() for bus type `session'
  GDBus-debug:Address: env var DBUS_SESSION_BUS_ADDRESS is not set
  GDBus-debug:Address: env var DBUS_SYSTEM_BUS_ADDRESS is not set
  GDBus-debug:Address: env var DBUS_STARTER_BUS_TYPE is not set
  GDBus-debug:Address: Running `dbus-launch --autolaunch=05e508961149264c9b750a4c494aa6f7 --binary-syntax --close-stderr' to get bus address (possibly autolaunching)
  GDBus-debug:Address: dbus-launch output:
    0000: 75 6e 69 78  3a 61 62 73  74 72 61 63  74 3d 2f 74    unix:abstract=/t
    0010: 6d 70 2f 64  62 75 73 2d  77 42 41 6f  4b 59 49 52    mp/dbus-wBAoKYIR
    0020: 7a 75 2c 67  75 69 64 3d  30 34 30 64  31 33 66 33    zu,guid=040d13f3
    0030: 30 61 30 62  35 32 63 32  30 66 36 32  63 34 31 63    0a0b52c20f62c41c
    0040: 30 30 30 30  35 30 38 64  00 d2 38 00  00 01 00 40    0000508d..8....@
    0050: 05 00 00 00  00                                       .....
  GDBus-debug:Address: dbus-launch stderr output:
  14549: Autolaunch enabled (using X11).
  14549: --exit-with-session automatically enabled
  14549: Connected to X11 display ':0.0'
  14549: dbus-daemon is already running. Returning existing parameters.
  14549: dbus-launch exiting
  GDBus-debug:Address: Returning address `unix:abstract=/tmp/dbus-wBAoKYIRzu,guid=040d13f30a0b52c20f62c41c0000508d' for bus type `session'

Note that things work exactly like libdbus, e.g. from the
dbus-launch(1) man page:

  Whenever an autolaunch occurs, the application that had to start a
  new bus will be in its own little world; it can effectively end up
  starting a whole new session if it tries to use a lot of bus
  services. This can be suboptimal or even totally broken, depending
  on the app and what it tries to do.

  [...]

  You can always avoid autolaunch by manually setting
  DBUS_SESSION_BUS_ADDRESS. Autolaunch happens because the default
  address if none is set is "autolaunch:", so if any other address is
  set there will be no autolaunch. You can however include autolaunch
  in an explicit session bus address as a fallback, for example
  DBUS_SESSION_BUS_ADDRESS="something:,autolaunch:" - in that case if
  the first address doesn't work, processes will autolaunch. (The bus
  address variable contains a comma-separated list of addresses to
  try.)

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-06 17:03:36 -04:00
David Zeuthen
ef29644063 GDBus: Properly handle empty address strings
Changes this error

 DBUS_SESSION_BUS_ADDRESS= \
 gdbus introspect --session \
                  --dest org.freedesktop.DBus \
                  --object-path /org/freedesktop/DBus
 **
 GLib-GIO:ERROR:gdbusaddress.c:913:g_dbus_address_get_stream_sync: assertion failed: (last_error != NULL)
 Aborted (core dumped)

to

 DBUS_SESSION_BUS_ADDRESS= \
 gdbus introspect --session \
                  --dest org.freedesktop.DBus \
                  --object-path /org/freedesktop/DBus
 Error connecting: The given address is empty

which is much more preferable.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-06 17:03:36 -04:00
Matthias Clasen
af299df44e Remove cases of ;; 2010-07-05 23:13:17 -04:00
Matthias Clasen
fb02422404 Test charset conversion with fallbacks 2010-07-05 23:13:17 -04:00
Matthias Clasen
05a865344b Fix the get_property implementation for GSettings::schema 2010-07-05 23:13:17 -04:00
Matthias Clasen
20dca5935c Add several more settings tests 2010-07-05 23:13:17 -04:00
Matthias Clasen
958f15013c Small documentation addition 2010-07-05 23:13:17 -04:00
Matthias Clasen
c6e8d0ada8 Fix icons test to compile 2010-07-05 23:13:17 -04:00
Matthias Clasen
81a0a26813 Test enum mapping 2010-07-05 23:13:17 -04:00
Matthias Clasen
2764b75d53 More stream tests 2010-07-05 23:13:17 -04:00
Matthias Clasen
10b2606af5 Add more checks 2010-07-05 23:13:16 -04:00
Matthias Clasen
aec652677b Add some buffered output tests 2010-07-05 23:13:16 -04:00
Matthias Clasen
4ab9b708c0 Add some more tests for the buffered read code 2010-07-05 23:13:16 -04:00
Matthias Clasen
1ba87d1a0e Trivial cleanups 2010-07-05 23:13:16 -04:00
Matthias Clasen
dea042b855 Misc test additions 2010-07-05 03:09:36 -04:00
Matthias Clasen
211210c1ce Fix a typo 2010-07-05 02:36:48 -04:00
Matthias Clasen
c53c701e53 Cleanups 2010-07-05 00:56:12 -04:00
Matthias Clasen
f90eb144d4 Add some more tests 2010-07-04 23:42:07 -04:00
Matthias Clasen
74fbd3296d Add some GAppLaunchContext tests 2010-07-04 23:41:40 -04:00
Matthias Clasen
c915c68b6b Add the new tests to the correct variable 2010-07-04 23:40:42 -04:00
Matthias Clasen
14db75381e Add some contenttype tests 2010-07-04 22:27:01 -04:00
Matthias Clasen
fb120b5d87 Add a test for skipping 2010-07-04 20:51:06 -04:00
Matthias Clasen
9788c4c7e6 Add some CharsetConverter tests 2010-07-04 20:51:06 -04:00
Matthias Clasen
401fa10445 Add some more appinfo tests 2010-07-04 20:51:06 -04:00
Matthias Clasen
9fd1339460 Move GZlibConverter tests 2010-07-03 03:31:24 -04:00
Matthias Clasen
aaba9276f7 Add tests for GIcon 2010-07-03 03:31:07 -04:00
David Zeuthen
37c4fcb36a GDBus: Rename "Introspection XML" section to "D-Bus Introspection Data"
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-02 17:09:55 -04:00
Ryan Lortie
a16128655f Bug 623407 - g_keyfile_settings_backend_new crash
The keyfile backend forms paths like this:

  prefix + group_name + '/' + keyname

If the prefix is '/apps/yelp/' and the group name is '/' then this means
that we end up with a key name of (for example):

  '/apps/yelp/' + '/' + '/' + 'font-adjustment'

= '/apps/yelp///font-adjustment'

which is obviously not a valid key name.

This patch rejects group names starting or ending with '/' or containing
'//' and also rejects keys containing '/'.  This should make it
impossible for invalid keys to be formed.
2010-07-02 11:35:43 -04:00
Ryan Lortie
a941660873 Bug 623402 - schema compiler reports wrong line
Don't reuse the GMarkupParseContext in order to avoid inaccurate line
number reports.  Fix a memory leak, too.
2010-07-02 11:14:28 -04:00
Ryan Lortie
7a44a2d223 Bug 623401 - schema compiler: process enums first
Process *.enum.xml before any *.gschema.xml files to ensure that all
enums have been defined.
2010-07-02 11:11:45 -04:00
David Zeuthen
1ca6a4687a GDBus: Hold lock when printing debug messages
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-02 09:40:59 -04:00
David Zeuthen
c29ad23928 GDBus: make G_DBUS_DEBUG=authentication work again
This was inadvertently removed in this commit

http://git.gnome.org/browse/glib/commit/?id=1d22b64843c83631bcd0e5255930f3a4e990961e

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-02 09:35:13 -04:00
Ryan Lortie
5383c7110f Bug 622124 - implement flags for GSettings
Add a <flags> tag to the schema file format and a flags='' attribute to
go along with.  Add some extra test cases for those.

Add new g_settings_{get,set}_flags() calls and support binding to
GParamSpecFlags properties.  Add test cases.
2010-07-01 19:06:02 -04:00
David Zeuthen
bd8d837f57 Bug 620913 – More control with G_DBUS_DEBUG
This commit adds the following G_DBUS_DEBUG flags

 - emission
 - incoming
 - call
 - signal
 - payload

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-01 14:37:16 -04:00
David Zeuthen
51ed44e7ad GDBus: Fix bug in child enumeration
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-07-01 13:07:58 -04:00
Ryan Lortie
93bf09a9e7 Use "unix:" instead of tcp in test for now...
Temporarily avoids the issue reported in bug #623306.
2010-07-01 12:55:04 -04:00
David Zeuthen
21d7ce97c3 GDBus: plug some memory leaks
These fixes makes udisks-daemon from udisks' gdbus-port branch, see

 http://cgit.freedesktop.org/udisks/log/?h=gdbus-port

handle 200 add/remove uevents generated by e.g.

 #!/bin/bash
 DEV=mmcblk0p1
 for n in `seq 200` ; do
     udevadm trigger --sysname-match=$DEV --action=remove
     udevadm trigger --sysname-match=$DEV --action=add
     echo foo $n
 done

without any substantial leaks.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-30 16:39:32 -04:00
Ryan Lortie
40d5da99d6 GSettings: accept <flags> as an alias for <enum>
until we have proper support for flags...
2010-06-30 13:27:38 -04:00
David Zeuthen
87fa3a6e75 GDBus: Take a reference to the GDBusInterfaceInfo object
Things will still work fine if the GDBusInterfaceInfo is allocated
statically because if so the ref_count will be -1.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-30 12:19:28 -04:00
David Zeuthen
5ac2722975 GDBus: Rename introspection_data' parameter to interface_info'
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-30 12:18:49 -04:00
David Zeuthen
038d03cd08 Bug 623142 – Ensure ::new-connection runs before processing D-Bus messages
Without this guarantee, peer-to-peer connections are not very
useful. However, with this guarantee it's possible to export objects
in a handler for the GDBusServer::new-connection signal.

There are two caveats with this patch

 - it won't work on message bus connections
 - we don't queue up messages to be written

that can be addresses later if needed.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-30 11:51:40 -04:00
Ryan Lortie
137ae2413c g_settings_list_keys() -> _list_items()
This function returns children as well.
2010-06-30 10:02:45 -04:00
Ryan Lortie
3628b0b499 GSettings: add <override>, tests, modify output
Add <override> tag, more tests, and actually output the results of these
new tags to the gschemas.compiled file.
2010-06-29 20:24:39 -04:00
Ryan Lortie
900a756e8f GSettings: new <schema> tags 'extends', 'list-of'
Add support for extends='' and list-of='' tags to the <schema> element.
The attributes are parsed and some sanity-checking is done but currently
nothing happens as a result.

Add some tests.
2010-06-29 15:58:35 -04:00
Ryan Lortie
101bfec676 glib-compile-schemas: fix small leak 2010-06-29 15:58:35 -04:00
David Zeuthen
6d4ade4cf0 Bug 623143 – Never require non-closed connections
There's a couple of places in GDBus where it's a programming error
(e.g. we'll assert or spew via e.g. g_warning()) to use the API on a
closed connection.  This approach can never work since a
GDBusConnection can be closed at any point in time outside of
programmer control.

Just change the code to return a run-time error (e.g. return
G_IO_ERROR_CLOSED when sending messages, invoking methods) or silently
accept the request (e.g.  exporting objects, registering for signals)
without doing anything.

Note that a GDBusConnection object is always useless after being
closed - e.g.  there's no way to "reopen" a connection - the user will
have to create a new object and use that instead.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-29 15:21:11 -04:00
Ryan Lortie
8a7d990698 Bug 622565 - compile-schemas fails when no schemas
Neutralise and deprecate the --uninstall option in the schema compiler
and remove it from gsettings.m4.

Make the new default behaviour a compromise between the old default
behaviour and the previous --uninstall option:

  - never return a failure code if no schema files are found

  - issue a warning instead

  - remove the gschemas.compiled file if it exists
2010-06-28 14:06:32 -04:00
Ryan Lortie
ab1111b8bb GSettings: peek instead of ref/unref enum class
We only ever do the enum mapping for the property binding in the case
that a GParamSpecEnum exists and in that case the class is already
referenced by the GParamSpec.  Use peek instead of ref/unref and add a
clarifying note.
2010-06-28 13:58:25 -04:00
Ryan Lortie
168cfc5922 Bug 622127 - GSettings extended key validation
First shot at attempting to implement this in a reasonable way.  See
the bug for more information about why this is needed.
2010-06-28 10:20:50 -04:00
Matthias Clasen
d20969e07b Filter out child schema entries when listing keys 2010-06-27 16:31:53 -04:00
Matthias Clasen
025435329a Implement bash completion for gsettings 2010-06-27 16:00:20 -04:00
Ryan Lortie
795d2bf8cf GSettings: Don't free value before using its type
Fix a bug where the type from g_variant_get_type() was used after
freeing the variant.  This works for base types (since they are cached
and live forever) but not for arrays (where the bug was first seen).
2010-06-27 10:12:59 -04:00
Ryan Lortie
7cdc592ae4 Bug 622128 - retry with default for failed mapping
Hold the GSettingsKeyInfo as part of the binding structure to save work
on each get/set.  Use our copy of this structure to call the internal
get/set APIs.  Give more descriptive error messages in the case of
invalid data on sets and retry using the translated default then schema
default value in case of failure to map on reads.
2010-06-25 10:56:41 -04:00
Ryan Lortie
de0464cf89 Tweak GSettings key/schema listing APIs 2010-06-24 12:25:48 -04:00
Ryan Lortie
e3d0d07b04 Clarify GSettings documentation wrt errors
Make it clear about exactly what "@key is valid" means.
2010-06-24 02:28:01 -04:00
Ryan Lortie
887d9d83aa g_keyfile_settings_backend_new doc improvement 2010-06-24 02:21:58 -04:00
Ryan Lortie
123699465d GSettings: add g_settings_list_keys()
Second half of bug #622554.
2010-06-24 02:17:34 -04:00
Ryan Lortie
6218d8047a Add g_settings_schema_exists
Solves half of #622554.
2010-06-24 02:17:28 -04:00
Ryan Lortie
726e4dd6e7 KeyfileSettingsBackend: fix symbol visibility leak 2010-06-24 02:17:22 -04:00
Ryan Lortie
65fc931fb9 Rework the GSettings keyfile backend 2010-06-24 01:39:12 -04:00
Ryan Lortie
6d828dae38 GSettingsBackend: some debug code 2010-06-24 00:55:30 -04:00
Ryan Lortie
519edcc2b3 fix leaks in the GSettings test case 2010-06-24 00:39:38 -04:00
Ryan Lortie
f76c4d0629 GSettings "delayed": don't leak unapplied keys
GDelayedSettingsBackend was leaking the GTree holding the list of
unapplied keys on finalize.
2010-06-24 00:39:38 -04:00
Ryan Lortie
d3af9c0ec5 neutralise pltcheck.sh 2010-06-23 10:12:14 -04:00
Matthias Clasen
13ac216ca3 GIO doc cleanups 2010-06-23 09:25:30 -04:00
David Zeuthen
6920e503e6 GDBusProxy: Don't warn when calling methods on other interfaces
If we know the expected interface (e.g. :g-interface-info is set),
then we always warned when calling a method on a different
interface. Don't do that, there's no way the expected interface can
know anything about this method.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-22 17:48:35 -04:00
Dan Winship
d68f8012b2 gio/tests/testapps: Fix source refcounting
Either child_watch_source or timeout_source will already have been
destroyed after we finish the loop, and it's not safe to call
g_source_destroy() on it a second time unless we're still holding a
ref on it.
2010-06-22 15:37:42 -04:00
Dan Winship
a0e1b226a2 GSocketConnection: don't close the socket if it's still reffed
When disposing a GSocketConnection, don't explicitly close the
underlying GSocket. The GSocket will close itself if it gets
destroyed, and if it doesn't get destroyed, that presumably means the
app still wants to use it. Eg, this lets you use GSocketClient to
create a GSocketConnection, and then take the GSocket and destroy the
GSocketConnection.

https://bugzilla.gnome.org/show_bug.cgi?id=616855
2010-06-22 15:25:28 -04:00
Dan Winship
e0ff84e688 GSocketInput/OutputStream: fix non-blocking on Windows
The GSocket docs point out that g_socket_send/g_socket_receive may
return G_IO_ERROR_WOULD_BLOCK even if g_socket_condition_check claimed
that they wouldn't. Fix the socket streams to check for that.

https://bugzilla.gnome.org/show_bug.cgi?id=603309
2010-06-22 15:20:29 -04:00
David Zeuthen
2be38f6926 GDBus: update padding
Add lots of padding for public class structures. Notably, we seemed to
lack any padding whatsoever in the GDBusMessageClass struct (spotted
by Dan Winship). Also switch to using

 gpointer padding[N];

instead of

 void (*_g_reserved1) (void);
 ...
 void (*_g_reservedN) (void);

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-22 12:14:31 -04:00
Matthias Clasen
d19380c809 Improve g_application_new documentation
Patch by Saleem Abdulrasool, bug 622154.
2010-06-22 08:24:30 -04:00
Tor Lillqvist
efb1a054b0 Fix build with the Microsoft compiler
Correct a few gccisms and C99isms. Ensure the Windows-specific gio
source files are listed in the generated gio VS project file.
2010-06-22 12:22:46 +03:00
Tor Lillqvist
2e84249082 Bypass a few functions not used on Windows when compiling for Windows 2010-06-22 12:16:14 +03:00
David Zeuthen
45411ccbe3 Bug 621945 – Filter outgoing messages in GDBusConnection
This patch breaks some rarely-used public API (only known user is
dconf).

This patch is based on work from Peng Huang <shawn.p.huang@gmail.com>.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-21 16:12:23 -04:00
Ryan Lortie
c9553af68f Use -Bsymbolic-functions, drop g*alias PLT hackery
This is a minimal patch-out of the galias functionality.  We will do a
release like this so that we can easily back it out if there are
reported problems.

A more substantial cleanup (mostly removing #includes from every file)
will follow if there are no issues.
2010-06-21 13:55:28 -04:00
Ryan Lortie
e549bbf664 distcheck fix 2010-06-21 13:25:51 -04:00
Ryan Lortie
7556f660b5 Remove gsettings-schema-convert tool
Having this tool in GLib is a bad idea for a number of reasons:

  - experience has shown that the simple file format was a bad idea

  - the tool is currently implemented with a hack that would require a
    dependency inversion to solve (the tool needs to depend on Python
    GVariant bindings)

  - the tool itself is unmaintained

It will be moved to the GConf git repository so people can continue to
use it for the purpose of converting GConf schemas.
2010-06-21 13:24:40 -04:00
Christian Persch
fc5f3a96be Docs fix 2010-06-20 13:35:41 +02:00
Ryan Lortie
ea6470e31a GSettings: complete support for enum binding 2010-06-19 16:14:23 -04:00
Milan Bouchet-Valat
a558e460a2 Fix gsettings tool crash, part 2
Same as previous commit, but for two other functions it missed.
2010-06-19 19:00:13 +02:00
Milan Bouchet-Valat
62939f5e45 Fix gsettings tool crash
When no path is provided for the schema, we have call
g_settings_new() instead of g_settings_new_with_path()
passing a NULL path.

This was crashing the tool on start since an assertion was
recently added to g_settings_new_with_path() to refuse NULL.
2010-06-19 18:33:26 +02:00
Ryan Lortie
a768953760 Fix bug in strinfo
We can't search for a larger needle inside of a smaller haystack, and
unsigned integer subtraction tends to result in very large numbers
rather than small ones.

Add a check for this case and abort out immediately.

Also add a test case (lifted directly from the docs) that demonstrates
the problem.

Issue discovered and tracked down by Milan Bouchet-Valat
2010-06-19 11:41:30 -04:00
Jürg Billeter
1ed105b19b GDBus: Sink closures in _with_closures functions
See https://bugzilla.gnome.org/show_bug.cgi?id=621092#c12

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-18 19:28:31 -04:00
Colin Walters
8f5bde679e [GApplication] Add working directory to platform data
https://bugzilla.gnome.org/show_bug.cgi?id=621838
2010-06-18 16:05:00 -04:00
Tor Lillqvist
6ff13071ae Fix build on non-Unix 2010-06-18 10:57:00 +03:00
Matthias Clasen
9b59059d9e Fix distcheck 2010-06-17 19:08:52 -04:00
David Zeuthen
79d32c2fc1 GDBusMessage: Fix bug when deserializing a message
See https://bugzilla.gnome.org/show_bug.cgi?id=621838 for the whole
story. The problem was that we ended up reading data from arrays of
arrays when we were just supposed to be aligning the buffers.

Also add a host of debug infrastructure that was needed to find the
root cause. For now it can be turned on only via defining
DEBUG_SERIALIZER. In the future we might want to make it work via
G_DBUS_DEBUG. In a nutshell, the added debug info looks like this

Parsing blob (blob_len = 0x0084 bytes)
  0000: 6c 01 00 01  3c 00 00 00  41 00 00 00  37 00 00 00    l...<...A...7...
  0010: 08 01 67 00  08 61 61 79  61 7b 73 76  7d 00 00 00    ..g..aaya{sv}...
  0020: 01 01 6f 00  08 00 00 00  2f 66 6f 6f  2f 62 61 72    ..o...../foo/bar
  0030: 00 00 00 00  00 00 00 00  03 01 73 00  06 00 00 00    ..........s.....
  0040: 4d 65 6d 62  65 72 00 00  00 00 00 00  34 00 00 00    Member......4...
  0050: 03 00 00 00  63 77 64 00  01 73 00 00  23 00 00 00    ....cwd..s..#...
  0060: 2f 68 6f 6d  65 2f 64 61  76 69 64 7a  2f 48 61 63    /home/davidz/Hac
  0070: 6b 69 6e 67  2f 67 6c 69  62 2f 67 69  6f 2f 74 65    king/glib/gio/te
  0080: 73 74 73 00                                           sts.

Parsing headers (blob_len = 0x0084 bytes)
  Reading type a{yv} from offset 0x000c: array spans 0x0037 bytes
    Reading type {yv} from offset 0x0010
      Reading type y from offset 0x0010: 0x08 '
      Reading type v from offset 0x0011
        Reading type g from offset 0x0014: 'aaya{sv}'
    Reading type {yv} from offset 0x001e
      Reading type y from offset 0x0020: 0x01 ''
      Reading type v from offset 0x0021
        Reading type o from offset 0x0024: '/foo/bar'
    Reading type {yv} from offset 0x0031
      Reading type y from offset 0x0038: 0x03 ''
      Reading type v from offset 0x0039
        Reading type s from offset 0x003c: 'Member'
Parsing body (blob_len = 0x0084 bytes)
  Reading type (aaya{sv}) from offset 0x0047
    Reading type aay from offset 0x0048: array spans 0x0000 bytes
    Reading type a{sv} from offset 0x004c: array spans 0x0034 bytes
      Reading type {sv} from offset 0x0050
        Reading type s from offset 0x0050: 'cwd'
        Reading type v from offset 0x0058
          Reading type s from offset 0x005b: '/home/davidz/Hacking/glib/gio/tests'
OK

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-17 18:01:32 -04:00
Ryan Lortie
0766981a1e Make g_settings_sync() a proper prototype. 2010-06-17 16:56:53 -04:00
Matthias Clasen
408daaa294 Fix the build 2010-06-17 16:36:58 -04:00
David Zeuthen
0c506f200a GDBus: Complain via g_warning() if an invalid message is received
While we are already propagating the error to the user via the
GDBusConnection::disconnected signal (because the only safe thing is
to disconnect the other peer), changes are the user is simply not
listening to this signal.

This should never ever happen unless there's a bug in the
serializaer/deserializer so it's fine to complain via g_warning()
here.

Bug 621838, see

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

is related to this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-17 16:12:46 -04:00
David Zeuthen
57dff1e060 GDBusMessage: Properly check error and bail if set
Otherwise we may set a GError on top of it.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-17 16:12:46 -04:00
Matthias Clasen
8a105625b0 Documentation fixups 2010-06-17 16:07:52 -04:00
Christian Persch
10e430bcc0 Fix GApplication for the G_TYPE_VARIANT change 2010-06-17 21:41:09 +02:00
David Zeuthen
0a7e6255b3 Catch up with G_TYPE_VARIANT changes
The GType for a GVariant is now a fundamental GType instead of a boxed
one so use the right marshaller.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-06-17 15:27:18 -04:00
Matthias Clasen
2c5e1d5193 Fix a typo 2010-06-17 15:08:37 -04:00
Ryan Lortie
0010e86572 GSettings: remove "context" from backend too.
Note: this is a GSettingsBackend API/ABI change.
2010-06-17 15:06:33 -04:00
Ryan Lortie
58e000d301 Only run the schema compiler from the test cases 2010-06-17 14:33:50 -04:00
Ryan Lortie
6c3ae976e6 Bug 621266 - GSettings "context" clarification
Remove the concept of "context" in favour of dealing with
GSettingsBackend directly.
2010-06-17 14:05:40 -04:00
Cosimo Cecchi
b3cc28bc34 Bug 621905 – Assume a ref when doing async work
When asynchronously acquiring the DBus connection, assume a reference to
the proxy object, to avoid destroying it in the middle of the operation.

See https://bugzilla.gnome.org/show_bug.cgi?id=621905
2010-06-17 18:49:55 +02:00
Ryan Lortie
d352ec2bf3 GSettings-related distcheck fixups 2010-06-17 10:50:47 -04:00
Ryan Lortie
e7cd94a481 More GSettings doc fixups 2010-06-17 08:57:19 -04:00
Ryan Lortie
92375a8c8e <alias> takes mandatory target='' arg 2010-06-17 08:08:28 -04:00
Ryan Lortie
d405ad8a09 GSettings: Fix comment formatting, whitespace. 2010-06-17 08:06:52 -04:00
Matthias Clasen
61af83c5b6 Add some schema examples 2010-06-17 01:38:14 -04:00
Matthias Clasen
fbf93c371a Typo fix 2010-06-17 00:45:43 -04:00
Matthias Clasen
345a1ee31c Update the dtd to match the schema parser
The aliases element was not mentioned here.
2010-06-17 00:37:49 -04:00
Ryan Lortie
fc538894d3 GSettings: enum/choices/aliases/range test cases
Fix a small bug that one of the tests uncovered.
2010-06-17 00:03:44 -04:00
Ryan Lortie
be8f938b63 move GSettings(Backend) to giotypes.h 2010-06-16 18:49:20 -04:00