aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts-dialog.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-03-07 18:31:48 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-03-22 20:04:43 +0800
commitf1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc (patch)
tree985d874300c6ae56e5604434c36477fbd20f86da /src/empathy-accounts-dialog.c
parentbaf46a1e06dbffd67facd46b0760b3a34a3dd1d2 (diff)
downloadgsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar.gz
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar.bz2
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar.lz
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar.xz
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.tar.zst
gsoc2013-empathy-f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc.zip
accounts_dialog_add_account: ensure that the selected account is still visible in the treeview
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r--src/empathy-accounts-dialog.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 2d8968c4b..ee601ac6b 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1788,6 +1788,7 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
const gchar *name;
gboolean enabled;
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+ gboolean selected = FALSE;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
status = tp_account_get_connection_status (account, NULL);
@@ -1797,7 +1798,16 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
settings = empathy_account_settings_new_for_account (account);
if (!accounts_dialog_get_account_iter (dialog, account, &iter))
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ {
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ }
+ else
+ {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+ selected = gtk_tree_selection_iter_is_selected (selection, &iter);
+ }
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COL_NAME, name,
@@ -1806,6 +1816,14 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
COL_ACCOUNT_SETTINGS, settings,
-1);
+ if (selected)
+ {
+ /* We just modified the selected account. Its display name may have been
+ * changed and so it's place in the treeview. Scroll to it so it stays
+ * visible. */
+ select_and_scroll_to_iter (dialog, &iter);
+ }
+
accounts_dialog_connection_changed_cb (account,
0,
status,