aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-05-08 19:00:52 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-05-18 23:17:28 +0800
commit8966178abf5d90f7a3260688f5c490c8ed80b56c (patch)
tree8e08f7793f61bd5c377f7ee16b4aca2f30236a64
parent567c6f977d72adfc6f2a4d07311d1403bbb51d0c (diff)
downloadgsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar.gz
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar.bz2
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar.lz
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar.xz
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.tar.zst
gsoc2013-empathy-8966178abf5d90f7a3260688f5c490c8ed80b56c.zip
Show an audio and a video call button
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c24
-rw-r--r--libempathy-gtk/empathy-contact-list-store.h3
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c84
-rw-r--r--libempathy-gtk/empathy-images.h1
4 files changed, 96 insertions, 16 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 5e26a506b..a264d9ff7 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -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);
}
diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h
index e3ed1958a..13ea099b3 100644
--- a/libempathy-gtk/empathy-contact-list-store.h
+++ b/libempathy-gtk/empathy-contact-list-store.h
@@ -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;
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index a88e34bca..9e73f4e6b 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -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,15 +640,32 @@ 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,
gboolean is_group,
@@ -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,
@@ -733,6 +752,33 @@ contact_list_view_voip_cell_data_func (GtkTreeViewColumn *tree_column,
}
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,
GtkTreeModel *model,
@@ -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 */
diff --git a/libempathy-gtk/empathy-images.h b/libempathy-gtk/empathy-images.h
index f7b7f75f9..c714f047d 100644
--- a/libempathy-gtk/empathy-images.h
+++ b/libempathy-gtk/empathy-images.h
@@ -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"