[empathy] implement empathy_tp_chat_add as a method on TpChat



commit b659326acbfa02dab74fd88511673af0ddea81e6
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Apr 10 13:15:07 2012 +0200

    implement empathy_tp_chat_add as a method on TpChat
    
    We want to get rid of the EmpathyContactList interface.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673821

 libempathy-gtk/empathy-individual-menu.c |    3 +--
 libempathy/empathy-tp-chat.c             |    7 ++-----
 libempathy/empathy-tp-chat.h             |    4 ++++
 src/empathy-chat-window.c                |    5 ++---
 4 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index 22d3148..478170f 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -1560,8 +1560,7 @@ room_sub_menu_activate_cb (GtkWidget *item,
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
   /* send invitation */
-  empathy_contact_list_add (EMPATHY_CONTACT_LIST (chat),
-      contact, _("Inviting you to this room"));
+  empathy_tp_chat_add (chat, contact, _("Inviting you to this room"));
 
 out:
   g_object_unref (contact);
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index f3a3aa8..28c0e2a 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -157,12 +157,11 @@ create_conference_cb (GObject *source,
     }
 }
 
-static void
-tp_chat_add (EmpathyContactList *list,
+void
+empathy_tp_chat_add (EmpathyTpChat *self,
     EmpathyContact *contact,
     const gchar *message)
 {
-  EmpathyTpChat *self = (EmpathyTpChat *) list;
   TpChannel *channel = (TpChannel *) self;
 
   if (tp_proxy_has_interface_by_id (self,
@@ -171,7 +170,6 @@ tp_chat_add (EmpathyContactList *list,
       TpHandle handle;
       GArray handles = {(gchar *) &handle, 1};
 
-      g_return_if_fail (EMPATHY_IS_TP_CHAT (list));
       g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
       handle = empathy_contact_get_handle (contact);
@@ -1326,7 +1324,6 @@ empathy_tp_chat_init (EmpathyTpChat *self)
 static void
 tp_chat_iface_init (EmpathyContactListIface *iface)
 {
-  iface->add = tp_chat_add;
   iface->remove = tp_chat_remove;
   iface->get_members = tp_chat_get_members;
 }
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 7da675c..adb2ee1 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -103,6 +103,10 @@ TpChannelChatState empathy_tp_chat_get_chat_state (EmpathyTpChat *chat,
 
 EmpathyContact * empathy_tp_chat_get_self_contact (EmpathyTpChat *self);
 
+void empathy_tp_chat_add (EmpathyTpChat *self,
+    EmpathyContact *contact,
+    const gchar *message);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_TP_CHAT_H__ */
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index ac3584f..0d49fcb 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -1188,8 +1188,7 @@ chat_window_invite_participant_activate_cb (GtkAction         *action,
 
 		contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
-		empathy_contact_list_add (EMPATHY_CONTACT_LIST (tp_chat),
-				contact, _("Inviting you to this room"));
+		empathy_tp_chat_add (tp_chat, contact, _("Inviting you to this room"));
 
 		g_object_unref (contact);
 	}
@@ -2045,7 +2044,7 @@ drag_data_received_individual_id (EmpathyChatWindow *self,
 			tp_channel_get_identifier ((TpChannel *) chat));
 
 	contact = empathy_contact_dup_from_tp_contact (tp_contact);
-	empathy_contact_list_add (EMPATHY_CONTACT_LIST (chat), contact, NULL);
+	empathy_tp_chat_add (chat, contact, NULL);
 	g_object_unref (contact);
 
 out:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]