Commit Graph

1335 Commits

Author SHA1 Message Date
Ryan Lortie
71c5e3f899 Bug 620496 - schema compiler: reject invalid paths
The GSettings schema compiler was accepting any string as a path.  It is
probably quite a common mistake to suspect that '/apps/foo' is a valid
path name when this will cause all sorts of trouble later.  Check for
this case and report the error.
2010-06-07 10:18:43 +02:00
Christian Persch
87ee5f3641 Don't do an extra strlen when g_variant_get_string() returns it already 2010-06-06 16:32:04 -04:00
Matthias Clasen
2aca3b506a Add single-include guards to new headers
As pointed out by Christian Persch in bug 620173, all the new
gdbus and gsettings headers were missing these.
2010-06-06 16:20:21 -04:00
Matthias Clasen
9371ca0cc2 Sort gio.h includes alphabetically 2010-06-06 16:15:44 -04:00
Michael Natterer
3944a63fed gio: fix the build 2010-06-06 21:15:42 +02:00
Matthias Clasen
92fab48387 Some cleanups
Always include config.h, make property strings for translation,
add since tags.
2010-06-06 14:24:14 -04:00
Ryan Lortie
61f3f45cb9 add get_permission API to GSettingsBackend
implement it in the various in-tree backends

also, lots of whitespace changes to realign the vtable members
2010-06-05 00:10:05 +02:00
Ryan Lortie
95c564cabe gsettingsbackend.h: pretend to be gio.h
Since #include <gsettingsbackend.h> is a perfectly valid thing for
applications to do, and since we want to include gio headers from
gsettingsbackend.h, we need to effectively disable the #error we would
get from those headers (because we're not coming via gio.h).

We don't want to #include <gio/gio.h> here because this would cause
needless rebuilding of GSettingsBackend, GSettings,
GDelayedSettingsBackend, etc... every time someone changed anything in
any public header.
2010-06-04 23:02:44 +02:00
Ryan Lortie
4733488178 Bug 620582 - a simple GPermission implementation
add GSimplePermission, a trivial const implementation of GPermission

can-request and can-release are always false for this implementation and
the value of 'allowed' is decided at construction.
2010-06-04 22:35:14 +02:00
Ryan Lortie
7a4860d69a Bug 620519 - GPermission
Add an abstract interface representing the permission to perform an
action.
2010-06-04 19:03:38 +02:00
Murray Cumming
07b5cee2a8 Gio: gioenums.h: Remove trailing commas to avoid C++ warnings. 2010-06-04 17:07:05 +02:00
Javier Jardón
af3f4cbe77 gdbusaddress: Fix typo 2010-06-04 01:35:23 +02:00
Matthias Clasen
e608b1f067 Don't spew a g_warning if inotify setup fails
We use is_supported when we are trying to find a local file monitor
implementation that works, and having the g_warning in there trips
the test suite.
2010-06-03 11:42:59 -04:00
Milan Bouchet-Valat
3682666140 Annotate GVariant and GSettings _strv() functions
Add GObject introspection annotations so that the length parameter is
correctly detected for g_variant_new_strv(), g_variant_get_strv() and
g_variant_dup_strv(). Also specify that it can be a NULL pointer in
g_variant_get_strv() and g_variant_dup_strv().

For g_settings_set_strv(), detect that a NULL value is allowed, meaning
empty array.

Closes bug #620384.

Signed-off-by: Ryan Lortie <desrt@desrt.ca>
2010-06-02 19:37:30 +02:00
Ryan Lortie
b5c8496b4c Support NULL value for g_settings_set_strv()
Allow easy setting of the empty array that we lost with the last patch.
2010-06-02 04:00:58 +02:00
Milan Bouchet-Valat
bf9edb5cd5 Remove length parameter for g_settings_[gs]et_strv
Length of the array is redundant since it's NULL-terminated. This is not
consistent with many GLib and GTK+ functions, and adds complexity with
no real gain, while these convenience functions should be kept simple.

Closes bug #620312
2010-06-02 03:54:23 +02:00
Lin Ma
c874a76a8b After talk with FEN dev, we dicide simply disable monitor function if
the current filesystem doesn't suport FEN.
2010-05-28 16:58:56 +08:00
Lin Ma
866e3dda60 Remove unused code. 2010-05-27 10:24:58 +08:00
Lin Ma
798eed43a2 bugster#6955199, on hsfs portfs will fail, and FEN backend will fail
to run lstat and port_associate on root node.
2010-05-26 14:32:37 +08:00
David Zeuthen
eec66b2f94 GDBus: Big-endian fixes
Tested this on my Powerbook G4 12", 867MHz PowerPC G4 running Fedora
11ish.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-25 12:03:27 -04:00
Matthias Clasen
9e25ec592b Document that vtable is not copied 2010-05-25 10:44:19 -04:00
Ryan Lortie
84a0605342 change GSettingsBackend.list() API 2010-05-24 22:20:47 -04:00
Matthias Clasen
1b7f645492 Improve the g_file_make_symbolic_link docs
Following a proposal by Neil Williams in bug 619527.
2010-05-24 21:09:55 -04:00
Ryan Lortie
77b9a46461 GIO: Add g_d{,c}gettext to PLT check exceptions 2010-05-24 17:03:26 -04:00
Ryan Lortie
3160bcad6a GDBusConnection.call(): add 'reply_type' argument
This allows the caller to specify the reply type that they are expecting
for this call.  If the reply comes back with the wrong type, GDBus will
generate an appropriate error internally.

  - add a GVariantType * argument to g_dbus_connection_call() and
    _call_sync().

  - move the internal API for computing message types from introspection
    data to be based on GVariantType instead of strings.  Update users
    of this code.

  - have GDBusProxy pass this calculated GVariantType into
    g_dbus_connection_call().  Remove the checks done in GDBusProxy.

  - Update other users of the code (test cases, gdbus-tool, GSettings
    tool, etc).  In some cases, remove redundant checks; in some other
    cases, we are fixing bugs because no checking was done where it
    should have been.

Closes bug #619391.
2010-05-24 17:00:04 -04:00
Tor Lillqvist
a83a9a43ed Most of the gdbus test programs build only on Unix 2010-05-24 11:22:41 +03:00
David Zeuthen
bf24dff88e Return an error for calls into unknown interfaces or unknown objects
Ryan pointed out on IRC that we didn't do anything here. Looking at
the code, it's painfully obvious that we should be returning an error
here since a comment already says that we've exhausted all possible
options.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-21 12:11:04 -04:00
Christian Persch
c7f0f2c437 Use stack-allocated GVariantBuilders
This saves a few allocations.
Also simplify the code a bit in gdbusconnection.

Bug #618616.
2010-05-20 21:17:14 +02:00
Christian Persch
41b3f6885d Add g_dc[p]gettext, and use it in gsettings
Avoid using LC_MESSAGES, and just call g_d[c]gettext directly.

Bug #617004.
2010-05-20 21:16:29 +02:00
David Zeuthen
366b3ffcde Bug 619142 – Build fixes
- Fix various #include issues

 - Change #error to #warning for the EXTERNAL authentication mechanism.
   It is not clear if this should work on Win32 at all.

 - Call close() before unlink() for the SHA1 keyring

 - Change #error to #warning so we don't forget to do
   permission checking of the .dbus-keyrings directory

 - Use Win32 SID for the SHA1 auth mech

 - Apparently we can't use word 'interface' as an identifier

 - Implement a _g_dbus_win32_get_user_sid() function. For now it's
   private. Don't know if it should be public somewhere. Maybe in
   a future GCredentials support for Win32? I don't know.

 - GFileDescriptorBased is not available on Win32. So avoid using
   it in GLocalFile stuff. Now, Win32 still uses GLocalFile + friends
   (which works with file descriptors) so expose a private function
   to get the fd for an OutputStream so things still work.

 - Fixup gio.symbols

 - Fixup tests/gdbus-peer.c so it builds

With this, at least things compile and the gdbus-peer.exe test case
passes. Which is a great start. I've tested this by cross-compiling on
a x86_64 Fedora 13 host using mingw32 and running the code on a 32-bit
Windows 7 box.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-20 10:53:08 -04:00
Ryan Lortie
caae8ac57a Add --uninstall option to glib-compile-schemas
If --uninstall is given then don't give an error if the schema directory
is empty.  Instead, erase the gschemas.compiled file, if it exists.
This is the right thing to do in the 'make uninstall' rule, where the
schema directory could very well be left empty as a result.

Modify gsettings.m4 to use this option.
2010-05-19 16:02:05 -04:00
Javier Jardón
257c519ba2 Fix trivial typo in GCredentials code
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=618839
2010-05-18 23:45:54 +02:00
Ryan Lortie
719e2dcb3b Bug 619031 - method-calls-in-thread test failing
The test was assuming that g_timeout_add() waited for at least the amount of
time given to it before running the function.  This is not the case -- the
function can be run as much as 1ms early.  Make the lower time bound asserted
in the test more permissive to account for this.
2010-05-18 17:25:43 -04:00
Ryan Lortie
6067f9f794 Bug 618839 - Typo at translation message
Fix trivial typo in GCredentials code
2010-05-18 16:43:36 -04:00
Ryan Lortie
12a8c0f50d Add sync method to GSettingsBackend, and pad 2010-05-18 16:14:50 -04:00
Ryan Lortie
7fcf353325 whitespace fix 2010-05-18 16:14:50 -04:00
Robert Ancell
587bdf3f0a Add missing gunixfdlist.h include in gdbus-example-server.c 2010-05-18 12:01:25 +10:00
David Zeuthen
a977f03235 GDBus: Fix obvious crasher when looking up annotations
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 19:52:09 -04:00
David Zeuthen
a621e0ed10 gdbus(1): Don't fetch props if introspection data indicates none are available
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 11:08:53 -04:00
David Zeuthen
98e4f7f6fb GDBus: Fix introspection of objects registered at /
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 11:08:40 -04:00
Ryan Lortie
799e0242ae improve thread safety in GDelayedSettingsBackend
- hold a lock while accessing the tree of delayed values
  - use weak reference counts with the owner object to avoid doing
    g_object_notify on a dead object
  - dispatch the "has-unapplied" notify to the proper main context
2010-05-17 07:16:37 -04:00
Ryan Lortie
61219e2640 GSettingsBackend: make signal dispatch threadsafe
This commit fixes up a few race conditions in the GSettingsBackend, mostly with
respect to change notifications occuring at the same time as the last reference
count on a GSettings is dropped.  With GDBus feeding us our incoming signals in
a separate thread, this is something that could easily happen.
2010-05-17 07:16:37 -04:00
Ryan Lortie
4967b6d2ab gitignore additions for gdbus, new test cases 2010-05-17 07:16:37 -04:00
Ryan Lortie
984258c662 GSettings: support emitting signals in threads
The thread-default context that was in effect at the time that the
GSettings was created will be used for emitting signals on that
GSettings.
2010-05-17 07:16:37 -04:00
Ryan Lortie
849684e540 GSettings tool: work-around GDBus issue
There is currently no way (near as I can tell) to ensure that a message
has been sent when using GDBus.  If we exit() before we are sure, then
it is very possible that the message isn't sent at all.  This behaviour
was observed when using the GSettings commandline tool with dconf.

A quick and dirty workaround for now.
2010-05-17 07:16:37 -04:00
Ryan Lortie
8e060adb2c intern a key name instead of using strdup() 2010-05-17 07:16:37 -04:00
Lin Ma
e5440f865d Reworked Solaris file event notification for GIO. See
https://defect.opensolaris.org/bz/show_bug.cgi?id=10194

Updated copyright.
2010-05-17 14:42:52 +08:00
Sebastian Dröge
5d379f1c37 Fix gio tests linking with binutils gold linker 2010-05-16 10:22:10 +02:00
Sebastian Dröge
e6c08a458c Fix build of gdbus tool with binutils gold linker 2010-05-16 10:22:10 +02:00
Matthias Clasen
2ad4b2d716 Fix build on !linux
Don't define __USE_GNU, thats a glibc-internal macro, and
don't use SOL_SOCKET when not including sys/socket.h.
Maybe this file should be called glinuxcredentialsmessage.c...

Bug #618730
2010-05-15 18:16:51 -04:00
Matthias Clasen
2ed13de153 Fix issues with GSETTINGS_CHECK_RULE
Rename the --schema-files option to --schema-file, since it only
accepts one file at a time. Change the GSETTINGS_CHECK_RULE to
use it that way, too. And also make it work better with !srcdir
builds.

Bugs #616731 and #616864
2010-05-14 21:58:08 -04:00
David Zeuthen
763c1dab1f GDBus: Use specific variant type in GetAll()
Without this fix, we segfault if the exported object returned an error
on all get_property() calls (in reality, this never happens).

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 21:08:01 -04:00
David Zeuthen
4baf104f0a GDBus: Fix a double free
Fix an unintentional double free introduced in commit
4ad4c306c3.

This bug manifested itself when trying to complete this

 $ gdbus introspect --system --dest <tab>
2010-05-14 20:52:15 -04:00
Christian Persch
661e5ea69f Plug mem leaks in gdbus tests & examples
Use "&s" instead of "s", and free the variant iters after use.

Bug #618663.
2010-05-15 00:12:18 +02:00
Christian Persch
60c53fef47 Plug a mem leak in gdbusauth
From valgrind running gdbus-peer test:

==20513== 32 bytes in 1 blocks are definitely lost in loss record 1 of 15
==20513==    at 0x4024E4C: realloc (vg_replace_malloc.c:429)
==20513==    by 0x4079BB1: g_realloc (gmem.c:174)
==20513==    by 0x4099472: g_string_maybe_expand (gstring.c:396)
==20513==    by 0x409A42A: g_string_insert_c (gstring.c:1050)
==20513==    by 0x42169AC: g_string_append_c_inline (gstring.h:153)
==20513==    by 0x421682C: _my_g_input_stream_read_line_safe (gdbusauth.c:336)
==20513==    by 0x421843E: _g_dbus_auth_run_server (gdbusauth.c:1265)
==20513==    by 0x4222B94: initable_init (gdbusconnection.c:1783)
==20513==    by 0x41CF8D5: g_initable_init (ginitable.c:106)
==20513==    by 0x41CFA8D: g_initable_new_valist (ginitable.c:219)
==20513==    by 0x41CF920: g_initable_new (ginitable.c:139)
==20513==    by 0x4223479: g_dbus_connection_new_sync (gdbusconnection.c:2046)

Bug #618650.
2010-05-15 00:12:18 +02:00
Christian Persch
5bc9d43288 Plug mem leak in g_dbus_address_get_stream_sync
==6279== 21,615 (4,708 direct, 16,907 indirect) bytes in 169 blocks are
definitely lost in loss record 12 of 13
==6279==    at 0x4024D2E: malloc (vg_replace_malloc.c:207)
==6279==    by 0x4079A90: g_malloc (gmem.c:135)
==6279==    by 0x4079DC8: g_malloc_n (gmem.c:252)
==6279==    by 0x4097E66: g_strsplit (gstrfuncs.c:2434)
==6279==    by 0x42169A2: g_dbus_address_get_stream_sync
(gdbusaddress.c:875)

Bug #618622.
2010-05-15 00:12:17 +02:00
Christian Persch
dc39825aa3 Plug a mem leak in get_uninitialized_connection
Free the bus address after creating the singleton.

==26308== 39,736 (10,517 direct, 29,219 indirect) bytes in 388 blocks
are definitely lost in loss record 14 of 15
==26308==    at 0x4024D2E: malloc (vg_replace_malloc.c:207)
==26308==    by 0x4079A90: g_malloc (gmem.c:135)
==26308==    by 0x4079DC8: g_malloc_n (gmem.c:252)
==26308==    by 0x4095607: g_strdup (gstrfuncs.c:102)
==26308==    by 0x4216B9A: g_dbus_address_get_for_bus_sync
(gdbusaddress.c:961)
==26308==    by 0x422A7AE: get_uninitialized_connection
(gdbusconnection.c:5241)

Bug #618622.
2010-05-15 00:12:17 +02:00
Christian Persch
5b2c7f10bd Plug mem leaks in parse_value_from_blob
The result of read_string() was leaked.

Bug #618615.
2010-05-15 00:12:17 +02:00
Christian Persch
0a7c0ac74b Plug a mem leak
This code leaked the return value of g_variant_get_child_value();
use g_variant_get() instead and free the iter when done.
2010-05-14 18:08:29 -04:00
David Zeuthen
ddc94bd0a6 GDBus: Remove cached value if a property is invalidated
Also add a test case to catch this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 12:56:09 -04:00
David Zeuthen
bb6530eb34 GDBus: Fix serialization of empty arrays
It turns out that we didn't observe padding (neither when reading nor
writing) for empty arrays which (apparently) is needed according to
the D-Bus spec and reference implementation. A simple test case to
provoke this behavior is as follows (notice the lack of 4 bytes worth
of padding at position 0x0064):

 Error calling dbus_message_demarshal() on this blob: org.freedesktop.DBus.Error.InvalidArgs: Message is corrupted (Alignment padding not null)
 0000: 6c 01 00 01  2e 00 00 00  41 00 00 00  37 00 00 00    l.......A...7...
 0010: 08 01 67 00  08 73 61 7b  73 76 7d 61  73 00 00 00    ..g..sa{sv}as...
 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  11 00 00 00  30 31 32 33    Member......0123
 0050: 34 35 36 37  38 39 30 31  32 33 34 35  36 00 00 00    4567890123456...
 0060: 00 00 00 00  0e 00 00 00  09 00 00 00  53 6f 6d 65    ............Some
 0070: 74 68 69 6e  67 00                                    thing.

 The blob was generated from the following GVariant value:
 ('01234567890123456', @a{sv} {}, ['Something'])

 If the blob was encoded using DBusMessageIter, the payload would have been:

 0000: 6c 01 00 01  32 00 00 00  41 00 00 00  36 00 00 00    l...2...A...6...
 0010: 01 01 6f 00  08 00 00 00  2f 66 6f 6f  2f 62 61 72    ..o...../foo/bar
 0020: 00 00 00 00  00 00 00 00  03 01 73 00  06 00 00 00    ..........s.....
 0030: 4d 65 6d 62  65 72 00 00  08 01 67 00  08 73 61 7b    Member....g..sa{
 0040: 73 76 7d 61  73 00 00 00  11 00 00 00  30 31 32 33    sv}as.......0123
 0050: 34 35 36 37  38 39 30 31  32 33 34 35  36 00 00 00    4567890123456...
 0060: 00 00 00 00  00 00 00 00  0e 00 00 00  09 00 00 00    ................
 0070: 53 6f 6d 65  74 68 69 6e  67 00                       Something.
 ** ERROR:gdbus-serialization.c:547:check_serialization: code should not be reached
 Aborted

and this is now in the libdbus-1-using serialization test case.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 12:56:09 -04:00
Matthias Clasen
ee9b16242c another !srcdir build fix 2010-05-14 10:49:03 -04:00
Matthias Clasen
159f533abf More !srcdir build fixes 2010-05-14 10:25:31 -04:00
Ryan Lortie
d8d1a02c55 include gunixcredentialsmessage from unixsocket
fixes a build issue
2010-05-14 15:31:14 +02:00
Matthias Clasen
1d22b64843 Cleanups
Sort #includes a bit better, and don't include platform-specific
headers in gio.h.
2010-05-14 08:38:07 -04:00
Matthias Clasen
0540798991 Fix !srcdir build
Thankfully we already had a SRCDIR define.
2010-05-14 01:36:25 -04:00
Matthias Clasen
4e7764fb2d Documentation cleanups 2010-05-14 00:21:39 -04:00
Matthias Clasen
6223341cac Merge branch 'gdbus-merge'
Conflicts:
	docs/reference/gio/gio-docs.xml
	docs/reference/gio/gio-sections.txt
	gio/tests/Makefile.am
2010-05-13 23:08:34 -04:00
Matthias Clasen
6e8637e478 The default timeout is 25s 2010-05-13 22:15:47 -04:00
Matthias Clasen
bdc29f82d3 Document more floating variant details. 2010-05-13 21:53:51 -04:00
Matthias Clasen
e72f7f52de Add some more details to the long description 2010-05-13 21:45:18 -04:00
Matthias Clasen
8f89b63930 Clean up platform-specific includes
The problem was pointed out in bug 618029. To solve it, we moved
the GUnixFDList typedef to giotypes.h.
2010-05-13 20:29:04 -04:00
Ryan Lortie
e1fb92551f check for working gettext() before running tests 2010-05-14 01:01:40 +02:00
David Zeuthen
68078ed648 GDBus: Nuke G_BUS_TYPE_NONE 2010-05-13 18:04:48 -04:00
David Zeuthen
1fd55b8bbf GDBus: Remove g_dbus_is_activated()
It's generally hard to get this right so don't attempt to do so.
2010-05-13 17:44:42 -04:00
David Zeuthen
51446baa52 GDBus: subscribe to PropertiesChanged() before calling GetAll()
Otherwise there's a slight chance of a race.
2010-05-13 17:20:39 -04:00
David Zeuthen
0e2c708bb2 GDBus: Don't take a GError for g_dbus_proxy_get_cached_property_names()
We stopped doing this for get_cached_property() so no reason to do it
here.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-13 17:10:15 -04:00
David Zeuthen
3ca28ef718 GDBus: Update docs for GDBusProxy::g-properties-changed signal
Also update the example. See

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

for more details.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-13 16:57:29 -04:00
Christian Persch
e3f5d3c005 Make GVariant handling in PropertiesChanged more efficient
There's no need to re-build the a{sv} array, just get it right out of
the parameters. Also avoid some string copies.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-13 16:46:18 -04:00
Christian Persch
4ad4c306c3 Plug some mem leaks
g_variant_get (v, "s", &str) returns a string copy; use "&s" instead.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-13 16:43:41 -04:00
David Zeuthen
60e7ae26af GDBus: Add GDBusAuthObserver param in g_dbus_connection_new_for_address()
This is to match g_dbus_connection_new(). This extension allows us to
extend GDBusAuthObserver to also be used in client-side authentication
in the future (right now it's only used on the server-side).
2010-05-13 16:32:11 -04:00
David Zeuthen
cb753dfd49 GDBus: Rename ::deny-authentication-peer to ::authorize-authenticated-peer 2010-05-13 16:20:31 -04:00
Matthias Clasen
9e90b381f5 Remove the credentials argument from g_unix_connect_send_credentials()
Instead, make it always send the current credentials.
2010-05-13 14:29:39 -04:00
David Zeuthen
33952347ff GDBus: Make message serialization routines take capabilities param
This is needed to e.g. allow encoding maybe types (once we add
G_DBUS_CAPABILITY_FLAGS_MAYBE_TYPES) if, and only if, that capability
has been negotiated with the peer (via authentication).
2010-05-13 14:03:58 -04:00
Matthias Clasen
107b4d4bae remove the redundant interface_name parameter 2010-05-13 13:09:58 -04:00
David Zeuthen
82158afdad GDBus: Catch up with new PropertiesChanged signal
After a long discussion, this has finally been standardized in the
D-Bus spec. See

 http://lists.freedesktop.org/archives/dbus/2010-May/012667.html
 http://lists.freedesktop.org/archives/dbus/2010-May/012712.html

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-13 11:56:15 -04:00
Matthias Clasen
2d75583fb2 Fill out the export section of the migration guide 2010-05-13 01:04:29 -04:00
Matthias Clasen
9a065edf6f Add an example of exporting a GObject
This is more manual work than dbus-glib.
2010-05-13 00:40:41 -04:00
David Zeuthen
ea1e0496b0 GDBus: add 'monitor' verb to gdbus(1)
This uncovered a bug in name watching if the name wasn't activatable.

Also provoked the need for on_connection variants of g_bus_watch_name
(added g_bus_watch_proxy's variant as well).
2010-05-12 23:12:14 -04:00
David Zeuthen
9695c23d4c GDBus: Make gdbus(1) print annotations when introspecting data
Also make the gdbus-example-server include some example
annotations. The output looks like this:

$ gdbus introspect --session --dest org.gtk.GDBus.TestServer --object-path /org/gtk/GDBus/TestObject
node /org/gtk/GDBus/TestObject {
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface_name,
          in  s property_name,
          out v value);
      GetAll(in  s interface_name,
             out a{sv} properties);
      Set(in  s interface_name,
          in  s property_name,
          in  v value);
    signals:
      PropertiesChanged(s interface_name,
                        a{sv} changed_properties);
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s xml_data);
  };
  interface org.freedesktop.DBus.Peer {
    methods:
      Ping();
      GetMachineId(out s machine_uuid);
  };
  @org.gtk.GDBus.Annotation("OnInterface")
  @org.gtk.GDBus.Annotation("AlsoOnInterface")
  interface org.gtk.GDBus.TestInterface {
    methods:
      @org.gtk.GDBus.Annotation("OnMethod")
      HelloWorld(in  s greeting,
                 out s response);
      EmitSignal(@org.gtk.GDBus.Annotation.("OnArg")
                 in  d speed_in_mph);
      GimmeStdout();
    signals:
      @org.gtk.GDBus.Annotation("Onsignal")
      VelocityChanged(d speed_in_mph,
                      @org.gtk.GDBus.Annotation.("OnArg_NonFirst")
                      s speed_as_string);
    properties:
      @org.gtk.GDBus.Annotation("OnProperty")
        @org.gtk.GDBus.Annotation("OnAnnotation_YesThisIsCrazy")
      readonly s FluxCapicitorName = 'DeLorean';
      readwrite s Title = 'Back To C!';
      readonly s ReadingAlwaysThrowsError;
      readwrite s WritingAlwaysThrowsError = "There's no home like home";
      writeonly s OnlyWritable;
      readonly s Foo = 'Tick';
      readonly s Bar = 'Tock';
  };
};
2010-05-12 22:11:18 -04:00
Matthias Clasen
cce08f1973 Add a note about implemented standard interfaces 2010-05-12 21:55:09 -04:00
David Zeuthen
f909cb5b27 GDBusProxy: Remove error in get_cached_property() and add set_cached_property()
This makes it possible to use the cached properties mechanism even if
constructing the proxy with the DO_NOT_LOAD_PROPERTIES flag.

This is useful for cases where you obtain the and track object
properties out-of-band. For example, in udisks, the plan is to have
something like this

 Manager.GetObjects    (out ao paths, out aa{sa{sv}} all_properties);
 Manager.ObjectAdded   (o path, a{sa{sv}} all_properties);
 Manager.ObjectChanged (o path, a{sa{sv}} all_properties);
 Manager.ObjectRemoved (o path, a{sa{sv}} all_properties);

E.g. the first GetObjects() call will return *all* data about *all*
exported objects. Further, this way a client will only need to listen
these three signals (three AddMatch) on the Manager object and it will
never need to do GetAll() etc (e.g. can use DO_NOT_LOAD_PROPERTIES).

(Of course this only works if the client is interested in all
objects... while this is true for udisks it is generally not true for
other D-Bus services).

Also use expected_interface to check for programming errors.
2010-05-12 20:51:06 -04:00
David Zeuthen
d40767fc62 GDBus: Add an example of a GDBusProxy subclass 2010-05-12 15:52:08 -04:00
Matthias Clasen
7c0196f026 Update an example to the latest auth observer api 2010-05-12 13:01:40 -04:00
Jesse van den Kieboom
246db9bfdb Added test cases for g_output_stream_close_async
https://bugzilla.gnome.org/show_bug.cgi?id=617937
2010-05-12 09:21:12 +02:00
Jesse van den Kieboom
adc5162b74 Flush when closing output stream async
https://bugzilla.gnome.org/show_bug.cgi?id=617937
2010-05-12 09:21:06 +02:00
Matthias Clasen
e2b9d07765 Update TODO list 2010-05-11 23:26:51 -04:00
Matthias Clasen
a63d3bb868 mention inline use of floating variants 2010-05-11 23:18:48 -04:00
Matthias Clasen
ab2ff1a307 Remove properties from GDBusMethodInvocation class 2010-05-11 22:51:14 -04:00
Matthias Clasen
c4cf88c22f Document remove_filter 2010-05-11 22:50:40 -04:00
Matthias Clasen
d7095dd470 Document DBUS address env vars 2010-05-11 22:35:59 -04:00
Matthias Clasen
26f65d83c5 Don't refer to nonexisting API. 2010-05-11 21:59:42 -04:00
Matthias Clasen
e4b1e48fca Match up parameter names
and similar cleanups to make gtk-doc happy.
2010-05-11 20:57:44 -04:00
Matthias Clasen
1d43e4140b Line up prototypes 2010-05-11 20:03:44 -04:00
Matthias Clasen
54a57bb894 Strip copyright headers from examples
These are included wholesale in the docs, and the copyright
headers make them even more overwhelming. Plus, we don't have
copyright headers on examples anywhere else.
2010-05-11 15:50:19 -04:00
David Zeuthen
8c523c069b GDBus: Update TODO list 2010-05-11 12:04:37 -04:00
Sebastian Dröge
6d5ac8163b gio: Fix gsettings build with binutils gold linker 2010-05-11 06:17:25 +02:00
Sebastian Dröge
936ff022f2 Don't include __bss_start, _edata and _end symbols in the abichecks
They are added by the binutils gold linker.
2010-05-11 06:17:25 +02:00
David Zeuthen
2d208c9d36 GDBus: In gdbus(1), try Get() if GetAll() fails
This fixes a problem with services that doesn't implement GetAll() for
one reason or another.

$ gdbus introspect --session --dest org.freedesktop.ReserveDevice1.Audio0 --object-path /org/freedesktop/ReserveDevice1/Audio0
node /org/freedesktop/ReserveDevice1/Audio0 {
  interface org.freedesktop.ReserveDevice1 {
    methods:
      RequestRelease(in  i priority,
                     out b result);
    properties:
      readonly i Priority = 0;
      readonly s ApplicationName = 'PulseAudio Sound Server';
      readonly s ApplicationDeviceName = 'Internal Audio Analog Stereo';
  };
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface,
          in  s property,
          out v value);
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s data);
  };
};
2010-05-10 16:20:59 -04:00
David Zeuthen
6e23b0b785 GDBus: Add TODO item about a need to validate data / messages 2010-05-10 14:43:08 -04:00
David Zeuthen
adf50912dd GDBus Add TODO items about finding and launching bus instances 2010-05-10 14:07:13 -04:00
David Zeuthen
7e8b07ae3b GDBus: Use GVariant instead of GHashTable for GDBusProxy::g-properties-changed 2010-05-10 13:31:54 -04:00
David Zeuthen
869b4c6833 GDBus: Use call() instead of invoke_method()
Lots of people been suggesting this. We still use MethodInvocation /
method_invocation for handling incoming method calls so use call()
instead of invoke_method() helps to separate the client and server
facilities. Which is a good thing(tm).
2010-05-10 11:47:08 -04:00
Matthias Clasen
728c4e38e7 More copyright year updates 2010-05-10 08:07:28 -04:00
Matthias Clasen
5d1135618e Trivia 2010-05-10 08:07:07 -04:00
Matthias Clasen
25a8aa5d88 Cosmetic fixes
Use P_() for properties, fix up indentation, etc.
2010-05-09 22:13:18 -04:00
Matthias Clasen
0cf467c2ca Update copyright years to include 2010 2010-05-09 13:14:55 -04:00
Matthias Clasen
e82eea6fda Microoptimize string reallocations 2010-05-09 13:09:54 -04:00
Matthias Clasen
b87dd96a8a Move some platform sources around
gunixcredentialsmessage.h ought to live with other UNIX headers,
and the credentials are moved from dbus-specific to just GIO sources.
Also move gfiledescriptorbased.c to the UNIX sources.
2010-05-09 12:41:02 -04:00
David Zeuthen
c148cafdd1 GDBus: Rework GCredentials type
These changes are is related to

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

and IRC discussions with danw.
2010-05-09 10:03:56 -04:00
Matthias Clasen
bb7106c5df Add some conceptual changes 2010-05-09 02:27:09 -04:00
Matthias Clasen
8315eb77d5 Some documentation tweaks
Add links to the D-Bus docs in some places, and various
other additions.
2010-05-09 01:44:11 -04:00
Matthias Clasen
7ca2e00054 Doc improvements
Make sure all unix-specific apis are marked as such.
2010-05-08 23:28:17 -04:00
Matthias Clasen
e8bc8c6cbf Document length parameter of g_settings_get/set_strv
This parameter was not mentioned in the doc comment, as pointed
out in bug 617767.
2010-05-08 20:14:41 -04:00
Matthias Clasen
9164fd02c9 Document length parameter of g_settings_get/set_strv
This parameter was not mentioned in the doc comment, as pointed
out in bug 617767.
2010-05-08 20:10:57 -04:00
Dan Winship
af263a3a10 remove broken useless initialization in socket-client/socket-server
https://bugzilla.gnome.org/show_bug.cgi?id=618051
2010-05-07 19:08:13 -04:00
David Zeuthen
f1855c2f77 GDBus: add TODO item about maybe having to rework ::g-properties-changed 2010-05-07 15:02:37 -04:00
David Zeuthen
85c85ae63a GDBus: add TODO item about the need to rewrite private GDBusAuth* classes 2010-05-07 14:57:20 -04:00
David Zeuthen
5bd876bef0 Add TODO item about wanting G_DBUS_NONCE_TCP_TMPDIR 2010-05-07 14:56:01 -04:00
David Zeuthen
44fd23b649 GDBus: Add more symbols to pltcheck.sh's SKIP variable
In particular, add these symbols

 g_memdup
 g_print
 g_random_int
 g_propagate_prefixed_e
 g_thread_create_full
 g_int_hash
 g_file_open_tmp
 g_thread_self
 g_usleep
2010-05-06 17:41:31 -04:00
David Zeuthen
46ce134d51 GDBus: Add new symbols to gio.symbols 2010-05-06 17:31:51 -04:00
David Zeuthen
fb1b4599a0 GDBus: Fix up i18n 2010-05-06 16:34:23 -04:00
David Zeuthen
0fd6498cd8 Add "Since: 2.26" to all new GDBus API 2010-05-06 16:02:08 -04:00
David Zeuthen
c490c14f4e Set up gtk-doc for GDBus
Also move send_credentials() and receive_credentials() to
GUnixConnection. This code might change, discussion is still ongoing
in

 https://bugzilla.gnome.org/show_bug.cgi?id=617483.
2010-05-06 15:31:45 -04:00
David Zeuthen
d0a14469d0 Initial GDBus code-drop from GDBus-standalone repo
Things compile and the test-suite passes. Still need to hook up
gio.symbols and docs. There are still a bunch of TODOs left in the
sources that needs to be addressed.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-06 14:21:32 -04:00
Vincent Untz
5b4189fc42 Fix binding between writability of key and sensitivity of a widget
We were not setting the key correctly, result in usage of invalid keys.

Bug 617788.
2010-05-06 11:15:24 -05:00
Javier Jardón
434a4e1d25 Do not include "glib.h" in gio files 2010-05-06 17:42:09 +02:00
Torsten Schönfeld
f39a49b036 gio: Add a boxed type for GFileAttributeMatcher
https://bugzilla.gnome.org/show_bug.cgi?id=616892
2010-05-03 20:13:35 +02:00
Tor Lillqvist
4487b326d7 Fix list of sources in the gio Visual Studio project
List the additional sources needed in gio/Makefile.am, not in
gio.vcprojin. Fix broken usage of sort. Filter out Unix-only source
files.
2010-05-03 19:56:46 +03:00
Tor Lillqvist
0f795345d6 Fix misspelled identifier in the Win32 code 2010-05-03 19:24:35 +03:00
Dan Winship
622916b731 g_cancellable_release_fd: allow NULL cancellable
Almost all GCancellable methods silently do nothing if passed NULL for
the cancellable. Make g_cancellable_release_fd() do that as well.
2010-05-03 12:08:14 -04:00
Ryan Lortie
644dfbd704 GSettings: fix mixed use of a pointer
- used in some places as a move-along-as-we-go pointer
  - used in other places as a pointer to the fixed base of an array

Switch all users to the first style to avoid a crasher.
2010-05-02 14:15:33 -05:00
Ryan Lortie
8dddf6499e GSettingsBackend API/ABI change
- add list() virtual method
  - add 'default_value' flag to read() call
2010-04-28 14:41:42 -05:00
Dan Winship
9ba690b386 .gitignore updates for gsettings stuff 2010-04-27 17:04:57 -04:00
Dan Winship
5046dfc85d GSocket: fix garbled error messages on windows
socket_strerror() was assuming all "strerror" messages are shorter
than 128 bytes, which is certainly true on Linux, but apparently not
on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=615494
2010-04-27 09:02:20 -04:00
David Zeuthen
3ceddd74bb Bug 616877 – Several issues with g_socket_receive_message
The messages array was not reallocated correctly because it was using
malloc instead of realloc. Also, if the user requested messages but
none were received we would segfault. Rewrite the code to fix this
and, for better readability, use GPtrArray instead of rolling our own.

Also make the docs mention that the user need to free the returned
GSocketControlMessage objects using g_object_unref().

Clarify that *messages may be set to %NULL if there are no messages
(this will save pointless allocs of arrays).

Finally, the Win32 version didn't set messages to the expected value.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-04-26 19:19:17 -04:00
Christian Persch
6f7fb3744b Add testcases for <range> and <choices>
Bug #616102.
2010-04-25 20:07:26 -05:00
Ryan Lortie
22ce6ed82d Add range restriction to gschema-compiler
Patch from Christian Persch, with minor modifications.

Bug #616102
2010-04-25 20:06:13 -05:00
Ryan Lortie
5e6e7cbadf GVariant: add bind map for strings to byte arrays 2010-04-25 19:12:14 -05:00
Tor Lillqvist
da306296cf Can't use stderr as a field name 2010-04-25 17:26:41 +03:00