summaryrefslogtreecommitdiff
path: root/libmate-panel-applet/mate-panel-applet-factory.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-panel-applet/mate-panel-applet-factory.c')
-rw-r--r--libmate-panel-applet/mate-panel-applet-factory.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmate-panel-applet/mate-panel-applet-factory.c b/libmate-panel-applet/mate-panel-applet-factory.c
index cf2e6cba..370a4124 100644
--- a/libmate-panel-applet/mate-panel-applet-factory.c
+++ b/libmate-panel-applet/mate-panel-applet-factory.c
@@ -33,6 +33,10 @@ struct _MatePanelAppletFactory {
GType applet_type;
GClosure *closure;
+ GDBusConnection *connection;
+ gint owner_id;
+ gint registration_id;
+
GHashTable *applets;
guint next_uid;
};
@@ -53,6 +57,16 @@ mate_panel_applet_factory_finalize (GObject *object)
{
MatePanelAppletFactory *factory = MATE_PANEL_APPLET_FACTORY (object);
+ if (factory->registration_id) {
+ g_dbus_connection_unregister_object (factory->connection, factory->registration_id);
+ factory->registration_id = 0;
+ }
+
+ if (factory->owner_id) {
+ g_bus_unown_name (factory->owner_id);
+ factory->owner_id = 0;
+ }
+
g_hash_table_remove (factories, factory->factory_id);
if (g_hash_table_size (factories) == 0) {
@@ -295,7 +309,7 @@ mate_panel_applet_factory_register_service (MatePanelAppletFactory *factory)
gchar *service_name;
service_name = g_strdup_printf (MATE_PANEL_APPLET_FACTORY_SERVICE_NAME, factory->factory_id);
- g_bus_own_name (G_BUS_TYPE_SESSION,
+ factory->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
service_name,
G_BUS_NAME_OWNER_FLAGS_NONE,
(GBusAcquiredCallback) on_bus_acquired,