aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-roster-model.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-04 15:43:05 +0800
committerLaurent Contzen <lcontzen@gmail.com>2012-07-23 15:48:42 +0800
commit2e9ea0fb13d570edeca7161d827d8041298c2134 (patch)
tree88fbe33831f0441e7479919e546f8d9ec80584e0 /libempathy-gtk/empathy-roster-model.c
parentd23e7ebee52c513b98b0b7382a41005c3b084efc (diff)
downloadgsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar.gz
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar.bz2
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar.lz
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar.xz
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.tar.zst
gsoc2013-empathy-2e9ea0fb13d570edeca7161d827d8041298c2134.zip
roster-model: add API to track individuals
Diffstat (limited to 'libempathy-gtk/empathy-roster-model.c')
-rw-r--r--libempathy-gtk/empathy-roster-model.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-roster-model.c b/libempathy-gtk/empathy-roster-model.c
index f8a890aec..ce86e58a6 100644
--- a/libempathy-gtk/empathy-roster-model.c
+++ b/libempathy-gtk/empathy-roster-model.c
@@ -23,7 +23,62 @@
G_DEFINE_INTERFACE (EmpathyRosterModel, empathy_roster_model, G_TYPE_OBJECT)
+enum
+{
+ SIG_INDIVIDUAL_ADDED,
+ SIG_INDIVIDUAL_REMOVED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
static void
empathy_roster_model_default_init (EmpathyRosterModelInterface *iface)
{
+ signals[SIG_INDIVIDUAL_ADDED] =
+ g_signal_new ("individual-added",
+ EMPATHY_TYPE_ROSTER_MODEL,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ FOLKS_TYPE_INDIVIDUAL);
+
+ signals[SIG_INDIVIDUAL_REMOVED] =
+ g_signal_new ("individual-removed",
+ EMPATHY_TYPE_ROSTER_MODEL,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ FOLKS_TYPE_INDIVIDUAL);
+}
+
+/***** Restricted *****/
+
+void
+empathy_roster_model_fire_individual_added (EmpathyRosterModel *self,
+ FolksIndividual *individual)
+{
+ g_signal_emit (self, signals[SIG_INDIVIDUAL_ADDED], 0, individual);
+}
+
+void
+empathy_roster_model_fire_individual_removed (EmpathyRosterModel *self,
+ FolksIndividual *individual)
+{
+ g_signal_emit (self, signals[SIG_INDIVIDUAL_REMOVED], 0, individual);
+}
+
+/***** Public *****/
+
+GList *
+empathy_roster_model_get_individuals (EmpathyRosterModel *self)
+{
+ EmpathyRosterModelInterface *iface;
+
+ g_return_val_if_fail (EMPATHY_IS_ROSTER_MODEL (self), NULL);
+
+ iface = EMPATHY_ROSTER_MODEL_GET_IFACE (self);
+ g_return_val_if_fail (iface->get_individuals != NULL, NULL);
+
+ return (* iface->get_individuals) (self);
}