]> git.0d.be Git - empathy.git/commitdiff
accounts_dialog_add_account: select if that's the first account added
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 15 Feb 2012 15:16:18 +0000 (16:16 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 16 Feb 2012 13:10:32 +0000 (14:10 +0100)
This ensures we'll select the first imported account.

https://bugzilla.gnome.org/show_bug.cgi?id=670203

src/empathy-accounts-dialog.c

index 35cb9bdb3fe26f609fdf3ad5d21158b25e1b4477..6c452b6b2bd05e67d86fc57557e8c869a336383d 100644 (file)
@@ -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);
     }