2 * empathy-roster-model.c
4 * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "empathy-roster-model.h"
24 G_DEFINE_INTERFACE (EmpathyRosterModel, empathy_roster_model, G_TYPE_OBJECT)
29 SIG_INDIVIDUAL_REMOVED,
33 static guint signals[LAST_SIGNAL];
36 empathy_roster_model_default_init (EmpathyRosterModelInterface *iface)
38 signals[SIG_INDIVIDUAL_ADDED] =
39 g_signal_new ("individual-added",
40 EMPATHY_TYPE_ROSTER_MODEL,
44 FOLKS_TYPE_INDIVIDUAL);
46 signals[SIG_INDIVIDUAL_REMOVED] =
47 g_signal_new ("individual-removed",
48 EMPATHY_TYPE_ROSTER_MODEL,
52 FOLKS_TYPE_INDIVIDUAL);
55 /***** Restricted *****/
58 empathy_roster_model_fire_individual_added (EmpathyRosterModel *self,
59 FolksIndividual *individual)
61 g_signal_emit (self, signals[SIG_INDIVIDUAL_ADDED], 0, individual);
65 empathy_roster_model_fire_individual_removed (EmpathyRosterModel *self,
66 FolksIndividual *individual)
68 g_signal_emit (self, signals[SIG_INDIVIDUAL_REMOVED], 0, individual);
74 empathy_roster_model_get_individuals (EmpathyRosterModel *self)
76 EmpathyRosterModelInterface *iface;
78 g_return_val_if_fail (EMPATHY_IS_ROSTER_MODEL (self), NULL);
80 iface = EMPATHY_ROSTER_MODEL_GET_IFACE (self);
81 g_return_val_if_fail (iface->get_individuals != NULL, NULL);
83 return (* iface->get_individuals) (self);