diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-08-19 05:36:53 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-08-19 05:36:53 +0800 |
commit | cef2b039adb5f26d90493a161c92392d1ea68da0 (patch) | |
tree | fc81b34edeff06984d411fb42806cd3ba9d6a2b6 /src | |
parent | 30f2b4cfa51e63328cf3cbf76aa5b5b53b0dfde3 (diff) | |
download | gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar.gz gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar.bz2 gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar.lz gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar.xz gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.tar.zst gsoc2013-empathy-cef2b039adb5f26d90493a161c92392d1ea68da0.zip |
If display name of the selected account changes, update the label.
svn path=/trunk/; revision=1349
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-accounts-dialog.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 33d824c11..a9666f575 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -151,12 +151,24 @@ static void accounts_dialog_destroy_cb (GtkWidget EmpathyAccountsDialog *dialog); static void +accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog, + McAccount *account) +{ + gchar *text; + + text = g_markup_printf_escaped ("<big><b>%s</b></big>", + mc_account_get_display_name (account)); + gtk_label_set_markup (GTK_LABEL (dialog->label_name), text); + + g_free (text); +} + +static void accounts_dialog_update_account (EmpathyAccountsDialog *dialog, McAccount *account) { McProfile *profile; const gchar *config_ui; - gchar *text; if (!account) { GtkTreeView *view; @@ -254,11 +266,8 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog, gtk_widget_set_tooltip_text (dialog->image_type, mc_profile_get_display_name (profile)); - text = g_markup_printf_escaped ("<big><b>%s</b></big>", - mc_account_get_display_name (account)); - gtk_label_set_markup (GTK_LABEL (dialog->label_name), text); + accounts_dialog_update_name_label (dialog, account); - g_free (text); g_object_unref (profile); } @@ -816,6 +825,27 @@ accounts_dialog_account_enabled_cb (McAccountMonitor *monitor, } static void +accounts_dialog_account_changed_cb (McAccountMonitor *monitor, + gchar *unique_name, + EmpathyAccountsDialog *dialog) +{ + + McAccount *account; + McAccount *selected_account; + + account = mc_account_lookup (unique_name); + if (!account) { + return; + } + + accounts_dialog_add_or_update_account (dialog, account); + selected_account = accounts_dialog_model_get_selected (dialog); + if (empathy_account_equal (account, selected_account)) { + accounts_dialog_update_name_label (dialog, account); + } +} + +static void accounts_dialog_button_create_clicked_cb (GtkWidget *button, EmpathyAccountsDialog *dialog) { @@ -994,6 +1024,9 @@ accounts_dialog_destroy_cb (GtkWidget *widget, g_signal_handlers_disconnect_by_func (dialog->monitor, accounts_dialog_account_enabled_cb, dialog); + g_signal_handlers_disconnect_by_func (dialog->monitor, + accounts_dialog_account_changed_cb, + dialog); empathy_disconnect_account_status_changed (dialog->token); /* Delete incomplete accounts */ @@ -1101,6 +1134,9 @@ empathy_accounts_dialog_show (GtkWindow *parent, g_signal_connect (dialog->monitor, "account-disabled", G_CALLBACK (accounts_dialog_account_enabled_cb), dialog); + g_signal_connect (dialog->monitor, "account-changed", + G_CALLBACK (accounts_dialog_account_changed_cb), + dialog); dialog->token = empathy_connect_to_account_status_changed (dialog->mc, G_CALLBACK (accounts_dialog_status_changed_cb), dialog, NULL); |