]> git.0d.be Git - empathy.git/commitdiff
Show an audio and a video call button
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 8 May 2009 11:00:52 +0000 (12:00 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 18 May 2009 15:17:28 +0000 (16:17 +0100)
libempathy-gtk/empathy-contact-list-store.c
libempathy-gtk/empathy-contact-list-store.h
libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-images.h

index 5e26a506b865e67f14cfe176c73053ca168166ab..a264d9ff746f0541926df59b1550a70be85f04ac 100644 (file)
@@ -736,7 +736,8 @@ contact_list_store_setup (EmpathyContactListStore *store)
                                               G_TYPE_BOOLEAN,       /* Is active */
                                               G_TYPE_BOOLEAN,       /* Is online */
                                               G_TYPE_BOOLEAN,       /* Is separator */
-                                              G_TYPE_BOOLEAN};      /* Can VoIP */
+                                              G_TYPE_BOOLEAN,       /* Can make audio calls */
+                                              G_TYPE_BOOLEAN};      /* Can make video calls */
        
        priv = GET_PRIV (store);
 
@@ -870,7 +871,12 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
                                    EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
-                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_AUDIO,
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_VIDEO,
                                    -1);
        }
 
@@ -887,7 +893,12 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
                                    EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
-                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_AUDIO,
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_VIDEO,
                                    -1);
                g_free (l->data);
        }
@@ -1056,7 +1067,12 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE, now_online,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
-                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_AUDIO,
+                                   EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+                                     empathy_contact_get_capabilities (contact) &
+                                       EMPATHY_CAPABILITIES_VIDEO,
                                    -1);
        }
 
index e3ed1958a0aa84540f9b767843bc51aa2b8ba6cd..13ea099b32d72e21bfa7e118082d92a9db79abcc 100644 (file)
@@ -60,7 +60,8 @@ typedef enum {
        EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE,
        EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE,
        EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR,
-       EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP,
+       EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+       EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
        EMPATHY_CONTACT_LIST_STORE_COL_COUNT
 } EmpathyContactListStoreCol;
 
index a88e34bca7addc681916ccf8e898a7d74fdb9c52..9e73f4e6b9fde281c14ae8dd158a30b7652ed7be 100644 (file)
@@ -615,9 +615,10 @@ contact_list_view_row_activated (GtkTreeView       *view,
 }
 
 static void
-contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
-                                    const gchar                    *path_string,
-                                    EmpathyContactListView         *view)
+contact_list_start_voip_call (EmpathyCellRendererActivatable *cell,
+    const gchar                    *path_string,
+    EmpathyContactListView         *view,
+    gboolean with_video)
 {
        EmpathyContactListViewPriv *priv = GET_PRIV (view);
        GtkTreeModel               *model;
@@ -639,14 +640,31 @@ contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
 
        if (contact) {
                EmpathyCallFactory *factory;
-
                factory = empathy_call_factory_get ();
-               empathy_call_factory_new_call (factory, contact);
-
+               empathy_call_factory_new_call_with_streams (factory, contact,
+                       TRUE, with_video);
                g_object_unref (contact);
        }
 }
 
+static void
+contact_list_view_video_call_activated_cb (
+    EmpathyCellRendererActivatable *cell,
+    const gchar                    *path_string,
+    EmpathyContactListView         *view)
+{
+  contact_list_start_voip_call (cell, path_string, view, TRUE);
+}
+
+
+static void
+contact_list_view_audio_call_activated_cb (EmpathyCellRendererActivatable *cell,
+                                    const gchar                    *path_string,
+                                    EmpathyContactListView         *view)
+{
+  contact_list_start_voip_call (cell, path_string, view, FALSE);
+}
+
 static void
 contact_list_view_cell_set_background (EmpathyContactListView *view,
                                       GtkCellRenderer       *cell,
@@ -708,7 +726,8 @@ contact_list_view_pixbuf_cell_data_func (GtkTreeViewColumn     *tree_column,
 }
 
 static void
-contact_list_view_voip_cell_data_func (GtkTreeViewColumn      *tree_column,
+contact_list_view_audio_call_cell_data_func (
+                                      GtkTreeViewColumn      *tree_column,
                                       GtkCellRenderer        *cell,
                                       GtkTreeModel           *model,
                                       GtkTreeIter            *iter,
@@ -721,7 +740,7 @@ contact_list_view_voip_cell_data_func (GtkTreeViewColumn      *tree_column,
        gtk_tree_model_get (model, iter,
                            EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
                            EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, &is_active,
-                           EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, &can_voip,
+                           EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL, &can_voip,
                            -1);
 
        g_object_set (cell,
@@ -732,6 +751,33 @@ contact_list_view_voip_cell_data_func (GtkTreeViewColumn      *tree_column,
        contact_list_view_cell_set_background (view, cell, is_group, is_active);
 }
 
+static void
+contact_list_view_video_call_cell_data_func (
+                                      GtkTreeViewColumn      *tree_column,
+                                      GtkCellRenderer        *cell,
+                                      GtkTreeModel           *model,
+                                      GtkTreeIter            *iter,
+                                      EmpathyContactListView *view)
+{
+       gboolean is_group;
+       gboolean is_active;
+       gboolean can_voip;
+
+       gtk_tree_model_get (model, iter,
+                           EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
+                           EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, &is_active,
+                           EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL, &can_voip,
+                           -1);
+
+       g_object_set (cell,
+                     "visible", !is_group && can_voip,
+                     "icon-name", EMPATHY_IMAGE_VIDEO_CALL,
+                     NULL);
+
+       contact_list_view_cell_set_background (view, cell, is_group, is_active);
+}
+
+
 static void
 contact_list_view_avatar_cell_data_func (GtkTreeViewColumn     *tree_column,
                                         GtkCellRenderer       *cell,
@@ -948,12 +994,28 @@ contact_list_view_setup (EmpathyContactListView *view)
        gtk_tree_view_column_add_attribute (col, cell,
                                            "is_group", EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP);
 
-       /* Voip Capability Icon */
+       /* Audio Call Icon */
+       cell = empathy_cell_renderer_activatable_new ();
+       gtk_tree_view_column_pack_start (col, cell, FALSE);
+       gtk_tree_view_column_set_cell_data_func (
+               col, cell,
+               (GtkTreeCellDataFunc) contact_list_view_audio_call_cell_data_func,
+               view, NULL);
+
+       g_object_set (cell,
+                     "visible", FALSE,
+                     NULL);
+
+       g_signal_connect (cell, "path-activated",
+                         G_CALLBACK (contact_list_view_audio_call_activated_cb),
+                         view);
+
+       /* Video Call Icon */
        cell = empathy_cell_renderer_activatable_new ();
        gtk_tree_view_column_pack_start (col, cell, FALSE);
        gtk_tree_view_column_set_cell_data_func (
                col, cell,
-               (GtkTreeCellDataFunc) contact_list_view_voip_cell_data_func,
+               (GtkTreeCellDataFunc) contact_list_view_video_call_cell_data_func,
                view, NULL);
 
        g_object_set (cell,
@@ -961,7 +1023,7 @@ contact_list_view_setup (EmpathyContactListView *view)
                      NULL);
 
        g_signal_connect (cell, "path-activated",
-                         G_CALLBACK (contact_list_view_voip_activated_cb),
+                         G_CALLBACK (contact_list_view_video_call_activated_cb),
                          view);
 
        /* Avatar */
index f7b7f75f9a1eeeb9f3ffa716d8384de68124e663..c714f047da60ee130dbddecccb658473c7aa2f04 100644 (file)
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
 #define EMPATHY_IMAGE_CONTACT_INFORMATION "gtk-info"
 #define EMPATHY_IMAGE_GROUP_MESSAGE       "system-users"
 #define EMPATHY_IMAGE_VOIP                "audio-input-microphone"
+#define EMPATHY_IMAGE_VIDEO_CALL          "camera-web"
 #define EMPATHY_IMAGE_LOG                 "document-open-recent"
 #define EMPATHY_IMAGE_DOCUMENT_SEND       "document-send"