diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-03 18:54:57 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-03 18:54:57 +0800 |
commit | 4728aaffa21812eb2e6bd8b9eeac0cceccb85437 (patch) | |
tree | c752552504d39cf40be8f54167888ccd54fdfa17 | |
parent | 46adf4f15f0d9fee5b3b2e22e2cffca0d48a7184 (diff) | |
parent | 1dab11523a8fffd546d154ca21c79a8c76d0c3c0 (diff) | |
download | gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar.gz gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar.bz2 gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar.lz gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar.xz gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.tar.zst gsoc2013-empathy-4728aaffa21812eb2e6bd8b9eeac0cceccb85437.zip |
Merge branch 'update-display-name-603463'
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 22 | ||||
-rw-r--r-- | libempathy/empathy-account-settings.c | 7 |
2 files changed, 25 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index f2d4bbe4c..e75c683b7 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -768,6 +768,7 @@ account_widget_apply_clicked_cb (GtkWidget *button, EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + gboolean display_name_overridden; if (priv->radiobutton_reuse != NULL) { @@ -778,11 +779,15 @@ account_widget_apply_clicked_cb (GtkWidget *button, empathy_account_settings_set_boolean (priv->settings, "register", !reuse); } - if (priv->creating_account) + g_object_get (priv->settings, + "display-name-overridden", &display_name_overridden, NULL); + + if (priv->creating_account || !display_name_overridden) { gchar *display_name; - /* set default display name */ + /* set default display name for new accounts or update if user didn't + * manually override it. */ display_name = empathy_account_widget_get_default_display_name (self); empathy_account_settings_set_display_name_async (priv->settings, @@ -1631,6 +1636,7 @@ do_constructed (GObject *obj) EmpathyAccountWidgetPriv *priv = GET_PRIV (self); TpAccount *account; const gchar *protocol, *cm_name; + const gchar *display_name, *default_display_name; guint i = 0; struct { const gchar *cm_name; @@ -1780,6 +1786,16 @@ do_constructed (GObject *obj) empathy_builder_unref_and_keep_widget (self->ui_details->gui, self->ui_details->widget); self->ui_details->gui = NULL; + + display_name = empathy_account_settings_get_display_name (priv->settings); + default_display_name = empathy_account_widget_get_default_display_name (self); + + if (tp_strdiff (display_name, default_display_name)) + { + /* The display name of the account is not the one that we'd assign by + * default; assume that the user changed it manually */ + g_object_set (priv->settings, "display-name-overridden", TRUE, NULL); + } } static void @@ -1793,8 +1809,6 @@ do_dispose (GObject *obj) priv->dispose_run = TRUE; - empathy_account_settings_is_ready (priv->settings); - if (priv->settings != NULL) { TpAccount *account; diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 78b14456e..a67fc20cd 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -950,6 +950,13 @@ empathy_account_settings_set_display_name_async ( result = g_simple_async_result_new (G_OBJECT (settings), callback, user_data, empathy_account_settings_set_display_name_finish); + if (!tp_strdiff (name, priv->display_name)) + { + /* Nothing to do */ + g_simple_async_result_complete_in_idle (result); + return; + } + if (priv->account == NULL) { if (priv->display_name != NULL) |