[Telepathy-commits] [telepathy-sofiasip/master] Simplify the media factory code by exporting channel's add_member override

Mikhail Zabaluev mikhail.zabaluev at nokia.com
Thu Oct 16 05:12:00 PDT 2008


---
 src/media-factory.c     |   12 ++----------
 src/sip-media-channel.c |   16 ++++++----------
 src/sip-media-channel.h |   10 +++++++---
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/src/media-factory.c b/src/media-factory.c
index ca01b3a..1e1d3d7 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -313,18 +313,10 @@ tpsip_media_factory_new_channel (TpsipMediaFactory *fac,
 
   if (handle_type == TP_HANDLE_TYPE_CONTACT && handle != creator)
     {
-      GArray *contacts;
-      gboolean added;
-
       g_assert (creator == conn->self_handle);
 
-      contacts = g_array_sized_new (FALSE, FALSE, sizeof (TpHandle), 1);
-      g_array_append_val (contacts, handle);
-      added = tp_group_mixin_add_members (G_OBJECT (chan),
-                                          contacts,
-                                          "", error); 
-      g_array_free (contacts, TRUE);
-      if (!added)
+      if (!_tpsip_media_channel_add_member ((GObject *) chan,
+               handle, "", error))
         goto err;
     }
 
diff --git a/src/sip-media-channel.c b/src/sip-media-channel.c
index 3ad2627..6fc3f4a 100644
--- a/src/sip-media-channel.c
+++ b/src/sip-media-channel.c
@@ -221,10 +221,6 @@ static void priv_destroy_session(TpsipMediaChannel *channel);
 static void priv_outbound_call (TpsipMediaChannel *channel,
                                 TpHandle peer);
 
-static gboolean tpsip_media_channel_add_member (GObject *iface,
-                                              TpHandle handle,
-                                              const gchar *message,
-                                              GError **error);
 static gboolean tpsip_media_channel_remove_with_reason (
                                                  GObject *iface,
                                                  TpHandle handle,
@@ -339,7 +335,7 @@ tpsip_media_channel_class_init (TpsipMediaChannelClass *klass)
 
   tp_group_mixin_class_init (object_class,
                              G_STRUCT_OFFSET (TpsipMediaChannelClass, group_class),
-                             tpsip_media_channel_add_member,
+                             _tpsip_media_channel_add_member,
                              NULL);
   tp_group_mixin_class_set_remove_with_reason_func(object_class,
                              tpsip_media_channel_remove_with_reason);
@@ -1392,11 +1388,11 @@ priv_outbound_call (TpsipMediaChannel *channel,
   g_assert (priv->session != NULL);
 }
 
-static gboolean
-tpsip_media_channel_add_member (GObject *iface,
-                                TpHandle handle,
-                                const gchar *message,
-                                GError **error)
+gboolean
+_tpsip_media_channel_add_member (GObject *iface,
+                                 TpHandle handle,
+                                 const gchar *message,
+                                 GError **error)
 {
   TpsipMediaChannel *self = TPSIP_MEDIA_CHANNEL (iface);
   TpsipMediaChannelPrivate *priv = TPSIP_MEDIA_CHANNEL_GET_PRIVATE (self);
diff --git a/src/sip-media-channel.h b/src/sip-media-channel.h
index 221d973..90e822d 100644
--- a/src/sip-media-channel.h
+++ b/src/sip-media-channel.h
@@ -65,13 +65,17 @@ GType tpsip_media_channel_get_type(void);
 #define TPSIP_MEDIA_CHANNEL_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), TPSIP_TYPE_MEDIA_CHANNEL, TpsipMediaChannelClass))
 
-
-void tpsip_media_channel_close (TpsipMediaChannel *self);
-
 /***********************************************************************
  * Additional declarations (not based on generated templates)
  ***********************************************************************/
 
+void tpsip_media_channel_close (TpsipMediaChannel *self);
+
+gboolean _tpsip_media_channel_add_member (GObject *iface,
+                                          TpHandle handle,
+                                          const gchar *message,
+                                          GError **error);
+
 void tpsip_media_channel_receive_invite (TpsipMediaChannel *self,
                                          nua_handle_t *nh);
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list