[empathy/gnome-2-34] accounts_dialog_add_account: ensure that the selected account is still visible in the treeview
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy/gnome-2-34] accounts_dialog_add_account: ensure that the selected account is still visible in the treeview
- Date: Tue, 22 Mar 2011 12:06:39 +0000 (UTC)
commit f1f0b2c029a92d3a6bb70e8f9dcefd89e0da01dc
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Mar 7 11:31:48 2011 +0100
accounts_dialog_add_account: ensure that the selected account is still visible in the treeview
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 2d8968c..ee601ac 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]