1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Copyright (C) 2007 Collabora Ltd.
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
20
* Authors: Xavier Claessens <xclaesse@gmail.com>
25
#include "empathy-contact-list.h"
27
static void contact_list_base_init (gpointer klass);
30
empathy_contact_list_get_type (void)
32
static GType type = 0;
35
static const GTypeInfo type_info = {
36
sizeof (EmpathyContactListIface),
37
contact_list_base_init,
41
type = g_type_register_static (G_TYPE_INTERFACE,
50
contact_list_base_init (gpointer klass)
52
static gboolean initialized = FALSE;
55
g_signal_new ("contact-added",
56
G_TYPE_FROM_CLASS (klass),
60
g_cclosure_marshal_VOID__OBJECT,
62
1, GOSSIP_TYPE_CONTACT);
64
g_signal_new ("contact-removed",
65
G_TYPE_FROM_CLASS (klass),
69
g_cclosure_marshal_VOID__OBJECT,
71
1, GOSSIP_TYPE_CONTACT);
78
empathy_contact_list_setup (EmpathyContactList *list)
80
g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
82
if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->setup) {
83
EMPATHY_CONTACT_LIST_GET_IFACE (list)->setup (list);
88
empathy_contact_list_find (EmpathyContactList *list,
91
g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), NULL);
93
if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->find) {
94
return EMPATHY_CONTACT_LIST_GET_IFACE (list)->find (list, id);
101
empathy_contact_list_add (EmpathyContactList *list,
102
GossipContact *contact,
103
const gchar *message)
105
g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
107
if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->add) {
108
EMPATHY_CONTACT_LIST_GET_IFACE (list)->add (list, contact, message);
113
empathy_contact_list_remove (EmpathyContactList *list,
114
GossipContact *contact,
115
const gchar *message)
117
g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
119
if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove) {
120
EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove (list, contact, message);
125
empathy_contact_list_get_contacts (EmpathyContactList *list)
127
g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), NULL);
129
if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_contacts) {
130
return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_contacts (list);