diff options
author | Mikael Hallendal <micke@imendio.com> | 2005-01-27 00:02:57 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2005-01-27 00:02:57 +0000 |
commit | 6139d00ed85916a8001e6c035a5bbba50af87c1c (patch) | |
tree | 7a00c5fdd039b6bacfb7851ae658deaecdeb64c6 | |
parent | 410c12d12394584b95602ef11987632613c99e61 (diff) | |
download | gconf-6139d00ed85916a8001e6c035a5bbba50af87c1c.tar.gz |
- Updated to work with D-Bus 0.23 - Note that it still installs the
2005-01-27 Mikael Hallendal <micke@imendio.com>
* gconf/gconf-database-dbus.c: (database_filter_func),
(database_handle_service_owner_changed):
* gconf/gconf-dbus-utils.h:
* gconf/gconf-dbus.c: (gconf_dbus_message_filter):
* gconf/gconfd-dbus.c: (gconfd_dbus_init):
* gconf/gconfd.c: (main):
- Updated to work with D-Bus 0.23
- Note that it still installs the service file in lib/dbus-1.0 instead
of new location in share/
- Uses ServiceOwnerChanged API now.
* configure.in:
- Bumped version to 2.6.4.2
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | gconf/gconf-database-dbus.c | 37 | ||||
-rw-r--r-- | gconf/gconf-dbus-utils.h | 2 | ||||
-rw-r--r-- | gconf/gconf-dbus.c | 61 | ||||
-rw-r--r-- | gconf/gconfd-dbus.c | 7 |
6 files changed, 91 insertions, 33 deletions
@@ -1,3 +1,18 @@ +2005-01-27 Mikael Hallendal <micke@imendio.com> + + * gconf/gconf-database-dbus.c: (database_filter_func), + (database_handle_service_owner_changed): + * gconf/gconf-dbus-utils.h: + * gconf/gconf-dbus.c: (gconf_dbus_message_filter): + * gconf/gconfd-dbus.c: (gconfd_dbus_init): + * gconf/gconfd.c: (main): + - Updated to work with D-Bus 0.23 + - Note that it still installs the service file in lib/dbus-1.0 instead + of new location in share/ + - Uses ServiceOwnerChanged API now. + * configure.in: + - Bumped version to 2.6.4.2 + 2005-01-17 Mikael Hallendal <micke@imendio.com> * configure.in: Bumped to 2.6.4.1 diff --git a/configure.in b/configure.in index d5222731..7910dd21 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ AC_INIT(gconf/gconf.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(GConf, 2.6.4.1) +AM_INIT_AUTOMAKE(GConf, 2.6.4.2) AM_MAINTAINER_MODE diff --git a/gconf/gconf-database-dbus.c b/gconf/gconf-database-dbus.c index e54ccbb2..c57d4f43 100644 --- a/gconf/gconf-database-dbus.c +++ b/gconf/gconf-database-dbus.c @@ -59,7 +59,7 @@ database_filter_func (DBusConnection *connection, DBusMessage *message, GConfDatabaseDBus *db); static DBusHandlerResult -database_handle_service_deleted (DBusConnection *connection, +database_handle_service_owner_changed (DBusConnection *connection, DBusMessage *message, GConfDatabaseDBus *db); static void database_handle_lookup (DBusConnection *conn, @@ -206,21 +206,22 @@ database_filter_func (DBusConnection *connection, { if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceDeleted")) - return database_handle_service_deleted (connection, message, db); + "ServiceOwnerChanged")) + return database_handle_service_owner_changed (connection, message, db); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } static DBusHandlerResult -database_handle_service_deleted (DBusConnection *connection, - DBusMessage *message, - GConfDatabaseDBus *db) +database_handle_service_owner_changed (DBusConnection *connection, + DBusMessage *message, + GConfDatabaseDBus *db) { DBusMessageIter iter; char *service; GList *notifications = NULL, *l; NotificationData *notification; + char *owner; /* FIXME: This might be a bit too slow to do like this. We could add a hash * table that maps client base service names to notification data, instead of @@ -229,6 +230,30 @@ database_handle_service_deleted (DBusConnection *connection, dbus_message_iter_init (message, &iter); service = dbus_message_iter_get_string (&iter); + if (!dbus_message_iter_next (&iter)) + { + g_warning ("Misformated ServiceOwnerChanged message"); + dbus_free (service); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + if (!dbus_message_iter_next (&iter)) + { + g_warning ("Misformated ServiceOwnerChanged message"); + dbus_free (service); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + + owner = dbus_message_iter_get_string (&iter); + if (strcmp (owner, "") != 0) + { + /* Service still exist, don't remove notifications */ + dbus_free (service); + dbus_free (owner); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + dbus_free (owner); + g_hash_table_foreach (db->notifications, get_all_notifications_func, ¬ifications); diff --git a/gconf/gconf-dbus-utils.h b/gconf/gconf-dbus-utils.h index 8e6fcfa1..9441b76a 100644 --- a/gconf/gconf-dbus-utils.h +++ b/gconf/gconf-dbus-utils.h @@ -21,7 +21,7 @@ #define GCONF_DBUS_UTILS_H #include <glib.h> -#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus.h> #include <gconf/gconf.h> #include <gconf/gconf-value.h> diff --git a/gconf/gconf-dbus.c b/gconf/gconf-dbus.c index ad00bb21..2e287410 100644 --- a/gconf/gconf-dbus.c +++ b/gconf/gconf-dbus.c @@ -37,6 +37,7 @@ #include <sys/time.h> #include <unistd.h> #include <dbus/dbus.h> +#include <dbus/dbus-glib-lowlevel.h> #define d(x) @@ -2087,32 +2088,31 @@ gconf_dbus_message_filter (DBusConnection *dbus_conn, } else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceDeleted")) + "ServiceOwnerChanged")) { + char *owner; + dbus_message_iter_init (message, &iter); + service = dbus_message_iter_get_string (&iter); - if (strcmp (service, GCONF_DBUS_SERVICE) == 0) + if (strcmp (service, GCONF_DBUS_SERVICE) != 0) { - /* GConfd is gone, set the state so we can detect that we're down. */ - service_running = FALSE; - needs_reconnect = TRUE; - - d(g_print ("* GConf Service deleted\n")); + dbus_free (service); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - + dbus_free (service); + + if (!dbus_message_iter_next (&iter)) + { + d(g_print ("Malformed ServiceOwnerChanged signal\n")); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - else if (dbus_message_is_signal (message, - DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, - "ServiceCreated")) - { - dbus_message_iter_init (message, &iter); - service = dbus_message_iter_get_string (&iter); - - if (strcmp (service, GCONF_DBUS_SERVICE) == 0) + owner = dbus_message_iter_get_string (&iter); + if (strcmp (owner, "") == 0) { /* GConfd is back. */ service_running = TRUE; @@ -2123,14 +2123,31 @@ gconf_dbus_message_filter (DBusConnection *dbus_conn, reinitialize_databases (); } - d(g_print ("* Gconf Service created\n")); + d(g_print ("*** Gconf Service created\n")); } + + dbus_free (owner); + + if (!dbus_message_iter_next (&iter)) { + d(g_print ("Malformed ServiceOwnerChanged signal\n")); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } - dbus_free (service); + owner = dbus_message_iter_get_string (&iter); + if (strcmp (owner, "") == 0) + { + /* GConfd is gone, set the state so we can detect that we're down. */ + service_running = FALSE; + needs_reconnect = TRUE; - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + d(g_print ("*** GConf Service deleted\n")); + } + + dbus_free (owner); + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } diff --git a/gconf/gconfd-dbus.c b/gconf/gconfd-dbus.c index 16cdf079..ddde7d07 100644 --- a/gconf/gconfd-dbus.c +++ b/gconf/gconfd-dbus.c @@ -20,6 +20,7 @@ #include <config.h> #include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> #include <string.h> #include "gconf-database-dbus.h" #include "gconf-dbus-utils.h" @@ -30,7 +31,7 @@ static DBusConnection *bus_conn; static const char *server_path = "/org/gnome/GConf/Server"; static gint nr_of_connections = 0; -#define SERVICE_DELETED_RULE "type='signal',member='ServiceDeleted'," \ +#define SERVICE_OWNER_CHANGED_RULE "type='signal',member='ServiceOwnerChanged'," \ "sender='org.freedesktop.DBus',interface='org.freedesktop.DBus'" @@ -197,8 +198,8 @@ gconfd_dbus_init (void) return FALSE; } - /* Add filter for ServiceDeleted so we get notified when the clients go away. */ - dbus_bus_add_match (bus_conn, SERVICE_DELETED_RULE, NULL); + /* Add filter for ServiceOwnerChanged so we get notified when the clients go away. */ + dbus_bus_add_match (bus_conn, SERVICE_OWNER_CHANGED_RULE, NULL); dbus_bus_acquire_service (bus_conn, GCONF_DBUS_SERVICE, 0, &error); if (dbus_error_is_set (&error)) |