aboutsummaryrefslogtreecommitdiff
path: root/libindicate
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-02 14:08:55 -0500
committerTed Gould <ted@canonical.com>2009-04-02 14:08:55 -0500
commit6e4299654841510621000077ebd71423db03cde3 (patch)
tree3c065b1231dddc179cec0cd94742a58dfed3c23a /libindicate
parentaa7ec589d72a17e99288c0ef3efe3d352dd592dd (diff)
downloadlibayatana-indicator-6e4299654841510621000077ebd71423db03cde3.tar.gz
libayatana-indicator-6e4299654841510621000077ebd71423db03cde3.tar.bz2
libayatana-indicator-6e4299654841510621000077ebd71423db03cde3.zip
Fleshing out the interest setting and removing functions.
Diffstat (limited to 'libindicate')
-rw-r--r--libindicate/server.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/libindicate/server.c b/libindicate/server.c
index 3a8907c..a121984 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -407,24 +407,75 @@ get_next_id (IndicateServer * server)
static gboolean
show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest)
{
+ IndicateServerInterestedFolk localfolk;
+ localfolk.sender = sender;
+ IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
- return FALSE;
+ GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal);
+ IndicateServerInterestedFolk * folkpointer = NULL;
+ if (entry == NULL) {
+ folkpointer = g_new(IndicateServerInterestedFolk, 1);
+ indicate_server_interested_folks_init(folkpointer);
+ priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer);
+ } else {
+ folkpointer = (IndicateServerInterestedFolk *)entry->data;
+ }
+
+ indicate_server_interested_folk_set(folkpointer, interest, TRUE);
+ if (!priv->interests[interest]) {
+ g_signal_emit(G_OBJECT(server), signals[INTEREST_ADDED], 0, interest, TRUE);
+ priv->interests[interest] = TRUE;
+ }
+
+ return TRUE;
}
static gboolean
remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest)
{
+ IndicateServerInterestedFolk localfolk;
+ localfolk.sender = sender;
- return FALSE;
+ IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
+
+ GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal);
+ IndicateServerInterestedFolk * folkpointer = NULL;
+ if (entry == NULL) {
+ folkpointer = g_new(IndicateServerInterestedFolk, 1);
+ indicate_server_interested_folks_init(folkpointer);
+ priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer);
+ } else {
+ folkpointer = (IndicateServerInterestedFolk *)entry->data;
+ }
+
+ indicate_server_interested_folk_set(folkpointer, interest, FALSE);
+
+ if (priv->interests[interest]) {
+ guint i;
+ for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) {
+ priv->interests[i] = FALSE;
+ }
+
+ GList * listi = NULL;
+ for (listi = priv->interestedfolks ; listi != NULL ; listi = listi->next) {
+ folkpointer = (IndicateServerInterestedFolk *)listi->data;
+ inkscape_server_interested_folk_copy(folkpointer, priv->interests);
+ }
+
+ if (!priv->interests[interest]) {
+ g_signal_emit(G_OBJECT(server), signals[INTEREST_REMOVED], 0, interest, TRUE);
+ }
+ }
+
+ return TRUE;
}
static gboolean
check_interest (IndicateServer * server, IndicateInterests intrest)
{
-
-
- return FALSE;
+ IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server);
+ return priv->interests[interest];
}
static void