aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
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
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')
-rw-r--r--libempathy-gtk/empathy-roster-model.c55
-rw-r--r--libempathy-gtk/empathy-roster-model.h14
2 files changed, 69 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);
}
diff --git a/libempathy-gtk/empathy-roster-model.h b/libempathy-gtk/empathy-roster-model.h
index 75b0b1055..e6c382825 100644
--- a/libempathy-gtk/empathy-roster-model.h
+++ b/libempathy-gtk/empathy-roster-model.h
@@ -22,6 +22,8 @@
#include <glib-object.h>
+#include <folks/folks.h>
+
G_BEGIN_DECLS
typedef struct _EmpathyRosterModel EmpathyRosterModel;
@@ -33,6 +35,7 @@ struct _EmpathyRosterModelInterface
GTypeInterface g_iface;
/* Virtual table */
+ GList * (* get_individuals) (EmpathyRosterModel *self);
};
GType empathy_roster_model_get_type (void);
@@ -52,6 +55,17 @@ GType empathy_roster_model_get_type (void);
EMPATHY_TYPE_ROSTER_MODEL, \
EmpathyRosterModelInterface))
+/* Restricted */
+
+void empathy_roster_model_fire_individual_added (EmpathyRosterModel *self,
+ FolksIndividual *individual);
+
+void empathy_roster_model_fire_individual_removed (EmpathyRosterModel *self,
+ FolksIndividual *individual);
+
+/* Public API */
+GList * empathy_roster_model_get_individuals (EmpathyRosterModel *self);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_ROSTER_MODEL_H__*/