aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-04-18 11:13:03 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-04-18 11:13:03 -0500
commit67218e58889b101ceb5a50bcb40c37045fb2855d (patch)
treeba37f8f02116e8b2aefa23bf2be0509d53367e6a /src/service.c
parentd79745bdb2e9bbd02e162a5209de9f227d1dbbc3 (diff)
downloadayatana-indicator-session-67218e58889b101ceb5a50bcb40c37045fb2855d.tar.gz
ayatana-indicator-session-67218e58889b101ceb5a50bcb40c37045fb2855d.tar.bz2
ayatana-indicator-session-67218e58889b101ceb5a50bcb40c37045fb2855d.zip
indicator-session-service should exit when it loses ownership of its name on the bus.
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/service.c b/src/service.c
index 2a10290..bcd88ff 100644
--- a/src/service.c
+++ b/src/service.c
@@ -37,6 +37,15 @@ G_DEFINE_TYPE (IndicatorSessionService,
indicator_session_service,
G_TYPE_OBJECT)
+/* signals enum */
+enum
+{
+ NAME_LOST,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
enum
{
PROP_0,
@@ -910,9 +919,13 @@ on_name_lost (GDBusConnection * connection G_GNUC_UNUSED,
const gchar * name,
gpointer gself)
{
+ IndicatorSessionService * self = INDICATOR_SESSION_SERVICE (gself);
+
g_debug ("%s %s name lost %s", G_STRLOC, G_STRFUNC, name);
- unexport (INDICATOR_SESSION_SERVICE (gself));
+ unexport (self);
+
+ g_signal_emit (self, signals[NAME_LOST], 0, NULL);
}
/***
@@ -1133,6 +1146,14 @@ indicator_session_service_class_init (IndicatorSessionServiceClass * klass)
g_type_class_add_private (klass, sizeof (IndicatorSessionServicePrivate));
+ signals[NAME_LOST] = g_signal_new (INDICATOR_SESSION_SERVICE_SIGNAL_NAME_LOST,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicatorSessionServiceClass, name_lost),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
properties[PROP_0] = NULL;
properties[PROP_REPLACE] = g_param_spec_boolean ("replace",