]> git.0d.be Git - empathy.git/commitdiff
GTalk-enable the protocol chooser
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 28 Aug 2009 12:40:47 +0000 (14:40 +0200)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 31 Aug 2009 15:34:42 +0000 (16:34 +0100)
libempathy-gtk/empathy-protocol-chooser.c
libempathy-gtk/empathy-protocol-chooser.h

index 16ede4fd9fb8e36616341a5ab4a97438eb35dcbf..7f2ca147f95ec245a040ed1df7faab0ccf281561 100644 (file)
@@ -77,6 +77,7 @@ enum
   COL_LABEL,
   COL_CM,
   COL_PROTOCOL,
+  COL_IS_GTALK,
   COL_COUNT
 };
 
@@ -208,8 +209,23 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
           COL_LABEL, display_name,
           COL_CM, cm,
           COL_PROTOCOL, proto,
+          COL_IS_GTALK, FALSE,
           -1);
 
+      if (!tp_strdiff (proto->name, "jabber") &&
+          !tp_strdiff (cm->name, "gabble"))
+        {
+          display_name = empathy_protocol_name_to_display_name ("gtalk");
+          gtk_list_store_insert_with_values (priv->store,
+             NULL, 0,
+             COL_ICON, "im-google-talk",
+             COL_LABEL, display_name,
+             COL_CM, cm,
+             COL_PROTOCOL, proto,
+             COL_IS_GTALK, TRUE,
+             -1);
+        }
+
       g_free (icon_name);
     }
 }
@@ -251,7 +267,8 @@ protocol_chooser_constructed (GObject *object)
           G_TYPE_STRING,    /* Icon name */
           G_TYPE_STRING,    /* Label     */
           G_TYPE_OBJECT,    /* CM */
-          G_TYPE_POINTER);  /* protocol   */
+          G_TYPE_POINTER,   /* protocol   */
+          G_TYPE_BOOLEAN);  /* is gtalk  */
 
   /* Set the protocol sort function */
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
@@ -394,7 +411,8 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
 TpConnectionManager *
 empathy_protocol_chooser_dup_selected (
     EmpathyProtocolChooser *protocol_chooser,
-    TpConnectionManagerProtocol **protocol)
+    TpConnectionManagerProtocol **protocol,
+    gboolean *is_gtalk)
 {
   GtkTreeIter iter;
   TpConnectionManager *cm = NULL;
@@ -414,9 +432,18 @@ empathy_protocol_chooser_dup_selected (
           -1);
 
       if (protocol != NULL)
-        gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
-            COL_PROTOCOL, protocol,
-            -1);
+        {
+          gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
+              COL_PROTOCOL, protocol,
+              -1);
+        }
+
+      if (is_gtalk != NULL)
+        {
+          gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
+              COL_IS_GTALK, is_gtalk,
+              -1);
+        }
     }
 
   return cm;
index 55e8e355e30bcb2ba1fec39a75dd18917b6803cc..a649aa578ee37438e54e5de3c8602834e56becc4 100644 (file)
@@ -65,13 +65,13 @@ GType empathy_protocol_chooser_get_type (void) G_GNUC_CONST;
 GtkWidget * empathy_protocol_chooser_new (void);
 TpConnectionManager *empathy_protocol_chooser_dup_selected (
     EmpathyProtocolChooser *protocol_chooser,
-    TpConnectionManagerProtocol **protocol);
+    TpConnectionManagerProtocol **protocol,
+    gboolean *is_gtalk);
 
 void empathy_protocol_chooser_set_visible (
     EmpathyProtocolChooser *protocol_chooser,
     EmpathyProtocolChooserFilterFunc func,
     gpointer user_data);
 
-
 G_END_DECLS
 #endif /*  __EMPATHY_PROTOCOL_CHOOSER_H__ */