diff options
author | Ted Gould <ted@canonical.com> | 2009-02-09 11:33:03 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-02-09 11:33:03 -0600 |
commit | 42e990fe99a727db4a9e6c00a82212cc8733eef7 (patch) | |
tree | 26dc55956d988247ab66ede8c43c9777dafa8f24 /libindicate/server.c | |
parent | af60279179c1e3998796d3b172b1401bd9a678df (diff) | |
parent | 9d73c89bcac7a548614815c183295ee802fd27d7 (diff) | |
download | libayatana-indicator-42e990fe99a727db4a9e6c00a82212cc8733eef7.tar.gz libayatana-indicator-42e990fe99a727db4a9e6c00a82212cc8733eef7.tar.bz2 libayatana-indicator-42e990fe99a727db4a9e6c00a82212cc8733eef7.zip |
Merge from trunk
Diffstat (limited to 'libindicate/server.c')
-rw-r--r-- | libindicate/server.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/libindicate/server.c b/libindicate/server.c index f5bd0bb..7daedc7 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -40,6 +40,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct _IndicateServerPrivate IndicateServerPrivate; struct _IndicateServerPrivate { + DBusGConnection *connection; gchar * path; GSList * indicators; gboolean visible; @@ -175,7 +176,9 @@ indicate_server_finalize (GObject * obj) IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); /* TODO: This probably shouldn't be as far down as finalize, but it's fine here. */ - g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); + if (priv->visible) { + g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); + } if (priv->path) { g_free(priv->path); @@ -261,11 +264,9 @@ indicate_server_show (IndicateServer * server) if (priv->visible) return; - DBusGConnection * connection; - - connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - dbus_g_connection_register_g_object(connection, + dbus_g_connection_register_g_object(priv->connection, priv->path, G_OBJECT(server)); priv->visible = TRUE; @@ -275,6 +276,25 @@ indicate_server_show (IndicateServer * server) return; } +void +indicate_server_hide (IndicateServer * server) +{ + g_return_if_fail(INDICATE_IS_SERVER(server)); + IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); + + if (priv->visible) + return; + + priv->visible = FALSE; + + g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); + + dbus_g_connection_unref (priv->connection); + priv->connection = NULL; + + return; +} + static guint get_next_id (IndicateServer * server) { |