diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-15 23:02:27 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-15 23:14:31 +0800 |
commit | f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4 (patch) | |
tree | ffa346e7476a6cff68236443adf938b53c1a57eb /src | |
parent | a3c10ee7b1801aa50293bf85bf845f5110005bf1 (diff) | |
download | gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar.gz gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar.bz2 gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar.lz gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar.xz gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.tar.zst gsoc2013-empathy-f17b4a2962cdc74a3fc2e410b5885ae96e3ed4e4.zip |
reload the account widget when connection is (dis)connected
https://bugzilla.gnome.org/show_bug.cgi?id=671035
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-accounts-dialog.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 0bcf0ed21..2cc248251 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1791,6 +1791,15 @@ finally: } static void +reload_account_widget (EmpathyAccountsDialog *self) +{ + EmpathyAccountSettings *settings; + + settings = accounts_dialog_model_get_selected_settings (self); + accounts_dialog_update_settings (self, settings); +} + +static void accounts_dialog_connection_changed_cb (TpAccount *account, guint old_status, guint current, @@ -1904,6 +1913,40 @@ accounts_dialog_account_display_name_changed_cb (TpAccount *account, } static void +conn_prepare_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + EmpathyAccountsDialog *self = user_data; + + reload_account_widget (self); +} + +static void +accounts_dialog_notify_connection_cb (TpAccount *account, + GParamSpec *spec, + EmpathyAccountsDialog *self) +{ + TpConnection *conn; + if (!account_is_selected (self, account)) + return; + + conn = tp_account_get_connection (account); + if (conn == NULL) + { + reload_account_widget (self); + } + else + { + /* Wait for this feature so TpConnection will have fetch the + * self handle */ + GQuark features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 }; + + tp_proxy_prepare_async (conn, features, conn_prepare_cb, self); + } +} + +static void accounts_dialog_add_account (EmpathyAccountsDialog *dialog, TpAccount *account) { @@ -1968,6 +2011,8 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog, G_CALLBACK (accounts_dialog_connection_changed_cb), dialog, 0); tp_g_signal_connect_object (account, "presence-changed", G_CALLBACK (accounts_dialog_presence_changed_cb), dialog, 0); + tp_g_signal_connect_object (account, "notify::connection", + G_CALLBACK (accounts_dialog_notify_connection_cb), dialog, 0); g_object_unref (settings); } |