]> git.0d.be Git - empathy.git/commitdiff
Adding UI to start a VoIP call. It does nothing yet. Most of the code is
authorXavier Claessens <xclaesse@gmail.com>
Sat, 8 Sep 2007 21:36:53 +0000 (21:36 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sat, 8 Sep 2007 21:36:53 +0000 (21:36 +0000)
2007-09-08  Xavier Claessens  <xclaesse@gmail.com>

* libempathy-gtk/empathy-images.h:
* libempathy-gtk/empathy-chat.glade:
* libempathy-gtk/empathy-contact-list-view.c:
* libempathy-gtk/empathy-contact-list-store.c:
* libempathy-gtk/empathy-contact-list-store.h:
* libempathy-gtk/Makefile.am:
* libempathy-gtk/empathy-chat-window.c:
* libempathy/empathy-contact.c:
* libempathy/empathy-contact.h: Adding UI to start a VoIP call. It does
nothing yet. Most of the code is ported from Gossip patch
(Raphael Slinckx, Xavier Claessens).

svn path=/trunk/; revision=292

ChangeLog
libempathy-gtk/Makefile.am
libempathy-gtk/empathy-chat-window.c
libempathy-gtk/empathy-chat.glade
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
libempathy/empathy-contact.c
libempathy/empathy-contact.h

index 3385d6aa0305fc3a079b0ed205b12291dceae38b..8215a0b452f3f580b8c4c9babbae16d00da44776 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-09-08  Xavier Claessens  <xclaesse@gmail.com>
+
+       * libempathy-gtk/empathy-images.h:
+       * libempathy-gtk/empathy-chat.glade:
+       * libempathy-gtk/empathy-contact-list-view.c:
+       * libempathy-gtk/empathy-contact-list-store.c:
+       * libempathy-gtk/empathy-contact-list-store.h:
+       * libempathy-gtk/Makefile.am:
+       * libempathy-gtk/empathy-chat-window.c:
+       * libempathy/empathy-contact.c:
+       * libempathy/empathy-contact.h: Adding UI to start a VoIP call. It does
+       nothing yet. Most of the code is ported from Gossip patch
+       (Raphael Slinckx, Xavier Claessens).
+
 2007-09-08  Xavier Claessens  <xclaesse@gmail.com>
 
        * libempathy/empathy-contact.c:
index 8e4790e3bdb8e7d31cd1bd7d2c47de78af6b9eb8..a825f4427c20f04f60fa9942dbb1145c5b5fb5e9 100644 (file)
@@ -25,6 +25,7 @@ libempathy_gtk_la_SOURCES =                   \
        empathy-profile-chooser.c               \
        empathy-cell-renderer-expander.c        \
        empathy-cell-renderer-text.c            \
+       empathy-cell-renderer-activatable.c     \
        empathy-spell.c                         \
        empathy-spell-dialog.c                  \
        empathy-contact-groups.c                \
@@ -73,6 +74,7 @@ libempathy_gtk_headers =                      \
        empathy-profile-chooser.h               \
        empathy-cell-renderer-expander.h        \
        empathy-cell-renderer-text.h            \
+       empathy-cell-renderer-activatable.h     \
        empathy-spell.h                         \
        empathy-spell-dialog.h                  \
        empathy-contact-groups.h                \
index 94107e99f8fd6f86b7e57a14ec96c479e5348224..6a2d776f6c3e74cfea7fdb065f8d2e1f22eab219 100644 (file)
@@ -83,6 +83,8 @@ struct _EmpathyChatWindowPriv {
        /* Menu items. */
        GtkWidget             *menu_conv_clear;
        GtkWidget             *menu_conv_insert_smiley;
+       GtkWidget             *menu_conv_call;
+       GtkWidget             *menu_conv_call_separator;
        GtkWidget             *menu_conv_log;
        GtkWidget             *menu_conv_separator;
        GtkWidget             *menu_conv_add_contact;
@@ -138,6 +140,8 @@ static void       chat_window_info_activate_cb          (GtkWidget             *
                                                         EmpathyChatWindow      *window);
 static void       chat_window_add_contact_activate_cb   (GtkWidget             *menuitem,
                                                         EmpathyChatWindow      *window);
+static void       chat_window_call_activate_cb          (GtkWidget             *menuitem,
+                                                        EmpathyChatWindow      *window);
 static void       chat_window_log_activate_cb           (GtkWidget             *menuitem,
                                                         EmpathyChatWindow      *window);
 static void       chat_window_show_contacts_toggled_cb  (GtkWidget             *menuitem,
@@ -287,6 +291,8 @@ empathy_chat_window_init (EmpathyChatWindow *window)
                                       "menu_conv", &menu_conv,
                                       "menu_conv_clear", &priv->menu_conv_clear,
                                       "menu_conv_insert_smiley", &priv->menu_conv_insert_smiley,
+                                      "menu_conv_call", &priv->menu_conv_call,
+                                      "menu_conv_call_separator", &priv->menu_conv_call_separator,
                                       "menu_conv_log", &priv->menu_conv_log,
                                       "menu_conv_separator", &priv->menu_conv_separator,
                                       "menu_conv_add_contact", &priv->menu_conv_add_contact,
@@ -313,6 +319,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
                              "chat_window", "configure-event", chat_window_configure_event_cb,
                              "menu_conv", "activate", chat_window_conv_activate_cb,
                              "menu_conv_clear", "activate", chat_window_clear_activate_cb,
+                             "menu_conv_call", "activate", chat_window_call_activate_cb,
                              "menu_conv_log", "activate", chat_window_log_activate_cb,
                              "menu_conv_add_contact", "activate", chat_window_add_contact_activate_cb,
                              "menu_conv_info", "activate", chat_window_info_activate_cb,
@@ -899,6 +906,24 @@ chat_window_add_contact_activate_cb (GtkWidget        *menuitem,
        // FIXME: empathy_add_contact_dialog_show (NULL, contact);
 }
 
+static void
+chat_window_call_activate_cb (GtkWidget         *menuitem,
+                             EmpathyChatWindow *window)
+{
+       EmpathyChatWindowPriv *priv;
+
+       priv = GET_PRIV (window);
+
+       if (!empathy_chat_is_group_chat (priv->current_chat)) {
+               EmpathyPrivateChat *chat;
+               EmpathyContact     *contact;
+
+               chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
+               contact = empathy_private_chat_get_contact (chat);
+               /* FIXME: Start VoIP */
+       }
+}
+
 static void
 chat_window_log_activate_cb (GtkWidget        *menuitem,
                             EmpathyChatWindow *window)
@@ -974,12 +999,13 @@ chat_window_configure_event_cb (GtkWidget         *widget,
 }
 
 static void
-chat_window_conv_activate_cb (GtkWidget        *menuitem,
+chat_window_conv_activate_cb (GtkWidget         *menuitem,
                              EmpathyChatWindow *window)
 {
        EmpathyChatWindowPriv *priv;
-       EmpathyLogManager    *manager;
+       EmpathyLogManager     *manager;
        gboolean              log_exists = FALSE;
+       gboolean              can_voip = FALSE;
 
        priv = GET_PRIV (window);
 
@@ -990,7 +1016,18 @@ chat_window_conv_activate_cb (GtkWidget        *menuitem,
                                                 empathy_chat_is_group_chat (priv->current_chat));
        g_object_unref (manager);
 
+       if (!empathy_chat_is_group_chat (priv->current_chat)) {
+               EmpathyPrivateChat *chat;
+               EmpathyContact     *contact;
+
+               chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
+               contact = empathy_private_chat_get_contact (chat);
+               can_voip = empathy_contact_can_voip (contact);
+       }
+
        gtk_widget_set_sensitive (priv->menu_conv_log, log_exists);
+       g_object_set (priv->menu_conv_call, "visible", can_voip, NULL);
+       g_object_set (priv->menu_conv_call_separator, "visible", can_voip, NULL);
 }
 
 static void
index d07bf77e6f21269a09287681cb94270d6c2da842..4f6ac4acc74a70fb45fbf36a5d6e5b5a6a797f4d 100644 (file)
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image235">
+                       <widget class="GtkImage" id="image262">
                          <property name="visible">True</property>
                          <property name="stock">gtk-clear</property>
                          <property name="icon_size">1</property>
                  </child>
 
                  <child>
-                   <widget class="GtkSeparatorMenuItem" id="separator11">
+                   <widget class="GtkSeparatorMenuItem" id="separator13">
+                     <property name="visible">True</property>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkImageMenuItem" id="menu_conv_call">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Ca_ll</property>
+                     <property name="use_underline">True</property>
+
+                     <child internal-child="image">
+                       <widget class="GtkImage" id="menu_conv_call_image">
+                         <property name="visible">True</property>
+                         <property name="icon_name">gnome-stock-mic</property>
+                         <property name="icon_size">1</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkSeparatorMenuItem" id="menu_conv_call_separator">
                      <property name="visible">True</property>
                    </widget>
                  </child>
                      <accelerator key="F3" modifiers="0" signal="activate"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image236">
+                       <widget class="GtkImage" id="image263">
                          <property name="visible">True</property>
                          <property name="stock">gtk-justify-left</property>
                          <property name="icon_size">1</property>
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image237">
+                       <widget class="GtkImage" id="image264">
                          <property name="visible">True</property>
                          <property name="stock">gtk-add</property>
                          <property name="icon_size">1</property>
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image238">
+                       <widget class="GtkImage" id="image265">
                          <property name="visible">True</property>
                          <property name="stock">gtk-info</property>
                          <property name="icon_size">1</property>
                      <accelerator key="W" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image239">
+                       <widget class="GtkImage" id="image266">
                          <property name="visible">True</property>
                          <property name="stock">gtk-close</property>
                          <property name="icon_size">1</property>
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image240">
+                       <widget class="GtkImage" id="image267">
                          <property name="visible">True</property>
                          <property name="stock">gtk-new</property>
                          <property name="icon_size">1</property>
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image241">
+                       <widget class="GtkImage" id="image268">
                          <property name="visible">True</property>
                          <property name="stock">gtk-add</property>
                          <property name="icon_size">1</property>
                      <accelerator key="X" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image242">
+                       <widget class="GtkImage" id="image269">
                          <property name="visible">True</property>
                          <property name="stock">gtk-cut</property>
                          <property name="icon_size">1</property>
                      <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image243">
+                       <widget class="GtkImage" id="image270">
                          <property name="visible">True</property>
                          <property name="stock">gtk-copy</property>
                          <property name="icon_size">1</property>
                      <accelerator key="V" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image244">
+                       <widget class="GtkImage" id="image271">
                          <property name="visible">True</property>
                          <property name="stock">gtk-paste</property>
                          <property name="icon_size">1</property>
index 5301bdc76aa6f923908f37af382c4680af8e2c25..81f50c8a690197c1fe8208d3dc66110d8e357a5e 100644 (file)
@@ -613,17 +613,18 @@ static void
 contact_list_store_setup (EmpathyContactListStore *store)
 {
        EmpathyContactListStorePriv *priv;
-       GType                       types[] = {G_TYPE_STRING,       /* Status icon-name */
-                                              GDK_TYPE_PIXBUF,     /* Avatar pixbuf */
-                                              G_TYPE_BOOLEAN,      /* Avatar pixbuf visible */
-                                              G_TYPE_STRING,       /* Name */
-                                              G_TYPE_STRING,       /* Status string */
-                                              G_TYPE_BOOLEAN,      /* Show status */
+       GType                       types[] = {G_TYPE_STRING,        /* Status icon-name */
+                                              GDK_TYPE_PIXBUF,      /* Avatar pixbuf */
+                                              G_TYPE_BOOLEAN,       /* Avatar pixbuf visible */
+                                              G_TYPE_STRING,        /* Name */
+                                              G_TYPE_STRING,        /* Status string */
+                                              G_TYPE_BOOLEAN,       /* Show status */
                                               EMPATHY_TYPE_CONTACT, /* Contact type */
-                                              G_TYPE_BOOLEAN,      /* Is group */
-                                              G_TYPE_BOOLEAN,      /* Is active */
-                                              G_TYPE_BOOLEAN,      /* Is online */
-                                              G_TYPE_BOOLEAN};     /* Is separator */
+                                              G_TYPE_BOOLEAN,       /* Is group */
+                                              G_TYPE_BOOLEAN,       /* Is active */
+                                              G_TYPE_BOOLEAN,       /* Is online */
+                                              G_TYPE_BOOLEAN,       /* Is separator */
+                                              G_TYPE_BOOLEAN};      /* Can VoIP */
        
        priv = GET_PRIV (store);
 
@@ -685,7 +686,7 @@ contact_list_store_members_changed_cb (EmpathyContactList      *list_iface,
                g_signal_connect (contact, "notify::avatar",
                                  G_CALLBACK (contact_list_store_contact_updated_cb),
                                  store);
-               g_signal_connect (contact, "notify::type",
+               g_signal_connect (contact, "notify::capabilities",
                                  G_CALLBACK (contact_list_store_contact_updated_cb),
                                  store);
 
@@ -750,6 +751,7 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
                                    COL_CONTACT, contact,
                                    COL_IS_GROUP, FALSE,
                                    COL_IS_SEPARATOR, FALSE,
+                                   COL_CAN_VOIP, empathy_contact_can_voip (contact),
                                    -1);
        }
 
@@ -766,6 +768,7 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
                                    COL_CONTACT, contact,
                                    COL_IS_GROUP, FALSE,
                                    COL_IS_SEPARATOR, FALSE,
+                                   COL_CAN_VOIP, empathy_contact_can_voip (contact),
                                    -1);
                g_free (l->data);
        }
@@ -934,6 +937,7 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
                                    COL_IS_GROUP, FALSE,
                                    COL_IS_ONLINE, now_online,
                                    COL_IS_SEPARATOR, FALSE,
+                                   COL_CAN_VOIP, empathy_contact_can_voip (contact),
                                    -1);
        }
 
index d096daafd1d8d313a032ff71ba161b38788123f4..44686c8c86be0a3b58aab023e4f950fcb7be2a66 100644 (file)
@@ -67,6 +67,7 @@ enum {
        COL_IS_ACTIVE,
        COL_IS_ONLINE,
        COL_IS_SEPARATOR,
+       COL_CAN_VOIP,
        COL_COUNT
 } EmpathyContactListStoreCol;
 
index 4aeac322d513f1a4c309a08931a331a5cc4b517d..2cadb2201dfc6f4603893126888c4ab3a2ae95be 100644 (file)
@@ -47,6 +47,7 @@
 #include "empathy-contact-groups.h"
 #include "empathy-cell-renderer-expander.h"
 #include "empathy-cell-renderer-text.h"
+#include "empathy-cell-renderer-activatable.h"
 #include "empathy-ui-utils.h"
 #include "empathy-contact-dialogs.h"
 //#include "empathy-chat-invite.h"
@@ -133,7 +134,12 @@ static void        contact_list_view_pixbuf_cell_data_func     (GtkTreeViewColum
                                                                GtkCellRenderer            *cell,
                                                                GtkTreeModel               *model,
                                                                GtkTreeIter                *iter,
-                                                               EmpathyContactListView      *view);
+                                                               EmpathyContactListView     *view);
+static void        contact_list_view_voip_cell_data_func       (GtkTreeViewColumn          *tree_column,
+                                                               GtkCellRenderer            *cell,
+                                                               GtkTreeModel               *model,
+                                                               GtkTreeIter                *iter,
+                                                               EmpathyContactListView     *view);
 static void        contact_list_view_avatar_cell_data_func     (GtkTreeViewColumn          *tree_column,
                                                                GtkCellRenderer            *cell,
                                                                GtkTreeModel               *model,
@@ -151,7 +157,8 @@ static void        contact_list_view_expander_cell_data_func   (GtkTreeViewColum
                                                                EmpathyContactListView      *view);
 static GtkWidget * contact_list_view_get_contact_menu          (EmpathyContactListView      *view,
                                                                gboolean                    can_send_file,
-                                                               gboolean                    can_show_log);
+                                                               gboolean                    can_show_log,
+                                                               gboolean                    can_voip);
 static gboolean    contact_list_view_button_press_event_cb     (EmpathyContactListView      *view,
                                                                GdkEventButton             *event,
                                                                gpointer                    user_data);
@@ -159,6 +166,9 @@ static void        contact_list_view_row_activated_cb          (EmpathyContactLi
                                                                GtkTreePath                *path,
                                                                GtkTreeViewColumn          *col,
                                                                gpointer                    user_data);
+static void        contact_list_view_voip_activated_cb         (EmpathyCellRendererActivatable *cell,
+                                                               const gchar                *path_string,
+                                                               EmpathyContactListView     *view);
 static void        contact_list_view_row_expand_or_collapse_cb (EmpathyContactListView      *view,
                                                                GtkTreeIter                *iter,
                                                                GtkTreePath                *path,
@@ -167,6 +177,8 @@ static void        contact_list_view_action_cb                 (GtkAction
                                                                EmpathyContactListView      *view);
 static void        contact_list_view_action_activated          (EmpathyContactListView      *view,
                                                                EmpathyContact              *contact);
+static void        contact_list_view_voip_activated            (EmpathyContactListView      *view,
+                                                               EmpathyContact              *contact);
 
 enum {
        PROP_0,
@@ -213,6 +225,10 @@ static const GtkActionEntry entries[] = {
          N_("_View Previous Conversations"), NULL, N_("View previous conversations with this contact"),
          G_CALLBACK (contact_list_view_action_cb)
        },
+       { "Call", EMPATHY_IMAGE_VOIP,
+         N_("_Call"), NULL, N_("Start a voice or video conversation with this contact"),
+         G_CALLBACK (contact_list_view_action_cb)
+       },
 };
 
 static guint n_entries = G_N_ELEMENTS (entries);
@@ -221,6 +237,7 @@ static const gchar *ui_info =
        "<ui>"
        "  <popup name='Contact'>"
        "    <menuitem action='Chat'/>"
+       "    <menuitem action='Call'/>"
        "    <menuitem action='Log'/>"
        "    <menuitem action='SendFile'/>"
        "    <separator/>"
@@ -487,11 +504,12 @@ empathy_contact_list_view_get_group_menu (EmpathyContactListView *view)
 
 GtkWidget *
 empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view,
-                                          EmpathyContact         *contact)
+                                           EmpathyContact         *contact)
 {
        EmpathyLogManager *log_manager;
        gboolean           can_show_log;
        gboolean           can_send_file;
+       gboolean           can_voip;
 
        g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view), NULL);
        g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
@@ -501,12 +519,14 @@ empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view,
                                                   empathy_contact_get_account (contact),
                                                   empathy_contact_get_id (contact),
                                                   FALSE);
-       can_send_file = FALSE;
        g_object_unref (log_manager);
+       can_send_file = FALSE;
+       can_voip = empathy_contact_can_voip (contact);
 
        return contact_list_view_get_contact_menu (view,
                                                   can_send_file,
-                                                  can_show_log);
+                                                  can_show_log,
+                                                  can_voip);
 }
 
 static void
@@ -567,6 +587,22 @@ contact_list_view_setup (EmpathyContactListView *view)
        gtk_tree_view_column_add_attribute (col, cell,
                                            "is_group", COL_IS_GROUP);
 
+       /* Voip Capability 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,
+               view, NULL);
+
+       g_object_set (cell,
+                     "visible", FALSE,
+                     NULL);
+
+       g_signal_connect (cell, "path-activated",
+                         G_CALLBACK (contact_list_view_voip_activated_cb),
+                         view);
+
        /* Avatar */
        cell = gtk_cell_renderer_pixbuf_new ();
        gtk_tree_view_column_pack_start (col, cell, FALSE);
@@ -1001,6 +1037,31 @@ contact_list_view_pixbuf_cell_data_func (GtkTreeViewColumn     *tree_column,
        contact_list_view_cell_set_background (view, cell, is_group, is_active);
 }
 
+static void
+contact_list_view_voip_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,
+                           COL_IS_GROUP, &is_group,
+                           COL_IS_ACTIVE, &is_active,
+                           COL_CAN_VOIP, &can_voip,
+                           -1);
+
+       g_object_set (cell,
+                     "visible", !is_group && can_voip,
+                     "icon-name", EMPATHY_IMAGE_VOIP,
+                     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,
@@ -1093,7 +1154,8 @@ contact_list_view_expander_cell_data_func (GtkTreeViewColumn     *column,
 static GtkWidget *
 contact_list_view_get_contact_menu (EmpathyContactListView *view,
                                    gboolean               can_send_file,
-                                   gboolean               can_show_log)
+                                   gboolean               can_show_log,
+                                   gboolean               can_voip)
 {
        EmpathyContactListViewPriv *priv;
        GtkAction                 *action;
@@ -1105,6 +1167,9 @@ contact_list_view_get_contact_menu (EmpathyContactListView *view,
        action = gtk_ui_manager_get_action (priv->ui, "/Contact/Log");
        gtk_action_set_sensitive (action, can_show_log);
 
+       action = gtk_ui_manager_get_action (priv->ui, "/Contact/Call");
+       gtk_action_set_sensitive (action, can_voip);
+
        action = gtk_ui_manager_get_action (priv->ui, "/Contact/SendFile");
        gtk_action_set_visible (action, can_send_file);
 
@@ -1195,6 +1260,29 @@ contact_list_view_row_activated_cb (EmpathyContactListView *view,
        }
 }
 
+static void
+contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
+                                    const gchar                    *path_string,
+                                    EmpathyContactListView         *view)
+{
+       GtkTreeModel   *model;
+       GtkTreeIter     iter;
+       EmpathyContact *contact;
+
+       model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+       if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string)) {
+               return;
+       }
+
+       gtk_tree_model_get (model, &iter, COL_CONTACT, &contact, -1);
+
+       if (contact) {
+               contact_list_view_voip_activated (view, contact);
+               g_object_unref (contact);
+       }
+}
+
+
 static void
 contact_list_view_row_expand_or_collapse_cb (EmpathyContactListView *view,
                                             GtkTreeIter           *iter,
@@ -1243,6 +1331,9 @@ contact_list_view_action_cb (GtkAction             *action,
        if (contact && strcmp (name, "Chat") == 0) {
                contact_list_view_action_activated (view, contact);
        }
+       else if (contact && strcmp (name, "Call") == 0) {
+               contact_list_view_voip_activated (view, contact);
+       }
        else if (contact && strcmp (name, "Information") == 0) {
                empathy_contact_information_dialog_show (contact, parent, FALSE);
        }
@@ -1292,3 +1383,10 @@ contact_list_view_action_activated (EmpathyContactListView *view,
        g_object_unref (mc);
 }
 
+static void
+contact_list_view_voip_activated (EmpathyContactListView *view,
+                                 EmpathyContact         *contact)
+{
+       /* FIXME: Not implemented */
+}
+
index ad6d43b28656a9b14e2090ee772e99bd5bf4e37f..f3c145676812f091f794a16377e2b48fe4dde1ef 100644 (file)
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
 #define EMPATHY_IMAGE_TYPING              "empathy-typing"
 #define EMPATHY_IMAGE_CONTACT_INFORMATION "gtk-info"
 #define EMPATHY_IMAGE_GROUP_MESSAGE       "empathy-group-message"
+#define EMPATHY_IMAGE_VOIP                "gnome-stock-mic"
 
 G_END_DECLS
 
index 221b06e1720a61f880df326bc3b0df80a920db51..76cab2a6e9da4d7c415a21bbf6fcf16675f5c246 100644 (file)
@@ -624,6 +624,19 @@ empathy_contact_get_status (EmpathyContact *contact)
        return empathy_presence_state_get_default_status (MC_PRESENCE_OFFLINE);
 }
 
+gboolean
+empathy_contact_can_voip (EmpathyContact *contact)
+{
+       EmpathyContactPriv *priv;
+
+       g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
+
+       priv = GET_PRIV (contact);
+
+       return priv->capabilities & (EMPATHY_CAPABILITIES_AUDIO |
+                                    EMPATHY_CAPABILITIES_VIDEO);
+}
+
 gboolean
 empathy_contact_equal (gconstpointer v1,
                      gconstpointer v2)
index d062885bc14a4d62af06eee675e3a8edc0d9bc1d..b5a3c1ec994858b898b7dff5c1d49a929396adb8 100644 (file)
@@ -89,6 +89,7 @@ void                empathy_contact_set_is_user        (EmpathyContact      *con
                                                        gboolean             is_user);
 gboolean            empathy_contact_is_online          (EmpathyContact      *contact);
 const gchar *       empathy_contact_get_status         (EmpathyContact      *contact);
+gboolean            empathy_contact_can_voip           (EmpathyContact      *contact);
 gboolean            empathy_contact_equal              (gconstpointer        v1,
                                                        gconstpointer        v2);
 guint               empathy_contact_hash               (gconstpointer        key);