aboutsummaryrefslogtreecommitdiff
path: root/libindicate/server.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-06 21:42:16 -0500
committerTed Gould <ted@canonical.com>2009-04-06 21:42:16 -0500
commit42492db6a41dc304820d744470f86644765b0aa9 (patch)
tree2c2f211673aef2f17b72457a364088427eaf3919 /libindicate/server.c
parent06dd63a32f54e72796baa64a28438b5d839ccff2 (diff)
downloadlibayatana-indicator-42492db6a41dc304820d744470f86644765b0aa9.tar.gz
libayatana-indicator-42492db6a41dc304820d744470f86644765b0aa9.tar.bz2
libayatana-indicator-42492db6a41dc304820d744470f86644765b0aa9.zip
* Some debug messages
* Making the comparison of interests detect changings properly * Correctly use g_list_remove in several cases making for long lists * Using g_list_prepend instead of append because it's faster. * Checking whether we've got proxies before destroying them.
Diffstat (limited to 'libindicate/server.c')
-rw-r--r--libindicate/server.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/libindicate/server.c b/libindicate/server.c
index 004c386..520d47c 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -419,9 +419,15 @@ indicate_server_hide (IndicateServer * server)
g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE);
- g_object_unref(G_OBJECT(priv->dbus_proxy));
- dbus_g_connection_unref (priv->connection);
- priv->connection = NULL;
+ if (priv->dbus_proxy != NULL) {
+ g_object_unref(G_OBJECT(priv->dbus_proxy));
+ priv->dbus_proxy = NULL;
+ }
+
+ if (priv->connection != NULL) {
+ dbus_g_connection_unref (priv->connection);
+ priv->connection = NULL;
+ }
return;
}
@@ -429,13 +435,13 @@ indicate_server_hide (IndicateServer * server)
static void
dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateServer * server)
{
- /* g_debug("DBus Owner change (%s, %s, %s)", name, prev, new); */
+ g_debug("DBus Owner change (%s, %s, %s)", name, prev, new);
if (prev == NULL || prev[0] == '\0') {
/* We only care about people leaving the bus */
return;
}
- /* g_debug("\tBeing removed, interesting"); */
+ g_debug("\tBeing removed, interesting");
IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
IndicateServerInterestedFolk searchitem;
@@ -443,7 +449,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c
GList * entry = g_list_find_custom(priv->interestedfolks, &searchitem, indicate_server_interested_folks_equal);
if (entry == NULL) {
- /* g_debug("\tWe don't have it, not interesting"); */
+ g_debug("\tWe don't have it, not interesting");
return;
}
@@ -458,16 +464,16 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c
GList * listi = NULL;
for (listi = priv->interestedfolks ; listi != NULL ; listi = listi->next) {
IndicateServerInterestedFolk * folkpointer = (IndicateServerInterestedFolk *)listi->data;
- /* g_debug("\tRebuild list from folk: %s", folkpointer->sender); */
+ g_debug("\tRebuild list from folk: %s", folkpointer->sender);
indicate_server_interested_folks_copy(folkpointer, priv->interests);
}
for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) {
- /* g_debug("\tComparing interests. Interest: %d Folk: %d Everyone: %d", i, folk->interests[i], priv->interests[i]); */
- if (folk->interests[i] != priv->interests[i]) {
+ g_debug("\tComparing interests. Interest: %d Folk: %d Everyone: %d", i, folk->interests[i], priv->interests[i]);
+ if (folk->interests[i] && !priv->interests[i]) {
/* We can only remove interest here. Think about it for a
moment and I think you'll be cool with it. */
- /* g_debug("\tOh, and it was interested in %d. Not anymore.", i); */
+ g_debug("\tOh, and it was interested in %d. Not anymore.", i);
g_signal_emit(G_OBJECT(server), signals[INTEREST_REMOVED], 0, i, TRUE);
}
}