diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | bus/activation.c | 4 | ||||
-rw-r--r-- | bus/driver.c | 18 | ||||
-rw-r--r-- | bus/session.conf.in | 2 | ||||
-rw-r--r-- | configure.in | 9 | ||||
-rw-r--r-- | dbus/dbus-bus.c | 77 | ||||
-rw-r--r-- | dbus/dbus-bus.h | 6 | ||||
-rw-r--r-- | dbus/dbus-message.c | 4 |
8 files changed, 120 insertions, 19 deletions
@@ -1,3 +1,22 @@ +2003-05-13 James Willcox <jwillcox@gnome.org> + + * configure.in: + * bus/activation.c: (bus_activation_service_created), + (bus_activation_activate_service): + * bus/driver.c: (bus_driver_send_service_deleted), + (bus_driver_send_service_created), (bus_driver_send_service_lost), + (bus_driver_send_service_acquired), + (bus_driver_send_welcome_message), + (bus_driver_handle_list_services): + * bus/session.conf.in: + * dbus/dbus-bus.c: (dbus_bus_acquire_service), + (dbus_bus_service_exists), (dbus_bus_activate_service): + * dbus/dbus-bus.h: + + Add some convenience API which lets you activate a service, and did a + bunch of s/0/DBUS_TYPE_INVALID/ in calls to dbus_message_append_args() + and dbus_message_get_args() + 2003-05-11 Havoc Pennington <hp@pobox.com> * dbus/dbus-marshal.c (_dbus_marshal_validate_arg): fix to avoid diff --git a/bus/activation.c b/bus/activation.c index 3682eecc..a52fa4bc 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -595,7 +595,7 @@ bus_activation_service_created (BusActivation *activation, if (!dbus_message_append_args (message, DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ACTIVATED, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); BUS_SET_OOM (error); @@ -877,7 +877,7 @@ bus_activation_activate_service (BusActivation *activation, if (!dbus_message_append_args (message, DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE, - 0)) + DBUS_TYPE_INVALID)) { _dbus_verbose ("No memory to set args of reply to activate message\n"); BUS_SET_OOM (error); diff --git a/bus/driver.c b/bus/driver.c index 3c4847ba..e0afd8ef 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -60,7 +60,7 @@ bus_driver_send_service_deleted (const char *service_name, if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS) || !dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); BUS_SET_OOM (error); @@ -100,7 +100,7 @@ bus_driver_send_service_created (const char *service_name, if (!dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); BUS_SET_OOM (error); @@ -133,7 +133,7 @@ bus_driver_send_service_lost (DBusConnection *connection, if (!dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); BUS_SET_OOM (error); @@ -174,7 +174,7 @@ bus_driver_send_service_acquired (DBusConnection *connection, if (!dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); BUS_SET_OOM (error); @@ -352,7 +352,7 @@ bus_driver_send_welcome_message (DBusConnection *connection, if (!dbus_message_append_args (welcome, DBUS_TYPE_STRING, name, - NULL)) + DBUS_TYPE_INVALID)) { dbus_message_unref (welcome); BUS_SET_OOM (error); @@ -403,7 +403,7 @@ bus_driver_handle_list_services (DBusConnection *connection, if (!dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, services, len, - 0)) + DBUS_TYPE_INVALID)) { dbus_free_string_array (services); dbus_message_unref (reply); @@ -447,7 +447,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection, if (!dbus_message_get_args (message, error, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT32, &flags, - 0)) + DBUS_TYPE_INVALID)) return FALSE; _dbus_verbose ("Trying to own service %s with flags 0x%x\n", name, flags); @@ -510,7 +510,7 @@ bus_driver_handle_service_exists (DBusConnection *connection, if (!dbus_message_get_args (message, error, DBUS_TYPE_STRING, &name, - 0)) + DBUS_TYPE_INVALID)) return FALSE; retval = FALSE; @@ -567,7 +567,7 @@ bus_driver_handle_activate_service (DBusConnection *connection, if (!dbus_message_get_args (message, error, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT32, &flags, - 0)) + DBUS_TYPE_INVALID)) { _DBUS_ASSERT_ERROR_IS_SET (error); _dbus_verbose ("No memory to get arguments to ActivateService\n"); diff --git a/bus/session.conf.in b/bus/session.conf.in index 4feca235..673d8739 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -10,6 +10,8 @@ <listen>unix:tmpdir=@DBUS_SESSION_SOCKET_DIR@</listen> + <servicedir>@EXPANDED_LIBDIR@/dbus-1.0/services</servicedir> + <policy context="default"> <!-- Allow everything --> <allow send="*"/> diff --git a/configure.in b/configure.in index f95da565..1b717747 100644 --- a/configure.in +++ b/configure.in @@ -548,6 +548,12 @@ EXPANDED_BINDIR=`eval echo $BINDIR_TMP` prefix=$old_prefix AC_SUBST(EXPANDED_BINDIR) +old_exec_prefix=${exec_prefix} +test "x$exec_prefix" = xNONE && eval exec_prefix=${prefix} +eval EXPANDED_LIBDIR=${libdir} +exec_prefix=${old_exec_prefix} +AC_SUBST(EXPANDED_LIBDIR) + #### Check our operating system operating_system=unknown if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then @@ -630,6 +636,7 @@ fi AC_SUBST(DBUS_SESSION_SOCKET_DIR) + AC_OUTPUT([ Doxyfile dbus/dbus-arch-deps.h @@ -707,4 +714,4 @@ if test x$enable_asserts = xyes; then fi if test x$enable_checks = xno; then echo "NOTE: building without checks for arguments passed to public API makes it harder to debug apps using D-BUS, but will slightly decrease D-BUS library size and _very_ slightly improve performance." -fi
\ No newline at end of file +fi diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index 9627341e..dee9b9f7 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -465,7 +465,7 @@ dbus_bus_register (DBusConnection *connection, goto out; else if (!dbus_message_get_args (reply, error, DBUS_TYPE_STRING, &name, - 0)) + DBUS_TYPE_INVALID)) goto out; bd->base_service = name; @@ -576,7 +576,7 @@ dbus_bus_acquire_service (DBusConnection *connection, if (!dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, DBUS_TYPE_UINT32, flags, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); _DBUS_SET_OOM (error); @@ -603,7 +603,7 @@ dbus_bus_acquire_service (DBusConnection *connection, if (!dbus_message_get_args (reply, error, DBUS_TYPE_UINT32, &service_result, - 0)) + DBUS_TYPE_INVALID)) { _DBUS_ASSERT_ERROR_IS_SET (error); dbus_message_unref (reply); @@ -647,7 +647,7 @@ dbus_bus_service_exists (DBusConnection *connection, if (!dbus_message_append_args (message, DBUS_TYPE_STRING, service_name, - 0)) + DBUS_TYPE_INVALID)) { dbus_message_unref (message); _DBUS_SET_OOM (error); @@ -665,7 +665,7 @@ dbus_bus_service_exists (DBusConnection *connection, if (!dbus_message_get_args (reply, error, DBUS_TYPE_UINT32, &exists, - 0)) + DBUS_TYPE_INVALID)) { _DBUS_ASSERT_ERROR_IS_SET (error); return FALSE; @@ -674,4 +674,71 @@ dbus_bus_service_exists (DBusConnection *connection, return (exists != FALSE); } +/** + * Activates a given service + * + * @param connection the connection + * @param service_name the service name + * @param flags the flags + * @param result a place to store the result of the activation, which will + * be one of DBUS_ACTIVATION_REPLY_ACTIVATED or + * DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE if successful. Pass NULL if you + * don't care about the result. + * @param error location to store any errors + * @returns #TRUE if the activation succeeded, #FALSE if not + * + * @todo document what the flags do + */ +dbus_bool_t +dbus_bus_activate_service (DBusConnection *connection, + const char *service_name, + dbus_uint32_t flags, + dbus_uint32_t *result, + DBusError *error) +{ + DBusMessage *msg; + DBusMessage *reply; + + msg = dbus_message_new (DBUS_MESSAGE_ACTIVATE_SERVICE, + DBUS_SERVICE_DBUS); + + if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, service_name, + DBUS_TYPE_UINT32, flags, DBUS_TYPE_INVALID)) + { + dbus_message_unref (msg); + _DBUS_SET_OOM (error); + return FALSE; + } + + reply = dbus_connection_send_with_reply_and_block (connection, msg, + -1, error); + dbus_message_unref (msg); + + if (reply == NULL) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + return FALSE; + } + + if (dbus_set_error_from_message (error, reply)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + dbus_message_unref (reply); + return FALSE; + } + + if (result != NULL && + !dbus_message_get_args (reply, error, DBUS_TYPE_UINT32, + result, DBUS_TYPE_INVALID)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + dbus_message_unref (reply); + return FALSE; + } + + dbus_message_unref (reply); + return TRUE; +} + + /** @} */ diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h index e3ec054c..a62a746b 100644 --- a/dbus/dbus-bus.h +++ b/dbus/dbus-bus.h @@ -53,6 +53,12 @@ dbus_bool_t dbus_bus_service_exists (DBusConnection *connection, const char *service_name, DBusError *error); +dbus_bool_t dbus_bus_activate_service (DBusConnection *connection, + const char *service_name, + dbus_uint32_t flags, + dbus_uint32_t *reply, + DBusError *error); + DBUS_END_DECLS; #endif /* DBUS_BUS_H */ diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 7c89d734..4d80425b 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1229,7 +1229,7 @@ dbus_message_get_destination (DBusMessage *message) * followed by the value to add. Array values are specified by an int * typecode followed by a pointer to the array followed by an int * giving the length of the array. The argument list must be - * terminated with DBUS_TYPE_INVALID. + * terminated with #DBUS_TYPE_INVALID. * * This function doesn't support dicts or non-fundamental arrays. * @@ -1421,7 +1421,7 @@ dbus_message_append_args_valist (DBusMessage *message, * Gets arguments from a message given a variable argument list. * The variable argument list should contain the type of the * argumen followed by a pointer to where the value should be - * stored. The list is terminated with 0. + * stored. The list is terminated with #DBUS_TYPE_INVALID. * * @param message the message * @param error error to be filled in on failure |