]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-protocol-chooser.c
Merge remote-tracking branch 'origin/gnome-3-8'
[empathy.git] / libempathy-gtk / empathy-protocol-chooser.c
index efefec80869607c3201b0605c23d2b8433d599c0..a060d9f7ec4059613490bb2e4a9dee6766c00d40 100644 (file)
  *          Jonny Lamb <jonny.lamb@collabora.co.uk>
  */
 
-#include <config.h>
-
-#include <string.h>
-
-#include <telepathy-glib/util.h>
-
-#include <gtk/gtk.h>
+#include "config.h"
+#include "empathy-protocol-chooser.h"
 
 #include <glib/gi18n-lib.h>
 
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-connection-managers.h>
-
-#include "empathy-protocol-chooser.h"
+#include "empathy-connection-managers.h"
 #include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 /**
  * SECTION:empathy-protocol-chooser
@@ -169,6 +162,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
       const gchar *display_name;
       const gchar *saved_cm_name;
       const gchar *proto_name;
+      GdkPixbuf *pixbuf;
 
       proto_name = tp_protocol_get_name (protocol);
       saved_cm_name = g_hash_table_lookup (priv->protocols, proto_name);
@@ -236,39 +230,52 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
           g_strdup (proto_name), g_strdup (cm_name));
 
       icon_name = empathy_protocol_icon_name (proto_name);
+      pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
 
       display_name = empathy_protocol_name_to_display_name (proto_name);
 
       gtk_list_store_insert_with_values (priv->store,
           NULL, 0,
-          COL_ICON, icon_name,
+          COL_ICON, pixbuf,
           COL_LABEL, display_name,
           COL_CM, cm,
           COL_PROTOCOL_NAME, proto_name,
           -1);
 
+      g_clear_object (&pixbuf);
+
       if (!tp_strdiff (proto_name, "jabber") &&
           !tp_strdiff (cm_name, "gabble"))
         {
           display_name = empathy_service_name_to_display_name ("google-talk");
+          pixbuf = empathy_pixbuf_from_icon_name ("im-google-talk",
+                  GTK_ICON_SIZE_BUTTON);
+
           gtk_list_store_insert_with_values (priv->store,
              NULL, 0,
-             COL_ICON, "im-google-talk",
+             COL_ICON, pixbuf,
              COL_LABEL, display_name,
              COL_CM, cm,
              COL_PROTOCOL_NAME, proto_name,
              COL_SERVICE, "google-talk",
              -1);
 
+          g_clear_object (&pixbuf);
+
           display_name = empathy_service_name_to_display_name ("facebook");
+          pixbuf = empathy_pixbuf_from_icon_name ("im-facebook",
+                  GTK_ICON_SIZE_BUTTON);
+
           gtk_list_store_insert_with_values (priv->store,
              NULL, 0,
-             COL_ICON, "im-facebook",
+             COL_ICON, pixbuf,
              COL_LABEL, display_name,
              COL_CM, cm,
              COL_PROTOCOL_NAME, proto_name,
              COL_SERVICE, "facebook",
              -1);
+
+          g_clear_object (&pixbuf);
         }
 
       g_free (icon_name);
@@ -316,7 +323,7 @@ protocol_chooser_constructed (GObject *object)
 
   /* set up combo box with new store */
   priv->store = gtk_list_store_new (COL_COUNT,
-          G_TYPE_STRING,    /* Icon name */
+          GDK_TYPE_PIXBUF,  /* Icon */
           G_TYPE_STRING,    /* Label     */
           G_TYPE_OBJECT,    /* CM */
           G_TYPE_STRING,    /* protocol name  */
@@ -337,9 +344,8 @@ protocol_chooser_constructed (GObject *object)
   renderer = gtk_cell_renderer_pixbuf_new ();
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
   gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
-      "icon-name", COL_ICON,
+      "pixbuf", COL_ICON,
       NULL);
-  g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
 
   renderer = gtk_cell_renderer_text_new ();
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
@@ -603,46 +609,47 @@ empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self)
 
   if (!tp_strdiff (service, "google-talk"))
     {
-      gchar *fallback_servers[] = {
+      const gchar *fallback_servers[] = {
           "talkx.l.google.com",
           "talkx.l.google.com:443,oldssl",
           "talkx.l.google.com:80",
           NULL};
 
-      gchar *extra_certificate_identities[] = {
+      const gchar *extra_certificate_identities[] = {
           "talk.google.com",
           NULL};
 
       empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
           NULL, NULL);
-      empathy_account_settings_set_string (settings, "server",
-          extra_certificate_identities[0]);
-      empathy_account_settings_set_boolean (settings, "require-encryption",
-          TRUE);
-      empathy_account_settings_set_strv (settings, "fallback-servers",
-          fallback_servers);
+      empathy_account_settings_set (settings, "server",
+          g_variant_new_string (extra_certificate_identities[0]));
+      empathy_account_settings_set (settings, "require-encryption",
+          g_variant_new_boolean (TRUE));
+      empathy_account_settings_set (settings, "fallback-servers",
+          g_variant_new_strv (fallback_servers, -1));
 
       if (empathy_account_settings_have_tp_param (settings,
               "extra-certificate-identities"))
         {
-          empathy_account_settings_set_strv (settings,
-              "extra-certificate-identities", extra_certificate_identities);
+          empathy_account_settings_set (settings,
+              "extra-certificate-identities",
+              g_variant_new_strv (extra_certificate_identities, -1));
         }
     }
   else if (!tp_strdiff (service, "facebook"))
     {
-      gchar *fallback_servers[] = {
+      const gchar *fallback_servers[] = {
           "chat.facebook.com:443",
           NULL };
 
       empathy_account_settings_set_icon_name_async (settings, "im-facebook",
           NULL, NULL);
-      empathy_account_settings_set_boolean (settings, "require-encryption",
-          TRUE);
-      empathy_account_settings_set_string (settings, "server",
-          "chat.facebook.com");
-      empathy_account_settings_set_strv (settings, "fallback-servers",
-          fallback_servers);
+      empathy_account_settings_set (settings, "require-encryption",
+          g_variant_new_boolean (TRUE));
+      empathy_account_settings_set (settings, "server",
+          g_variant_new_string ("chat.facebook.com"));
+      empathy_account_settings_set (settings, "fallback-servers",
+          g_variant_new_strv (fallback_servers, -1));
     }
 
 out: