[gnome-panel/wip/gnome-3.10+] libpanel-applet: unown bus name and unregister dbus object
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/gnome-3.10+] libpanel-applet: unown bus name and unregister dbus object
- Date: Tue, 2 Sep 2014 20:02:44 +0000 (UTC)
commit 4cc44248050cf2603e2a5c9185c7a63704529e3e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Sep 2 22:17:01 2014 +0300
libpanel-applet: unown bus name and unregister dbus object
https://bugzilla.gnome.org/show_bug.cgi?id=692610
libpanel-applet/panel-applet-factory.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/libpanel-applet/panel-applet-factory.c b/libpanel-applet/panel-applet-factory.c
index 7e8895c..57ac8f4 100644
--- a/libpanel-applet/panel-applet-factory.c
+++ b/libpanel-applet/panel-applet-factory.c
@@ -28,6 +28,10 @@ struct _PanelAppletFactory {
guint n_applets;
GType applet_type;
GClosure *closure;
+
+ GDBusConnection *connection;
+ gint owner_id;
+ gint registration_id;
};
struct _PanelAppletFactoryClass {
@@ -44,6 +48,16 @@ panel_applet_factory_finalize (GObject *object)
{
PanelAppletFactory *factory = 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;
+ }
+
if (factory->factory_id) {
g_free (factory->factory_id);
factory->factory_id = NULL;
@@ -218,7 +232,8 @@ on_bus_acquired (GDBusConnection *connection,
if (!introspection_data)
introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
object_path = g_strdup_printf (PANEL_APPLET_FACTORY_OBJECT_PATH, factory->factory_id);
- g_dbus_connection_register_object (connection,
+ factory->connection = connection;
+ factory->registration_id = g_dbus_connection_register_object (connection,
object_path,
introspection_data->interfaces[0],
&interface_vtable,
@@ -246,7 +261,7 @@ panel_applet_factory_register_service (PanelAppletFactory *factory)
gchar *service_name;
service_name = g_strdup_printf (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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]