aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.c46
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.h6
-rw-r--r--src/empathy-account-assistant.c32
-rw-r--r--src/empathy-accounts-dialog.c26
4 files changed, 57 insertions, 53 deletions
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c
index 852f38174..2017b3363 100644
--- a/libempathy-gtk/empathy-protocol-chooser.c
+++ b/libempathy-gtk/empathy-protocol-chooser.c
@@ -77,8 +77,7 @@ enum
COL_LABEL,
COL_CM,
COL_PROTOCOL_NAME,
- COL_IS_GTALK,
- COL_IS_FACEBOOK,
+ COL_SERVICE,
COL_COUNT
};
@@ -131,16 +130,18 @@ protocol_chooser_sort_func (GtkTreeModel *model,
* non-gtalk */
if (cmp == 0)
{
- gboolean is_gtalk, is_facebook;
+ gchar *service;
+
gtk_tree_model_get (model, iter_a,
- COL_IS_GTALK, &is_gtalk,
- COL_IS_FACEBOOK, &is_facebook,
+ COL_SERVICE, &service,
-1);
- if (is_gtalk || is_facebook)
+ if (service != NULL)
cmp = 1;
else
cmp = -1;
+
+ g_free (service);
}
}
@@ -235,8 +236,6 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, FALSE,
- COL_IS_FACEBOOK, FALSE,
-1);
if (!tp_strdiff (proto->name, "jabber") &&
@@ -249,8 +248,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, TRUE,
- COL_IS_FACEBOOK, FALSE,
+ COL_SERVICE, "google-talk",
-1);
display_name = empathy_protocol_name_to_display_name ("facebook");
@@ -260,8 +258,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, FALSE,
- COL_IS_FACEBOOK, TRUE,
+ COL_SERVICE, "facebook",
-1);
}
@@ -312,8 +309,7 @@ protocol_chooser_constructed (GObject *object)
G_TYPE_STRING, /* Label */
G_TYPE_OBJECT, /* CM */
G_TYPE_STRING, /* protocol name */
- G_TYPE_BOOLEAN, /* is gtalk */
- G_TYPE_BOOLEAN); /* is facebook */
+ G_TYPE_STRING); /* service */
/* Set the protocol sort function */
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
@@ -426,13 +422,12 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
TpConnectionManager *cm = NULL;
gchar *protocol_name = NULL;
gboolean visible = FALSE;
- gboolean is_gtalk, is_facebook;
+ gchar *service;
gtk_tree_model_get (model, iter,
COL_CM, &cm,
COL_PROTOCOL_NAME, &protocol_name,
- COL_IS_GTALK, &is_gtalk,
- COL_IS_FACEBOOK, &is_facebook,
+ COL_SERVICE, &service,
-1);
if (cm != NULL && protocol_name != NULL)
@@ -444,7 +439,7 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
if (protocol != NULL)
{
- visible = priv->filter_func (cm, protocol, is_gtalk, is_facebook,
+ visible = priv->filter_func (cm, protocol, service,
priv->filter_user_data);
}
}
@@ -452,6 +447,7 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
if (cm != NULL)
g_object_unref (cm);
+ g_free (service);
return visible;
}
@@ -470,8 +466,7 @@ TpConnectionManager *
empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
- gboolean *is_gtalk,
- gboolean *is_facebook)
+ gchar **service)
{
GtkTreeIter iter;
TpConnectionManager *cm = NULL;
@@ -512,17 +507,10 @@ empathy_protocol_chooser_dup_selected (
}
}
- if (is_gtalk != NULL)
- {
- gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
- COL_IS_GTALK, is_gtalk,
- -1);
- }
-
- if (is_facebook != NULL)
+ if (service != NULL)
{
gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
- COL_IS_FACEBOOK, is_facebook,
+ COL_SERVICE, service,
-1);
}
}
diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h
index 88b23cba2..d5c59c26f 100644
--- a/libempathy-gtk/empathy-protocol-chooser.h
+++ b/libempathy-gtk/empathy-protocol-chooser.h
@@ -60,8 +60,7 @@ struct _EmpathyProtocolChooserClass
typedef gboolean (*EmpathyProtocolChooserFilterFunc) (TpConnectionManager *cm,
TpConnectionManagerProtocol *protocol,
- gboolean is_gtalk,
- gboolean is_facebook,
+ const gchar *service,
gpointer user_data);
GType empathy_protocol_chooser_get_type (void) G_GNUC_CONST;
@@ -69,8 +68,7 @@ GtkWidget * empathy_protocol_chooser_new (void);
TpConnectionManager *empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
- gboolean *is_gtalk,
- gboolean *is_facebook);
+ gchar **service);
void empathy_protocol_chooser_set_visible (
EmpathyProtocolChooser *protocol_chooser,
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index a8245c604..2a350e982 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -388,25 +388,34 @@ account_assistant_protocol_changed_cb (GtkComboBox *chooser,
char *str;
GtkWidget *account_widget;
EmpathyAccountWidget *widget_object = NULL;
- gboolean is_gtalk, is_facebook;
+ gboolean is_gtalk = FALSE, is_facebook = FALSE;
const gchar *name;
+ gchar *service;
priv = GET_PRIV (self);
cm = empathy_protocol_chooser_dup_selected (
- EMPATHY_PROTOCOL_CHOOSER (chooser), &proto, &is_gtalk, &is_facebook);
+ EMPATHY_PROTOCOL_CHOOSER (chooser), &proto, &service);
if (cm == NULL || proto == NULL)
/* we are not ready yet */
return;
/* Create account */
- if (is_gtalk)
- name = "gtalk";
- else if (is_facebook)
- name = "facebook";
+ if (!tp_strdiff (service, "google-talk"))
+ {
+ is_gtalk = TRUE;
+ name = "gtalk";
+ }
+ else if (!tp_strdiff (service, "facebook"))
+ {
+ is_facebook = TRUE;
+ name ="facebook";
+ }
else
- name = proto->name;
+ {
+ name = proto->name;
+ }
/* To translator: %s is the protocol name */
str = g_strdup_printf (_("New %s account"),
@@ -472,14 +481,14 @@ account_assistant_protocol_changed_cb (GtkComboBox *chooser,
gtk_widget_show (account_widget);
g_free (str);
+ g_free (service);
}
static gboolean
account_assistant_chooser_enter_details_filter_func (
TpConnectionManager *cm,
TpConnectionManagerProtocol *protocol,
- gboolean is_gtalk,
- gboolean is_facebook,
+ const gchar *service,
gpointer user_data)
{
if (!tp_strdiff (protocol->name, "local-xmpp"))
@@ -492,11 +501,10 @@ static gboolean
account_assistant_chooser_create_account_filter_func (
TpConnectionManager *cm,
TpConnectionManagerProtocol *protocol,
- gboolean is_gtalk,
- gboolean is_facebook,
+ const gchar *service,
gpointer user_data)
{
- if (is_gtalk || is_facebook)
+ if (service != NULL)
return FALSE;
return tp_connection_manager_protocol_can_register (protocol);
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 27026a3c4..a8339a58b 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -588,21 +588,30 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
const gchar *name, *display_name;
TpConnectionManager *cm;
TpConnectionManagerProtocol *proto;
- gboolean is_gtalk, is_facebook;
+ gboolean is_gtalk = FALSE, is_facebook = FALSE;
+ gchar *service;
cm = empathy_protocol_chooser_dup_selected (
- EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk,
- &is_facebook);
+ EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &service);
if (cm == NULL)
return;
- if (is_gtalk)
- name = "gtalk";
- else if (is_facebook)
- name ="facebook";
+ if (!tp_strdiff (service, "google-talk"))
+ {
+ is_gtalk = TRUE;
+ name = "gtalk";
+ }
+ else if (!tp_strdiff (service, "facebook"))
+ {
+ is_facebook = TRUE;
+ name ="facebook";
+ }
else
- name = proto->name;
+ {
+ name = proto->name;
+ }
+ /* TODO: pass the service name to empathy_protocol_name_to_display_name */
display_name = empathy_protocol_name_to_display_name (name);
if (display_name == NULL)
display_name = proto->name;
@@ -646,6 +655,7 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
g_object_unref (settings);
g_object_unref (cm);
+ g_free (service);
}
static void