aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-02 13:34:40 -0500
committerTed Gould <ted@canonical.com>2009-04-02 13:34:40 -0500
commitf94b485955374f9ef6c4cb8521f610711edf54ad (patch)
tree3cb7d28993d9d81de479d336ef413d33e8d6e108
parent1212c8e00290669f251067fb22ccf7f16f4719df (diff)
downloadlibayatana-indicator-f94b485955374f9ef6c4cb8521f610711edf54ad.tar.gz
libayatana-indicator-f94b485955374f9ef6c4cb8521f610711edf54ad.tar.bz2
libayatana-indicator-f94b485955374f9ef6c4cb8521f610711edf54ad.zip
Adding in folks support.
-rw-r--r--libindicate/interests.h2
-rw-r--r--libindicate/server.c62
2 files changed, 63 insertions, 1 deletions
diff --git a/libindicate/interests.h b/libindicate/interests.h
index 5733199..70c52d9 100644
--- a/libindicate/interests.h
+++ b/libindicate/interests.h
@@ -42,7 +42,7 @@ enum _IndicateInterests {
INDICATE_INTEREST_INDICATOR_DISPLAY, /**< Displays indicators to the user */
INDICATE_INTEREST_INDICATOR_SIGNAL, /**< Will return signals based on individual indicators being responded to */
INDICATE_INTEREST_INDICATOR_COUNT, /**< Only displays a count of the indicators */
- INDICATE_INTEREST_INDICATOR_LAST /**< Makes merges and counting easier */
+ INDICATE_INTEREST_LAST /**< Makes merges and counting easier */
};
G_END_DECLS
diff --git a/libindicate/server.c b/libindicate/server.c
index e560ba8..3a8907c 100644
--- a/libindicate/server.c
+++ b/libindicate/server.c
@@ -88,11 +88,20 @@ struct _IndicateServerPrivate
// TODO: Should have a more robust way to track this, but this'll work for now
guint num_hidden;
+
+ gboolean interests[INDICATE_INTEREST_LAST];
+ GList * interestedfolks;
};
#define INDICATE_SERVER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATE_TYPE_SERVER, IndicateServerPrivate))
+typedef struct _IndicateServerInterestedFolk IndicateServerInterestedFolk;
+struct _IndicateServerInterestedFolk {
+ gchar * sender;
+ gboolean interests[INDICATE_INTEREST_LAST];
+};
+
/* Define Type */
G_DEFINE_TYPE (IndicateServer, indicate_server, G_TYPE_OBJECT);
@@ -113,6 +122,10 @@ static void get_property (GObject * obj, guint id, GValue * value, GParamSpec *
static gboolean show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest);
static gboolean remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest);
static gboolean check_interest (IndicateServer * server, IndicateInterests intrest);
+static gint indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b);
+static void indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk);
+static void indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value);
+static void indicate_server_interested_folks_copy (IndicateServerInterestedFolk * folk, gboolean * interests);
/* DBus API */
gboolean indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error);
@@ -247,6 +260,13 @@ indicate_server_init (IndicateServer * server)
priv->type = NULL;
priv->desktop = NULL;
+ guint i;
+ for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) {
+ priv->interests[i] = FALSE;
+ }
+ priv->interestedfolks = NULL;
+
+
return;
}
@@ -1060,3 +1080,45 @@ indicate_server_emit_server_display (IndicateServer *server)
g_signal_emit(server, signals[SERVER_DISPLAY], 0, TRUE);
}
+
+/* *** Folks stuff *** */
+
+static gint
+indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b)
+{
+ return g_strcmp0(((IndicateServerInterestedFolk *)a)->sender,((IndicateServerInterestedFolk *)b)->sender);
+}
+
+static void
+indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk)
+{
+ folk->sender = NULL;
+
+ guint i;
+ for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) {
+ folk->interests[i] = FALSE;
+ }
+
+ return;
+}
+
+static void
+indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value)
+{
+ folk->interests[interest] = value;
+ return;
+}
+
+static void
+indicate_server_interested_folks_copy (IndicateServerInterestedFolk * folk, gboolean * interests)
+{
+ guint i;
+ for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) {
+ if (folk->interests[i]) {
+ interests[i] = TRUE;
+ }
+ }
+
+ return;
+}
+/* *** End Folks *** */