diff options
author | Søren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com> | 2009-04-12 14:56:56 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@dhcp-100-2-40.bos.redhat.com> | 2009-04-12 14:56:56 -0400 |
commit | 4daacc3db721e0fd2f0190d0d6fca14a36e479f2 (patch) | |
tree | a73fb034d31ec927e9a42ce3caf58c5035ebcbcb | |
parent | 261dfb9c86fd7b060555197f112e314b0b5c76f6 (diff) |
Add nul_dbus_service_add_object()
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | dbus.c | 26 | ||||
-rw-r--r-- | dbw-example.c | 41 | ||||
-rw-r--r-- | libffi/doc/libffi.info | 2 | ||||
-rw-r--r-- | libnul.h | 7 |
5 files changed, 42 insertions, 40 deletions
@@ -21,6 +21,12 @@ can be started without actually starting it. Ie., invoke(); } +This is racy though. + +Another possibility would be to say "start_service()" and if that is +successful, then add the objects afterwards. For now, this is what we +are doing. + Callbacks should religiously be on the "callback, data," form to make them bindable in languages with closures. (Broken at the moment for objects). @@ -744,6 +744,16 @@ nul_dbus_session_service (const char *name, return service; } +void +nul_dbus_service_add_object (nul_dbus_service_t *service, + nul_dbus_object_t *object) +{ + service->objects = nul_ptr_array_append (service->objects, object); + + dbus_connection_register_object_path ( + service->connection, object->name, &vtable, object); +} + gboolean nul_dbus_service_start (nul_dbus_service_t *service) { @@ -1291,19 +1301,3 @@ nul_dbus_invoke (nul_dbus_service_t *service, dbus_message_unref (message); } - -void -nul_dbus_service_set_callbacks (nul_dbus_service_t *service, - const char *name, - nul_dbus_function_t function, - gpointer data, - ...) -{ -#if 0 - va_start (parameters, parameter1); - member->parameters = make_ptr_array ((nul_dbus_type_t *)parameter1, parameters); - va_end (parameters); -#endif - - -} diff --git a/dbw-example.c b/dbw-example.c index 51b05da..4ef5c33 100644 --- a/dbw-example.c +++ b/dbw-example.c @@ -87,26 +87,21 @@ make_service1 (void) NULL); } -static nul_dbus_service_t * -make_service2 (void) +static nul_dbus_object_t * +make_object2 (gpointer data) { - return nul_dbus_session_service ( - "org.gnome.siv", + return nul_dbus_object ( + "/org/gnome/siv", + data, - nul_dbus_object ( - "/org/gnome/siv", - NULL, + nul_dbus_interface ( + "org.gnome.siv", - nul_dbus_interface ( - "org.gnome.siv", - - nul_dbus_method ( - "load_image", - (nul_dbus_function_t)load_image, - nul_dbus_parameter_in ("image", nul_dbus_type_string()), - nul_dbus_parameter_out ("result", nul_dbus_type_int32()), - NULL), - + nul_dbus_method ( + "load_image", + (nul_dbus_function_t)load_image, + nul_dbus_parameter_in ("image", nul_dbus_type_string()), + nul_dbus_parameter_out ("result", nul_dbus_type_int32()), NULL), NULL), @@ -114,6 +109,14 @@ make_service2 (void) NULL); } +static nul_dbus_service_t * +make_service2 (void) +{ + return nul_dbus_session_service ( + "org.gnome.siv", + NULL); +} + static void on_do_stuff_reply (const char *emfle, const char *str, const GError *err, gpointer data) { @@ -174,13 +177,15 @@ main () { g_print ("siv already exists, asking it to load the images instead\n"); } + + nul_dbus_service_add_object (service2, make_object2("hi")); if (!nul_dbus_service_start (service)) { g_print ("Couldn't start the service\n"); } - g_idle_add (invokes, service); + g_idle_add (invokes, service2); g_main_loop_run (loop); diff --git a/libffi/doc/libffi.info b/libffi/doc/libffi.info index 6321aae..87dee8a 100644 --- a/libffi/doc/libffi.info +++ b/libffi/doc/libffi.info @@ -1,4 +1,4 @@ -This is doc/libffi.info, produced by makeinfo version 4.11 from +This is doc/libffi.info, produced by makeinfo version 4.12 from ./doc/libffi.texi. This manual is for Libffi, a portable foreign-function interface @@ -277,11 +277,8 @@ nul_dbus_parameter_t *nul_dbus_parameter_out (const char *name, const nul_dbus_type_t *type); gboolean nul_dbus_service_start (nul_dbus_service_t *service); void nul_dbus_service_stop (nul_dbus_service_t *service); -void nul_dbus_service_set_callbacks (nul_dbus_service_t *service, - const char *name, - nul_dbus_function_t function, - gpointer data, - ...); +void nul_dbus_service_add_object (nul_dbus_service_t *service, + nul_dbus_object_t *object); /* The returned values here are automatically freed at idle. You * must copy them if you want to keep them around |