]> git.0d.be Git - empathy.git/commitdiff
implement empathy_tp_chat_get_members as a method on TpChat
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 10 Apr 2012 11:15:07 +0000 (13:15 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 10 Apr 2012 11:31:49 +0000 (13:31 +0200)
That means EmpathyTpChat doesn't have to implement the EmpathyContactList
interface any more.

https://bugzilla.gnome.org/show_bug.cgi?id=673821

libempathy-gtk/empathy-chat.c
libempathy/empathy-tp-chat.c
libempathy/empathy-tp-chat.h
src/empathy-invite-participant-dialog.c

index 14404bfe32392c4be62cab558c6ca9e0bd3d7697..6dd3733d06c652ff313b7566be8322108bdc96c5 100644 (file)
@@ -2012,7 +2012,7 @@ chat_input_key_press_event_cb (GtkWidget   *widget,
                }
                is_start_of_buffer = gtk_text_iter_is_start (&start);
 
-               list = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (priv->tp_chat));
+               list = empathy_tp_chat_get_members (priv->tp_chat);
                g_completion_add_items (priv->completion, list);
 
                nick = gtk_text_buffer_get_text (buffer, &start, &current, FALSE);
index b13d097dda590429baed1fb6be0eb33ce8984bfe..4daac8c53a9ca412edde9cdd207f17b3df17676f 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "empathy-tp-chat.h"
 #include "empathy-tp-contact-factory.h"
-#include "empathy-contact-list.h"
 #include "empathy-request-util.h"
 #include "empathy-time.h"
 #include "empathy-utils.h"
@@ -65,8 +64,6 @@ struct _EmpathyTpChatPrivate
   GSimpleAsyncResult *ready_result;
 };
 
-static void tp_chat_iface_init (EmpathyContactListIface *iface);
-
 enum
 {
   PROP_0,
@@ -89,9 +86,7 @@ enum
 
 static guint signals[LAST_SIGNAL];
 
-G_DEFINE_TYPE_WITH_CODE (EmpathyTpChat, empathy_tp_chat, TP_TYPE_TEXT_CHANNEL,
-       G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_CONTACT_LIST,
-            tp_chat_iface_init));
+G_DEFINE_TYPE (EmpathyTpChat, empathy_tp_chat, TP_TYPE_TEXT_CHANNEL)
 
 static void
 tp_chat_set_delivery_status (EmpathyTpChat *self,
@@ -216,14 +211,11 @@ empathy_tp_chat_add (EmpathyTpChat *self,
     }
 }
 
-static GList *
-tp_chat_get_members (EmpathyContactList *list)
+GList *
+empathy_tp_chat_get_members (EmpathyTpChat *self)
 {
-  EmpathyTpChat *self = (EmpathyTpChat *) list;
   GList *members = NULL;
 
-  g_return_val_if_fail (EMPATHY_IS_TP_CHAT (list), NULL);
-
   if (self->priv->members)
     {
       members = g_list_copy (self->priv->members);
@@ -1304,12 +1296,6 @@ empathy_tp_chat_init (EmpathyTpChat *self)
       g_str_hash, g_str_equal, g_free, NULL);
 }
 
-static void
-tp_chat_iface_init (EmpathyContactListIface *iface)
-{
-  iface->get_members = tp_chat_get_members;
-}
-
 EmpathyTpChat *
 empathy_tp_chat_new (TpSimpleClientFactory *factory,
     TpAccount *account,
index adb2ee1c55f4a7437bbd1753e2b44d4ebbf52170..5aa949ba2e65193e8718754ec2e9ab0eff3677e5 100644 (file)
@@ -107,6 +107,8 @@ void empathy_tp_chat_add (EmpathyTpChat *self,
     EmpathyContact *contact,
     const gchar *message);
 
+GList * empathy_tp_chat_get_members (EmpathyTpChat *self);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_TP_CHAT_H__ */
index fd5bd8f7602f4afe9b3f97434996ac5f6d8bc457..ad3e85a538af87f270c49e80f9bd62e89073f990 100644 (file)
@@ -146,8 +146,7 @@ filter_individual (EmpathyContactChooser *chooser,
     return FALSE;
 
   /* Filter out contacts which are already in the chat */
-  members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (
-        self->priv->tp_chat));
+  members = empathy_tp_chat_get_members (self->priv->tp_chat);
 
   for (l = members; l != NULL; l = g_list_next (l))
     {