diff options
author | Jonathan Tellier <jonathan.tellier@gmail.com> | 2009-08-27 03:37:39 +0800 |
---|---|---|
committer | jtellier <jonathan.tellier@collabora.co.uk> | 2009-08-27 21:03:38 +0800 |
commit | 5a9bf924644f14f67a62717eeca98a0dfbce60d7 (patch) | |
tree | 71b440d942b18c6eb417894d5eda3c48613aaf47 /src | |
parent | 28c3c1f834345cf6da157262841e2731feaf85ed (diff) | |
download | gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar.gz gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar.bz2 gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar.lz gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar.xz gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.tar.zst gsoc2013-empathy-5a9bf924644f14f67a62717eeca98a0dfbce60d7.zip |
Using a new logic to set the default display name:
* If irc use "[account] on [server]"
* If there is an account property use "[account]"
* If there is no account property use "[protocol] Account"
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-accounts-dialog.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 89e1adc17..0bd58189e 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -182,23 +182,52 @@ empathy_account_dialog_widget_cancelled_cb (EmpathyAccountWidget *widget_object, g_object_unref (settings); } +static gchar * +get_default_display_name (EmpathyAccountSettings *settings) +{ + const gchar *login_id; + const gchar *protocol; + gchar *default_display_name; + + login_id = empathy_account_settings_get_string (settings, "account"); + protocol = empathy_account_settings_get_protocol (settings); + + if (login_id != NULL) + { + if (!tp_strdiff(protocol, "irc")) + { + const gchar* server; + server = empathy_account_settings_get_string (settings, "server"); + + default_display_name = + g_strdup_printf (_("%s on %s"), login_id, server); + } + else + { + default_display_name = g_strdup (login_id); + } + } + else if (protocol != NULL) + { + default_display_name = g_strdup_printf (_("%s Account"), protocol); + } + else + { + default_display_name = g_strdup (_("New account")); + } + + return default_display_name; +} + static void empathy_account_dialog_account_created_cb (EmpathyAccountWidget *widget_object, EmpathyAccountsDialog *dialog) { - const gchar *default_display_name; EmpathyAccountSettings *settings = accounts_dialog_model_get_selected_settings (dialog); - /* Setting the display name to the login ID (if there is one). */ - default_display_name = empathy_account_settings_get_string (settings, - "account"); - - if (default_display_name != NULL) - { - empathy_account_settings_set_display_name_async (settings, - default_display_name, NULL, NULL); - } + empathy_account_settings_set_display_name_async (settings, + get_default_display_name (settings), NULL, NULL); accounts_dialog_update_settings (dialog, settings); |