[gnome-panel/wip/gnome-3.10+: 1/38] 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+: 1/38] libpanel-applet: unown bus name and unregister dbus object
- Date: Wed, 22 Oct 2014 20:04:43 +0000 (UTC)
commit af810796ddeea0c6187e6489c0f5ed782b04bdb1
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]