diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-03-07 18:31:48 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-03-22 20:05:45 +0800 |
commit | 3bea79c93cd58333c4ccaee60afe98f861001afd (patch) | |
tree | e58f518885618d2cd7884d83b2763f71bfab47ac | |
parent | 0b9a9d0171d55523519249a55971c9f4f051dc4c (diff) | |
download | gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar.gz gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar.bz2 gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar.lz gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar.xz gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.tar.zst gsoc2013-empathy-3bea79c93cd58333c4ccaee60afe98f861001afd.zip |
accounts_dialog_add_account: ensure that the selected account is still visible in the treeview
-rw-r--r-- | src/empathy-accounts-dialog.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 87ddba0bb..83179a8b9 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1774,6 +1774,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); @@ -1783,7 +1784,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, @@ -1792,6 +1802,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, |