aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-07 12:43:29 -0600
committerTed Gould <ted@gould.cx>2011-01-07 12:43:29 -0600
commit6ff24e119e625d2217203a64ae4d4003a9ccae09 (patch)
tree5b71ae41789e24aa86365823910d5cd38b5d94a9
parent06270832fc023e972cac3c66fcf870a1d5b4a965 (diff)
downloadlibayatana-indicator-6ff24e119e625d2217203a64ae4d4003a9ccae09.tar.gz
libayatana-indicator-6ff24e119e625d2217203a64ae4d4003a9ccae09.tar.bz2
libayatana-indicator-6ff24e119e625d2217203a64ae4d4003a9ccae09.zip
Switching the registration of the object over.
-rw-r--r--libindicator/indicator-service.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index 3635b45..21da089 100644
--- a/libindicator/indicator-service.c
+++ b/libindicator/indicator-service.c
@@ -47,6 +47,8 @@ static gboolean _indicator_service_server_un_watch (IndicatorService * service,
@watcher: A list of processes on dbus that are watching us.
@this_service_version: The version to hand out that we're
implementing. May not be set, so we'll send zero (default).
+ @dbus_registration: The handle for this object being registered
+ on dbus.
*/
typedef struct _IndicatorServicePrivate IndicatorServicePrivate;
struct _IndicatorServicePrivate {
@@ -57,6 +59,7 @@ struct _IndicatorServicePrivate {
guint timeout_length;
GHashTable * watchers;
guint this_service_version;
+ guint dbus_registration;
};
/* Signals Stuff */
@@ -163,10 +166,6 @@ indicator_service_class_init (IndicatorServiceClass *klass)
}
}
- /* Initialize the object as a DBus type */
- dbus_g_object_type_install_info(INDICATOR_SERVICE_TYPE,
- &dbus_glib__indicator_service_server_object_info);
-
return;
}
@@ -187,6 +186,7 @@ indicator_service_init (IndicatorService *self)
priv->bus = NULL;
priv->this_service_version = 0;
priv->timeout_length = 500;
+ priv->dbus_registration = 0;
const gchar * timeoutenv = g_getenv("INDICATOR_SERVICE_SHUTDOWN_TIMEOUT");
if (timeoutenv != NULL) {
@@ -233,9 +233,13 @@ indicator_service_init (IndicatorService *self)
return;
}
- dbus_g_connection_register_g_object(priv->bus,
- INDICATOR_SERVICE_OBJECT,
- G_OBJECT(self));
+ priv->dbus_registration = g_dbus_connection_register_object(priv->bus,
+ INDICATOR_SERVICE_OBJECT,
+ interface_info,
+ &interface_table,
+ self,
+ NULL,
+ &error);
return;
}
@@ -261,6 +265,12 @@ indicator_service_dispose (GObject *object)
priv->timeout = 0;
}
+ if (priv->dbus_registration != 0) {
+ g_dbus_connection_unregister_object(priv->bus, priv->dbus_registration);
+ /* Don't care if it fails, there's nothing we can do */
+ priv->dbus_registration = 0;
+ }
+
G_OBJECT_CLASS (indicator_service_parent_class)->dispose (object);
return;
}