[empathy] accounts_dialog_add_account: select if that's the first account added



commit 4adfd6f5bf317845bed8b421c284ebb44097b5c5
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Feb 15 16:16:18 2012 +0100

    accounts_dialog_add_account: select if that's the first account added
    
    This ensures we'll select the first imported account.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670203

 src/empathy-accounts-dialog.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 35cb9bd..6c452b6 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1857,6 +1857,7 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
   const gchar        *name;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
   gboolean selected = FALSE;
+  GtkTreeSelection *selection;
 
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
   status = tp_account_get_connection_status (account, NULL);
@@ -1864,15 +1865,18 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
 
   settings = empathy_account_settings_new_for_account (account);
 
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+
   if (!accounts_dialog_get_account_iter (dialog, account, &iter))
     {
+      /* Select the account if it's the first added */
+      if (gtk_tree_selection_count_selected_rows (selection) == 0)
+        selected = TRUE;
+
       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);
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]