diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-17 21:13:19 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-29 18:54:37 +0800 |
commit | 3a6aca03ec70cb11d23cfd68e72a51a4a49220a2 (patch) | |
tree | f184179dd1d71d4d51e482dde329954295ecd10c /src | |
parent | 6341b2e61078bf64602c6de2115599690d680596 (diff) | |
download | gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.gz gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.bz2 gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.lz gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.xz gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.zst gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.zip |
protocol-chooser: expose a 'service' string instead of boolean for facebook and gtalk
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-account-assistant.c | 32 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.c | 26 |
2 files changed, 38 insertions, 20 deletions
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 |