diff options
author | Ted Gould <ted@canonical.com> | 2009-02-09 10:58:05 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-02-09 10:58:05 -0600 |
commit | eb7ca97f4b466902ac2040f1241badb7ecaa3c84 (patch) | |
tree | e3bddfd5d81b72765dd3d104b717a6e41eb316f0 | |
parent | d7d703649e0ff4e505c3637582e89f1b07e58263 (diff) | |
download | libayatana-indicator-eb7ca97f4b466902ac2040f1241badb7ecaa3c84.tar.gz libayatana-indicator-eb7ca97f4b466902ac2040f1241badb7ecaa3c84.tar.bz2 libayatana-indicator-eb7ca97f4b466902ac2040f1241badb7ecaa3c84.zip |
Some formatting, reusing the private variable, making it so that hide sends the type and only sending a message of finalize if we're still visible.
-rw-r--r-- | libindicate/server.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libindicate/server.c b/libindicate/server.c index 84f7562..7daedc7 100644 --- a/libindicate/server.c +++ b/libindicate/server.c @@ -40,7 +40,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct _IndicateServerPrivate IndicateServerPrivate; struct _IndicateServerPrivate { - DBusGConnection *connection; + DBusGConnection *connection; gchar * path; GSList * indicators; gboolean visible; @@ -176,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); @@ -262,13 +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); - priv->connection = connection; - - dbus_g_connection_register_g_object(connection, + dbus_g_connection_register_g_object(priv->connection, priv->path, G_OBJECT(server)); priv->visible = TRUE; @@ -287,12 +285,12 @@ indicate_server_hide (IndicateServer * server) if (priv->visible) return; - priv->visible = FALSE; + priv->visible = FALSE; - g_signal_emit(server, signals[SERVER_HIDE], 0, "", TRUE); + g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); dbus_g_connection_unref (priv->connection); - priv->connection = NULL; + priv->connection = NULL; return; } |