Commit d5c50301 authored by Guillaume Desmottes's avatar Guillaume Desmottes

add is_facebook arg to empathy_protocol_chooser_dup_selected

So the assistant and accounts dialog can special case facebook accounts.
parent 0d6a5a8c
......@@ -464,7 +464,8 @@ TpConnectionManager *
empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
gboolean *is_gtalk)
gboolean *is_gtalk,
gboolean *is_facebook)
{
GtkTreeIter iter;
TpConnectionManager *cm = NULL;
......@@ -503,6 +504,13 @@ empathy_protocol_chooser_dup_selected (
COL_IS_GTALK, is_gtalk,
-1);
}
if (is_facebook != NULL)
{
gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
COL_IS_FACEBOOK, is_facebook,
-1);
}
}
return cm;
......
......@@ -68,7 +68,8 @@ GtkWidget * empathy_protocol_chooser_new (void);
TpConnectionManager *empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
gboolean *is_gtalk);
gboolean *is_gtalk,
gboolean *is_facebook);
void empathy_protocol_chooser_set_visible (
EmpathyProtocolChooser *protocol_chooser,
......
......@@ -390,28 +390,38 @@ account_assistant_protocol_changed_cb (GtkComboBox *chooser,
char *str;
GtkWidget *account_widget;
EmpathyAccountWidget *widget_object = NULL;
gboolean is_gtalk;
gboolean is_gtalk, is_facebook;
const gchar *name;
priv = GET_PRIV (self);
cm = empathy_protocol_chooser_dup_selected (
EMPATHY_PROTOCOL_CHOOSER (chooser), &proto, &is_gtalk);
EMPATHY_PROTOCOL_CHOOSER (chooser), &proto, &is_gtalk, &is_facebook);
if (cm == NULL || proto == NULL)
/* we are not ready yet */
return;
/* Create account */
if (is_gtalk)
name = "gtalk";
else if (is_facebook)
name = "facebook";
else
name = proto->name;
/* To translator: %s is the protocol name */
str = g_strdup_printf (_("New %s account"),
empathy_protocol_name_to_display_name (
is_gtalk ? "gtalk" : proto->name));
empathy_protocol_name_to_display_name (name));
settings = empathy_account_settings_new (cm->name, proto->name, str);
if (is_gtalk)
empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
NULL, NULL);
else if (is_facebook)
empathy_account_settings_set_icon_name_async (settings, "im-facebook",
NULL, NULL);
if (priv->first_resp == RESPONSE_CREATE_ACCOUNT)
empathy_account_settings_set_boolean (settings, "register", TRUE);
......
......@@ -530,19 +530,25 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
EmpathyAccountSettings *settings;
gchar *str;
const gchar *display_name;
const gchar *name, *display_name;
TpConnectionManager *cm;
TpConnectionManagerProtocol *proto;
gboolean is_gtalk;
gboolean is_gtalk, is_facebook;
cm = empathy_protocol_chooser_dup_selected (
EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk);
EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk,
&is_facebook);
if (cm == NULL)
return;
display_name = empathy_protocol_name_to_display_name (
is_gtalk ? "gtalk" : proto->name);
if (is_gtalk)
name = "gtalk";
else if (is_facebook)
name ="facebook";
else
name = proto->name;
display_name = empathy_protocol_name_to_display_name (name);
if (display_name == NULL)
display_name = proto->name;
......@@ -558,6 +564,9 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
if (is_gtalk)
empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
NULL, NULL);
else if (is_facebook)
empathy_account_settings_set_icon_name_async (settings, "im-facebook",
NULL, NULL);
accounts_dialog_add (dialog, settings);
accounts_dialog_model_set_selected (dialog, settings);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment