aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts-dialog.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-17 21:55:45 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-29 18:54:37 +0800
commit9cd957b56a67984b4fd3d89aec3e6606372462d7 (patch)
tree5e5f8ded50056f32076912e30f5ba5db1edb9e83 /src/empathy-accounts-dialog.c
parentfc4059e17da2a94a3864f396b5de12d93865090d (diff)
downloadgsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar.gz
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar.bz2
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar.lz
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar.xz
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.tar.zst
gsoc2013-empathy-9cd957b56a67984b4fd3d89aec3e6606372462d7.zip
factor out empathy_protocol_chooser_create_account_settings()
No need to keep this code duplicated.
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r--src/empathy-accounts-dialog.c62
1 files changed, 4 insertions, 58 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index fd6821368..55e21218e 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -584,63 +584,11 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
EmpathyAccountSettings *settings;
- gchar *str;
- const gchar *display_name;
- TpConnectionManager *cm;
- TpConnectionManagerProtocol *proto;
- gboolean is_gtalk = FALSE, is_facebook = FALSE;
- gchar *service;
-
- cm = empathy_protocol_chooser_dup_selected (
- EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &service);
- if (cm == NULL)
- return;
-
- if (!tp_strdiff (service, "google-talk"))
- {
- is_gtalk = TRUE;
- }
- else if (!tp_strdiff (service, "facebook"))
- {
- is_facebook = TRUE;
- }
-
- if (service != NULL)
- display_name = empathy_service_name_to_display_name (service);
- else
- display_name = empathy_protocol_name_to_display_name (proto->name);
-
- /* Create account */
- /* To translator: %s is the name of the protocol, such as "Google Talk" or
- * "Yahoo!"
- */
- str = g_strdup_printf (_("New %s account"), display_name);
- settings = empathy_account_settings_new (cm->name, proto->name, str);
- g_free (str);
-
- if (is_gtalk)
- {
- gchar *fallback_servers[] = {
- "talkx.l.google.com",
- "talkx.l.google.com:443,oldssl",
- "talkx.l.google.com:80",
- NULL};
-
- empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
- NULL, NULL);
-
- empathy_account_settings_set_strv (settings, "fallback-servers",
- fallback_servers);
- }
- else if (is_facebook)
- {
- empathy_account_settings_set_icon_name_async (settings, "im-facebook",
- NULL, NULL);
-
- empathy_account_settings_set_string (settings, "server",
- "chat.facebook.com");
- }
+ settings = empathy_protocol_chooser_create_account_settings (
+ EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol));
+ if (settings == NULL)
+ return;
accounts_dialog_add (dialog, settings);
accounts_dialog_model_set_selected (dialog, settings);
@@ -648,8 +596,6 @@ accounts_dialog_setup_ui_to_add_account (EmpathyAccountsDialog *dialog)
gtk_widget_show_all (priv->hbox_protocol);
g_object_unref (settings);
- g_object_unref (cm);
- g_free (service);
}
static void