[empathy/mc5: 30/483] Transform profile chooser into a protocol chooser



commit 0ddbfabe32f0d02a63a21fca5bfb015f4e56bf97
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Mon Jul 6 11:29:55 2009 +0100

    Transform profile chooser into a protocol chooser

 libempathy-gtk/Makefile.am                         |    4 +-
 libempathy-gtk/empathy-profile-chooser.c           |  324 -------------------
 libempathy-gtk/empathy-profile-chooser.h           |   69 ----
 libempathy-gtk/empathy-protocol-chooser.c          |  339 ++++++++++++++++++++
 libempathy-gtk/empathy-protocol-chooser.h          |   70 ++++
 src/empathy-accounts-dialog.c                      |   81 +++---
 src/empathy-accounts-dialog.ui                     |    2 +-
 tests/Makefile.am                                  |    4 +-
 ...e-chooser.c => test-empathy-protocol-chooser.c} |    4 +-
 9 files changed, 455 insertions(+), 442 deletions(-)
---
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 1093101..94cc4ee 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -52,7 +52,7 @@ libempathy_gtk_handwritten_source =            	\
 	empathy-log-window.c			\
 	empathy-new-message-dialog.c		\
 	empathy-presence-chooser.c		\
-	empathy-profile-chooser.c		\
+	empathy-protocol-chooser.c		\
 	empathy-smiley-manager.c		\
 	empathy-sound.c				\
 	empathy-spell.c				\
@@ -112,7 +112,7 @@ libempathy_gtk_headers =			\
 	empathy-log-window.h			\
 	empathy-new-message-dialog.h		\
 	empathy-presence-chooser.h		\
-	empathy-profile-chooser.h		\
+	empathy-protocol-chooser.h		\
 	empathy-smiley-manager.h		\
 	empathy-sound.h				\
 	empathy-spell.h				\
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c
new file mode 100644
index 0000000..4544215
--- /dev/null
+++ b/libempathy-gtk/empathy-protocol-chooser.c
@@ -0,0 +1,339 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright (C) 2007-2009 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Xavier Claessens <xclaesse gmail com>
+ *          Jonny Lamb <jonny lamb collabora co uk>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <telepathy-glib/util.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-utils.h>
+
+#include "empathy-protocol-chooser.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
+
+/**
+ * SECTION:empathy-protocol-chooser
+ * @title: EmpathyProtocolChooser
+ * @short_description: A widget used to choose from a list of protocols
+ * @include: libempathy-gtk/empathy-protocol-chooser.h
+ *
+ * #EmpathyProtocolChooser is a widget which extends #GtkComboBox to provides a
+ * chooser of available protocols.
+ */
+
+/**
+ * EmpathyProtocolChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBox to provide a chooser of available
+ * protocols.
+ */
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyProtocolChooser)
+typedef struct
+{
+  GtkListStore *store;
+  gboolean dispose_run;
+
+} EmpathyProtocolChooserPriv;
+
+enum
+{
+  COL_ICON,
+  COL_LABEL,
+  COL_CM,
+  COL_PROTOCOL,
+  COL_COUNT
+};
+
+G_DEFINE_TYPE (EmpathyProtocolChooser, empathy_protocol_chooser,
+    GTK_TYPE_COMBO_BOX);
+
+static gint
+protocol_chooser_sort_protocol_value (TpConnectionManagerProtocol *protocol)
+{
+  guint i;
+  const gchar *names[] = {
+    "jabber",
+    "salut",
+    "gtalk",
+    NULL
+  };
+
+  for (i = 0 ; names[i]; i++)
+    {
+      if (strcmp (protocol->name, names[i]) == 0)
+        return i;
+    }
+
+  return i;
+}
+
+static gint
+protocol_chooser_sort_func (GtkTreeModel *model,
+    GtkTreeIter  *iter_a,
+    GtkTreeIter  *iter_b,
+    gpointer      user_data)
+{
+  TpConnectionManagerProtocol *protocol_a;
+  TpConnectionManagerProtocol *protocol_b;
+  gint cmp;
+
+  gtk_tree_model_get (model, iter_a,
+      COL_PROTOCOL, &protocol_a,
+      -1);
+  gtk_tree_model_get (model, iter_b,
+      COL_PROTOCOL, &protocol_b,
+      -1);
+
+  cmp = protocol_chooser_sort_protocol_value (protocol_a);
+  cmp -= protocol_chooser_sort_protocol_value (protocol_b);
+  if (cmp == 0)
+    {
+      cmp = strcmp (protocol_a->name, protocol_b->name);
+    }
+
+  return cmp;
+}
+
+static void
+protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
+    TpConnectionManager *cm)
+{
+  EmpathyProtocolChooserPriv *priv = GET_PRIV (chooser);
+  const TpConnectionManagerProtocol * const *iter;
+
+  for (iter = cm->protocols; iter != NULL && *iter != NULL; iter++)
+    {
+      const TpConnectionManagerProtocol *proto = *iter;
+      gchar *icon_name;
+      gchar *display_name;
+
+
+      icon_name = g_strdup_printf ("im-%s", proto->name);
+
+      if (!tp_strdiff (cm->name, "haze") && !tp_strdiff (proto->name, "msn"))
+        display_name = g_strdup_printf ("msn (Haze)");
+      else
+        display_name = g_strdup (proto->name);
+
+      gtk_list_store_insert_with_values (priv->store, NULL, 0,
+          COL_ICON, icon_name,
+          COL_LABEL, display_name,
+          COL_CM, cm,
+          COL_PROTOCOL, proto,
+          -1);
+
+      g_free (display_name);
+      g_free (icon_name);
+    }
+}
+
+
+static void
+protocol_choosers_cms_listed (TpConnectionManager * const *cms,
+    gsize n_cms,
+    const GError *error,
+    gpointer user_data,
+    GObject *weak_object)
+{
+  TpConnectionManager * const *iter;
+
+  if (error !=NULL)
+    {
+      DEBUG ("Failed to get connection managers: %s", error->message);
+      return;
+    }
+
+  for (iter = cms ; iter != NULL && *iter != NULL; iter++)
+    protocol_choosers_add_cm (EMPATHY_PROTOCOL_CHOOSER (weak_object),
+      *iter);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (weak_object), 0);
+}
+
+static void
+protocol_chooser_constructed (GObject *object)
+{
+  EmpathyProtocolChooser *protocol_chooser;
+  EmpathyProtocolChooserPriv *priv;
+
+  GtkCellRenderer *renderer;
+  TpDBusDaemon *dbus;
+
+  priv = GET_PRIV (object);
+  protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object);
+
+  /* set up combo box with new store */
+  priv->store = gtk_list_store_new (COL_COUNT,
+          G_TYPE_STRING,    /* Icon name */
+          G_TYPE_STRING,    /* Label     */
+          G_TYPE_OBJECT,    /* CM */
+          G_TYPE_POINTER);  /* protocol   */
+
+  gtk_combo_box_set_model (GTK_COMBO_BOX (object),
+      GTK_TREE_MODEL (priv->store));
+
+  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,
+      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);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
+      "text", COL_LABEL,
+      NULL);
+
+  dbus = tp_dbus_daemon_dup (NULL);
+  tp_list_connection_managers (dbus, protocol_choosers_cms_listed,
+    NULL, NULL, object);
+  g_object_unref (dbus);
+
+  /* Set the protocol sort function */
+  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
+      COL_PROTOCOL,
+      protocol_chooser_sort_func,
+      NULL, NULL);
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
+      COL_PROTOCOL,
+      GTK_SORT_ASCENDING);
+
+  if (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed)
+    G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed (object);
+}
+
+static void
+empathy_protocol_chooser_init (EmpathyProtocolChooser *protocol_chooser)
+{
+  EmpathyProtocolChooserPriv *priv =
+    G_TYPE_INSTANCE_GET_PRIVATE (protocol_chooser,
+        EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserPriv);
+
+  priv->dispose_run = FALSE;
+
+  protocol_chooser->priv = priv;
+}
+
+static void
+protocol_chooser_dispose (GObject *object)
+{
+  EmpathyProtocolChooser *protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object);
+  EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
+
+  if (priv->dispose_run)
+    return;
+
+  priv->dispose_run = TRUE;
+
+  if (priv->store)
+    {
+      g_object_unref (priv->store);
+      priv->store = NULL;
+    }
+
+  (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->dispose) (object);
+}
+
+static void
+empathy_protocol_chooser_class_init (EmpathyProtocolChooserClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->constructed = protocol_chooser_constructed;
+  object_class->dispose = protocol_chooser_dispose;
+
+  g_type_class_add_private (object_class, sizeof (EmpathyProtocolChooserPriv));
+}
+
+/**
+ * empathy_protocol_chooser_get_selected_protocol:
+ * @protocol_chooser: an #EmpathyProtocolChooser
+ *
+ * Returns a pointer to the selected #TpConnectionManagerProtocol in
+ * @protocol_chooser.
+ *
+ * Return value: a pointer to the selected #TpConnectionManagerProtocol
+ */
+TpConnectionManager *empathy_protocol_chooser_dup_selected (
+    EmpathyProtocolChooser *protocol_chooser,
+    TpConnectionManagerProtocol **protocol)
+{
+  EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
+  GtkTreeIter iter;
+  TpConnectionManager *cm = NULL;
+
+  g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), NULL);
+
+  if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (protocol_chooser), &iter))
+    {
+      gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+          COL_CM, &cm,
+          -1);
+
+      if (protocol != NULL)
+        gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+            COL_PROTOCOL, protocol,
+            -1);
+    }
+
+  return cm;
+}
+
+/**
+ * empathy_protocol_chooser_n_protocols:
+ * @protocol_chooser: an #EmpathyProtocolChooser
+ *
+ * Returns the number of protocols in @protocol_chooser.
+ *
+ * Return value: the number of protocols in @protocol_chooser
+ */
+gint
+empathy_protocol_chooser_n_protocols (EmpathyProtocolChooser *protocol_chooser)
+{
+  EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
+
+  g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), 0);
+
+  return gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
+}
+
+/**
+ * empathy_protocol_chooser_new:
+ *
+ * Creates a new #EmpathyProtocolChooser widget.
+ *
+ * Return value: a new #EmpathyProtocolChooser widget
+ */
+GtkWidget *
+empathy_protocol_chooser_new (void)
+{
+  return GTK_WIDGET (g_object_new (EMPATHY_TYPE_PROTOCOL_CHOOSER, NULL));
+}
diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h
new file mode 100644
index 0000000..75f9343
--- /dev/null
+++ b/libempathy-gtk/empathy-protocol-chooser.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright (C) 2007-2009 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Xavier Claessens <xclaesse gmail com>
+ *          Jonny Lamb <jonny lamb collabora co uk
+ */
+
+#ifndef __EMPATHY_PROTOCOL_CHOOSER_H__
+#define __EMPATHY_PROTOCOL_CHOOSER_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include <telepathy-glib/connection-manager.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_PROTOCOL_CHOOSER (empathy_protocol_chooser_get_type ())
+#define EMPATHY_PROTOCOL_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+    EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooser))
+#define EMPATHY_PROTOCOL_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
+    EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserClass))
+#define EMPATHY_IS_PROTOCOL_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+    EMPATHY_TYPE_PROTOCOL_CHOOSER))
+#define EMPATHY_IS_PROTOCOL_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+    EMPATHY_TYPE_PROTOCOL_CHOOSER))
+#define EMPATHY_PROTOCOL_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+    EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserClass))
+
+typedef struct _EmpathyProtocolChooser EmpathyProtocolChooser;
+typedef struct _EmpathyProtocolChooserClass EmpathyProtocolChooserClass;
+
+struct _EmpathyProtocolChooser
+{
+  GtkComboBox parent;
+
+  /*<private>*/
+  gpointer priv;
+};
+
+struct _EmpathyProtocolChooserClass
+{
+  GtkComboBoxClass parent_class;
+};
+
+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);
+gint empathy_protocol_chooser_n_protocols (
+    EmpathyProtocolChooser *protocol_chooser);
+
+G_END_DECLS
+#endif /*  __EMPATHY_PROTOCOL_CHOOSER_H__ */
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 1b48c14..c523a21 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -31,13 +31,12 @@
 #include <glib/gi18n.h>
 #include <dbus/dbus-glib.h>
 
-#include <libmissioncontrol/mc-profile.h>
 #include <telepathy-glib/util.h>
 
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-account-manager.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-profile-chooser.h>
+#include <libempathy-gtk/empathy-protocol-chooser.h>
 #include <libempathy-gtk/empathy-account-widget.h>
 #include <libempathy-gtk/empathy-account-widget-irc.h>
 #include <libempathy-gtk/empathy-account-widget-sip.h>
@@ -58,7 +57,7 @@ typedef struct {
 	GtkWidget        *alignment_settings;
 
 	GtkWidget        *vbox_details;
-	GtkWidget        *frame_no_profile;
+	GtkWidget        *frame_no_protocol;
 
 	GtkWidget        *treeview;
 
@@ -67,7 +66,7 @@ typedef struct {
 	GtkWidget        *button_import;
 
 	GtkWidget        *frame_new_account;
-	GtkWidget        *combobox_profile;
+	GtkWidget        *combobox_protocol;
 	GtkWidget        *hbox_type;
 	GtkWidget        *button_create;
 	GtkWidget        *button_back;
@@ -215,8 +214,8 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
 			accounts_dialog_model_select_first (dialog);
 			return;
 		}
-		if (empathy_profile_chooser_n_profiles (
-			EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile)) > 0) {
+		if (empathy_protocol_chooser_n_protocols (
+			EMPATHY_PROTOCOL_CHOOSER (dialog->combobox_protocol)) > 0) {
 			/* We have no account configured but we have some
 			 * profiles instsalled. The user obviously wants to add
 			 * an account. Click on the Add button for him. */
@@ -228,7 +227,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
 		/* No account and no profile, warn the user */
 		gtk_widget_hide (dialog->vbox_details);
 		gtk_widget_hide (dialog->frame_new_account);
-		gtk_widget_show (dialog->frame_no_profile);
+		gtk_widget_show (dialog->frame_no_protocol);
 		gtk_widget_set_sensitive (dialog->button_add, FALSE);
 		gtk_widget_set_sensitive (dialog->button_remove, FALSE);
 		return;
@@ -237,7 +236,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
 	/* We have an account selected, destroy old settings and create a new
 	 * one for the account selected */
 	gtk_widget_hide (dialog->frame_new_account);
-	gtk_widget_hide (dialog->frame_no_profile);
+	gtk_widget_hide (dialog->frame_no_protocol);
 	gtk_widget_show (dialog->vbox_details);
 	gtk_widget_set_sensitive (dialog->button_add, TRUE);
 	gtk_widget_set_sensitive (dialog->button_remove, TRUE);
@@ -801,31 +800,30 @@ static void
 accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
 					  EmpathyAccountsDialog  *dialog)
 {
-	McProfile *profile;
 	EmpathyAccount *account;
 	gchar     *str;
-	McProfileCapabilityFlags cap;
+	TpConnectionManager *cm;
+	TpConnectionManagerProtocol *proto;
 
-	profile = empathy_profile_chooser_dup_selected (
-	    EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile));
+	cm = empathy_protocol_chooser_dup_selected (
+	    EMPATHY_PROTOCOL_CHOOSER (dialog->combobox_protocol), &proto);
 
 	/* Create account */
-	account = empathy_account_manager_create (dialog->account_manager, profile);
+	/* To translator: %s is the protocol name */
+	str = g_strdup_printf (_("New %s account"), proto->name);
+
+	account = empathy_account_manager_create (dialog->account_manager,
+		cm->name, proto->name, str);
+
+	g_free (str);
+
 	if (account == NULL) {
 		/* We can't display an error to the user as MC doesn't give us
 		 * any clue about the reason of the failure... */
-		g_object_unref (profile);
 		return;
 	}
 
-	/* To translator: %s is the protocol name */
-	str = g_strdup_printf (_("New %s account"),
-			       mc_profile_get_display_name (profile));
-	empathy_account_set_display_name (account, str);
-	g_free (str);
-
-	cap = mc_profile_get_capabilities (profile);
-	if (cap & MC_PROFILE_CAPABILITY_REGISTRATION_UI) {
+	if (tp_connection_manager_protocol_can_register (proto)) {
 		gboolean active;
 
 		active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_register));
@@ -838,7 +836,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
 	accounts_dialog_model_set_selected (dialog, account);
 
 	g_object_unref (account);
-	g_object_unref (profile);
+	g_object_unref (cm);
 }
 
 static void
@@ -852,24 +850,23 @@ accounts_dialog_button_back_clicked_cb (GtkWidget             *button,
 }
 
 static void
-accounts_dialog_profile_changed_cb (GtkWidget             *widget,
+accounts_dialog_protocol_changed_cb (GtkWidget             *widget,
 				    EmpathyAccountsDialog *dialog)
 {
-	McProfile *profile;
-	McProfileCapabilityFlags cap;
+	TpConnectionManager *cm;
+	TpConnectionManagerProtocol *proto;
 
-	profile = empathy_profile_chooser_dup_selected (
-	    EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile));
-	cap = mc_profile_get_capabilities (profile);
+	cm = empathy_protocol_chooser_dup_selected (
+	    EMPATHY_PROTOCOL_CHOOSER (dialog->combobox_protocol), &proto);
 
-	if (cap & MC_PROFILE_CAPABILITY_REGISTRATION_UI) {
+	if (tp_connection_manager_protocol_can_register (proto)) {
 		gtk_widget_show (dialog->radiobutton_register);
 		gtk_widget_show (dialog->radiobutton_reuse);
 	} else {
 		gtk_widget_hide (dialog->radiobutton_register);
 		gtk_widget_hide (dialog->radiobutton_reuse);
 	}
-	g_object_unref (profile);
+	g_object_unref (cm);
 }
 
 static void
@@ -888,7 +885,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget             *button,
 	gtk_widget_set_sensitive (dialog->button_add, FALSE);
 	gtk_widget_set_sensitive (dialog->button_remove, FALSE);
 	gtk_widget_hide (dialog->vbox_details);
-	gtk_widget_hide (dialog->frame_no_profile);
+	gtk_widget_hide (dialog->frame_no_protocol);
 	gtk_widget_show (dialog->frame_new_account);
 
 	/* If we have no account, no need of a back button */
@@ -898,11 +895,11 @@ accounts_dialog_button_add_clicked_cb (GtkWidget             *button,
 		gtk_widget_hide (dialog->button_back);
 	}
 
-	accounts_dialog_profile_changed_cb (dialog->radiobutton_register, dialog);
+	accounts_dialog_protocol_changed_cb (dialog->radiobutton_register, dialog);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_reuse),
 				      TRUE);
-	gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combobox_profile), 0);
-	gtk_widget_grab_focus (dialog->combobox_profile);
+	gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combobox_protocol), 0);
+	gtk_widget_grab_focus (dialog->combobox_protocol);
 }
 
 static void
@@ -1052,7 +1049,7 @@ empathy_accounts_dialog_show (GtkWindow *parent,
 	gui = empathy_builder_get_file (filename,
 				       "accounts_dialog", &dialog->window,
 				       "vbox_details", &dialog->vbox_details,
-				       "frame_no_profile", &dialog->frame_no_profile,
+				       "frame_no_protocol", &dialog->frame_no_protocol,
 				       "alignment_settings", &dialog->alignment_settings,
 				       "treeview", &dialog->treeview,
 				       "frame_new_account", &dialog->frame_new_account,
@@ -1084,14 +1081,14 @@ empathy_accounts_dialog_show (GtkWindow *parent,
 
 	g_object_unref (gui);
 
-	/* Create profile chooser */
-	dialog->combobox_profile = empathy_profile_chooser_new ();
+	/* Create protocol chooser */
+	dialog->combobox_protocol = empathy_protocol_chooser_new ();
 	gtk_box_pack_end (GTK_BOX (dialog->hbox_type),
-			  dialog->combobox_profile,
+			  dialog->combobox_protocol,
 			  TRUE, TRUE, 0);
-	gtk_widget_show (dialog->combobox_profile);
-	g_signal_connect (dialog->combobox_profile, "changed",
-			  G_CALLBACK (accounts_dialog_profile_changed_cb),
+	gtk_widget_show (dialog->combobox_protocol);
+	g_signal_connect (dialog->combobox_protocol, "changed",
+			  G_CALLBACK (accounts_dialog_protocol_changed_cb),
 			  dialog);
 
 	/* Set up signalling */
diff --git a/src/empathy-accounts-dialog.ui b/src/empathy-accounts-dialog.ui
index cf1b23e..a76b4ae 100644
--- a/src/empathy-accounts-dialog.ui
+++ b/src/empathy-accounts-dialog.ui
@@ -391,7 +391,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkFrame" id="frame_no_profile">
+                  <object class="GtkFrame" id="frame_no_protocol">
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f96650e..7f99eaf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,13 +27,13 @@ noinst_PROGRAMS =			\
 	empetit				\
 	test-empathy-presence-chooser	\
 	test-empathy-status-preset-dialog \
-	test-empathy-profile-chooser
+	test-empathy-protocol-chooser
 
 contact_manager_SOURCES = contact-manager.c
 empetit_SOURCES = empetit.c
 test_empathy_presence_chooser_SOURCES = test-empathy-presence-chooser.c
 test_empathy_status_preset_dialog_SOURCES = test-empathy-status-preset-dialog.c
-test_empathy_profile_chooser_SOURCES = test-empathy-profile-chooser.c
+test_empathy_protocol_chooser_SOURCES = test-empathy-protocol-chooser.c
 
 check_PROGRAMS = check-main
 TESTS = check-main
diff --git a/tests/test-empathy-profile-chooser.c b/tests/test-empathy-protocol-chooser.c
similarity index 84%
rename from tests/test-empathy-profile-chooser.c
rename to tests/test-empathy-protocol-chooser.c
index 9078bbd..07b1c70 100644
--- a/tests/test-empathy-profile-chooser.c
+++ b/tests/test-empathy-protocol-chooser.c
@@ -3,7 +3,7 @@
 #include <gtk/gtk.h>
 
 #include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-profile-chooser.h>
+#include <libempathy-gtk/empathy-protocol-chooser.h>
 
 int
 main (int argc,
@@ -16,7 +16,7 @@ main (int argc,
   empathy_gtk_init ();
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  chooser = empathy_profile_chooser_new ();
+  chooser = empathy_protocol_chooser_new ();
   gtk_container_add (GTK_CONTAINER (window), chooser);
 
   /*  gtk_window_set_default_size (GTK_WINDOW (window), 150, -1);*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]