r15121 - in /desktop/unstable/gnome-keyring/debian: changelog patches/02_handle_dbus_restart.patch
sjoerd at users.alioth.debian.org
sjoerd at users.alioth.debian.org
Fri Mar 14 13:16:10 UTC 2008
Author: sjoerd
Date: Fri Mar 14 13:16:10 2008
New Revision: 15121
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=15121
Log:
* debian/patches/02_handle_dbus_restart.patch
- Added. Handle the restart of the system dbus (Closes: #456362)
Added:
desktop/unstable/gnome-keyring/debian/patches/02_handle_dbus_restart.patch
Modified:
desktop/unstable/gnome-keyring/debian/changelog
Modified: desktop/unstable/gnome-keyring/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-keyring/debian/changelog?rev=15121&op=diff
==============================================================================
--- desktop/unstable/gnome-keyring/debian/changelog (original)
+++ desktop/unstable/gnome-keyring/debian/changelog Fri Mar 14 13:16:10 2008
@@ -1,3 +1,10 @@
+gnome-keyring (2.22.0-2) UNRELEASED; urgency=low
+
+ * debian/patches/02_handle_dbus_restart.patch
+ - Added. Handle the restart of the system dbus (Closes: #456362)
+
+ -- Sjoerd Simons <sjoerd at debian.org> Fri, 14 Mar 2008 14:09:46 +0100
+
gnome-keyring (2.22.0-1) unstable; urgency=low
[ Emilio Pozuelo Monfort ]
Added: desktop/unstable/gnome-keyring/debian/patches/02_handle_dbus_restart.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-keyring/debian/patches/02_handle_dbus_restart.patch?rev=15121&op=file
==============================================================================
--- desktop/unstable/gnome-keyring/debian/patches/02_handle_dbus_restart.patch (added)
+++ desktop/unstable/gnome-keyring/debian/patches/02_handle_dbus_restart.patch Fri Mar 14 13:16:10 2008
@@ -1,0 +1,185 @@
+--- gnome-keyring-2.22.0.orig/common/gkr-location.c
++++ gnome-keyring-2.22.0/common/gkr-location.c
+@@ -65,6 +65,8 @@
+ struct _GkrLocationManagerPrivate {
+ #ifdef WITH_HAL
+ LibHalContext *hal_ctx;
++ guint hal_retry;
++ DBusConnection *dbus_connection;
+ #endif
+ GHashTable *volumes_by_name;
+ GHashTable *volumes_by_loc;
+@@ -82,6 +84,9 @@
+ (G_TYPE_INSTANCE_GET_PRIVATE((o), GKR_TYPE_LOCATION_MANAGER, GkrLocationManagerPrivate))
+
+ static GkrLocationManager *location_manager_singleton = NULL;
++#ifdef WITH_HAL
++static void location_manager_hal_init (GkrLocationManager *locmgr);
++#endif
+
+ /* -----------------------------------------------------------------------------
+ * HELPERS
+@@ -350,17 +355,89 @@
+ }
+ }
+
++static gboolean
++location_manager_try_hal_connection (gpointer data) {
++ GkrLocationManager *locmgr = GKR_LOCATION_MANAGER (data);
++ GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
++
++ pv->hal_retry = 0;
++
++ location_manager_hal_init (locmgr);
++
++ return FALSE;
++}
++
++static void
++location_manager_schedule_hal_retry (GkrLocationManager *locmgr) {
++ GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
++
++ g_message ("Scheduling hal init retry");
++
++ pv->hal_retry = g_timeout_add_seconds (30, location_manager_try_hal_connection, locmgr);
++}
++
++static void
++location_manager_hal_uninit (GkrLocationManager *locmgr)
++{
++ GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
++ DBusError error;
++
++
++ if (pv->hal_ctx) {
++ dbus_error_init (&error);
++ if (pv->dbus_connection != NULL && !libhal_ctx_shutdown (pv->hal_ctx, &error)) {
++ g_warning ("failed to shutdown HAL context: %s\n", error.message);
++ dbus_error_free (&error);
++ }
++
++ if (!libhal_ctx_free (pv->hal_ctx))
++ g_warning ("failed to free HAL context");
++ pv->hal_ctx = NULL;
++ }
++
++ if (pv->dbus_connection != NULL) {
++ gkr_dbus_disconnect_from_mainloop (pv->dbus_connection, NULL);
++ dbus_connection_unref (pv->dbus_connection);
++ pv->dbus_connection = NULL;
++ }
++}
++
++static DBusHandlerResult
++location_manager_dbus_filter_function (DBusConnection *connection, DBusMessage *message, void *user_data) {
++ GkrLocationManager *locmgr = GKR_LOCATION_MANAGER (user_data);
++ GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
++
++ if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
++ strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) {
++ GHashTableIter iter;
++ gchar *key;
++
++ location_manager_hal_uninit (locmgr);
++ location_manager_schedule_hal_retry (locmgr);
++
++ g_hash_table_iter_init (&iter, pv->volumes_by_name);
++ while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL)) {
++ gkr_location_manager_unregister (locmgr, key);
++ g_hash_table_iter_init (&iter, pv->volumes_by_name);
++ }
++
++ return DBUS_HANDLER_RESULT_HANDLED;
++ }
++ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++}
++
+ static void
+ location_manager_hal_init (GkrLocationManager *locmgr)
+ {
+ GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
+- DBusConnection *dbus_connection;
+ DBusError error;
++
++ g_message ("Setting up connection to hal");
+
+ pv->hal_ctx = libhal_ctx_new ();
+ if (!pv->hal_ctx) {
+ g_warning ("failed to create a HAL context\n");
+- return;
++ goto failed;
+ }
+
+ /*
+@@ -369,16 +446,19 @@
+ */
+
+ dbus_error_init (&error);
+- dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
++ pv->dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (dbus_error_is_set (&error)) {
+ g_warning ("Error connecting to D-BUS system bus: %s", error.message);
+ dbus_error_free (&error);
+- return;
++ goto failed;
+ }
+
+- gkr_dbus_connect_with_mainloop (dbus_connection, NULL);
++ gkr_dbus_connect_with_mainloop (pv->dbus_connection, NULL);
++ dbus_connection_set_exit_on_disconnect (pv->dbus_connection, FALSE);
++
++ dbus_connection_add_filter (pv->dbus_connection, location_manager_dbus_filter_function, locmgr, NULL);
+
+- libhal_ctx_set_dbus_connection (pv->hal_ctx, dbus_connection);
++ libhal_ctx_set_dbus_connection (pv->hal_ctx, pv->dbus_connection);
+
+ libhal_ctx_set_device_added (pv->hal_ctx, hal_device_added);
+ libhal_ctx_set_device_removed (pv->hal_ctx, hal_device_removed);
+@@ -387,31 +467,18 @@
+ if (!libhal_ctx_init (pv->hal_ctx, &error)) {
+ g_warning ("failed to initialize a HAL context: %s\n", error.message);
+ dbus_error_free (&error);
+- return;
++ goto failed;
+ }
+
+ libhal_ctx_set_user_data (pv->hal_ctx, locmgr);
+
+ populate_all_volumes (locmgr);
+-}
+
+-static void
+-location_manager_hal_uninit (GkrLocationManager *locmgr)
+-{
+- GkrLocationManagerPrivate *pv = GKR_LOCATION_MANAGER_GET_PRIVATE (locmgr);
+- DBusError error;
++ return;
+
+- if (pv->hal_ctx) {
+- dbus_error_init (&error);
+- if (!libhal_ctx_shutdown (pv->hal_ctx, &error)) {
+- g_warning ("failed to shutdown HAL context: %s\n", error.message);
+- dbus_error_free (&error);
+- }
+-
+- if (!libhal_ctx_free (pv->hal_ctx))
+- g_warning ("failed to free HAL context");
+- pv->hal_ctx = NULL;
+- }
++failed:
++ location_manager_hal_uninit (locmgr);
++ location_manager_schedule_hal_retry (locmgr);
+ }
+
+ #endif /* WITH_HAL */
+@@ -471,6 +538,10 @@
+
+ #ifdef WITH_HAL
+ location_manager_hal_uninit (locmgr);
++ if (pv->hal_retry != 0)
++ g_source_remove (pv->hal_retry);
++
++ pv->hal_retry = 0;
+ #endif
+
+ g_hash_table_remove_all (pv->volumes_by_loc);
More information about the pkg-gnome-commits
mailing list