]> git.0d.be Git - empathy.git/commitdiff
Switch to calling CallFactory to make calls
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Tue, 3 Feb 2009 09:02:46 +0000 (09:02 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 3 Feb 2009 09:02:46 +0000 (09:02 +0000)
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
svn path=/trunk/; revision=2382

libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-new-message-dialog.c
libempathy/empathy-utils.c
libempathy/empathy-utils.h

index 0083102f2e27be98381c00d80d44ab37a6d293fa..b7a6601c6e4b6ca2961377461d46a2f60112f5fe 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <libmissioncontrol/mc-account.h>
 
+#include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-contact-factory.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-groups.h>
@@ -571,7 +572,11 @@ contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
                            -1);
 
        if (contact) {
-               empathy_start_call_with_contact (contact);
+               EmpathyCallFactory *factory;
+
+               factory = empathy_call_factory_get ();
+               empathy_call_factory_new_call (factory, contact);
+
                g_object_unref (contact);
        }
 }
index e3fb3c9f766a6b60015fce20785cb44307a1c12c..ca8208374075b73d07d3450e44e70054274b62f4 100644 (file)
@@ -26,6 +26,7 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
+#include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-log-manager.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-utils.h>
@@ -131,6 +132,16 @@ empathy_contact_chat_menu_item_new (EmpathyContact *contact)
        return item;
 }
 
+static void
+empathy_contact_call_menu_item_activated (GtkMenuItem *item,
+       EmpathyContact *contact)
+{
+       EmpathyCallFactory *factory;
+
+       factory = empathy_call_factory_get ();
+       empathy_call_factory_new_call (factory, contact);
+}
+
 GtkWidget *
 empathy_contact_call_menu_item_new (EmpathyContact *contact)
 {
@@ -146,8 +157,8 @@ empathy_contact_call_menu_item_new (EmpathyContact *contact)
        gtk_widget_set_sensitive (item, empathy_contact_can_voip (contact));
        gtk_widget_show (image);
 
-       g_signal_connect_swapped (item, "activate",
-                                 G_CALLBACK (empathy_start_call_with_contact),
+       g_signal_connect (item, "activate",
+                                 G_CALLBACK (empathy_contact_call_menu_item_activated),
                                  contact);
        
        return item;
index 9127e2919556a87d75eeaea25cf6915fb54f8e73..1db8db1b6bdb28968e830fd487019909e9465111 100644 (file)
@@ -31,6 +31,7 @@
 #include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mission-control.h>
 
+#include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-contact-factory.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-dispatcher.h>
@@ -186,11 +187,15 @@ new_message_dialog_response_cb (GtkWidget               *widget,
        if (response == 1) {
                EmpathyContactFactory *factory;
                EmpathyContact *contact;
+               EmpathyCallFactory *call_factory;
 
                factory = empathy_contact_factory_dup_singleton ();
                contact = empathy_contact_factory_get_from_id (factory, account, id);
                empathy_start_call_with_contact (contact);
 
+               call_factory = empathy_call_factory_get();
+               empathy_call_factory_new_call (call_factory, contact);
+
                g_object_unref (contact);
                g_object_unref (factory);
        } else if (response == 2) {
@@ -307,4 +312,3 @@ empathy_new_message_dialog_show (GtkWindow *parent)
 
        return dialog->dialog;
 }
-
index bda638dffc93ec88b3da0d4b84b425b3d67c27ad..a476d9e54da325cb192dd49737f0e9143710a95c 100644 (file)
@@ -453,37 +453,6 @@ empathy_proxy_equal (gconstpointer a,
               g_str_equal (proxy_a->bus_name, proxy_b->bus_name);
 }
 
-static void
-empathy_call_request_cb (EmpathyDispatchOperation *operation,
-  const GError *error, gpointer user_data)
-{
-  EmpathyContact *contact = EMPATHY_CONTACT (user_data);
-
-  if (error != NULL)
-    {
-      DEBUG ("Failed to request streamed media channel %s",
-        error->message);
-    }
-  else
-    {
-      EmpathyTpCall *call =
-        EMPATHY_TP_CALL (
-          empathy_dispatch_operation_get_channel_wrapper (operation));
-
-      empathy_tp_call_to (call, contact);
-    }
-
-  g_object_unref (contact);
-}
-
-void
-empathy_start_call_with_contact (EmpathyContact *contact)
-{
-  g_object_ref (contact);
-  empathy_dispatcher_call_with_contact (contact, empathy_call_request_cb,
-    contact);
-}
-
 gboolean
 empathy_check_available_state (void)
 {
@@ -495,10 +464,9 @@ empathy_check_available_state (void)
        g_object_unref (idle);
 
        if (presence != MC_PRESENCE_AVAILABLE &&
-           presence != MC_PRESENCE_UNSET) {
+               presence != MC_PRESENCE_UNSET) {
                return FALSE;    
        }
 
        return TRUE;
 }
-
index 46fa193c0a08c64bcd3d217e711844ac9064f82e..8684acc0090d38ca3da8bfe1ee3ec56bbb5d4c49 100644 (file)
@@ -88,9 +88,6 @@ gboolean     empathy_proxy_equal                    (gconstpointer    a,
                                                     gconstpointer    b);
 guint        empathy_proxy_hash                     (gconstpointer    key);
 gboolean     empathy_check_available_state          (void);
-/* Temporary utility function, should be replaces by better voip infrastructure
- * soon */
-void empathy_start_call_with_contact (EmpathyContact *contact);
 
 G_END_DECLS