]> git.0d.be Git - empathy.git/commitdiff
accounts-dialog: don't always select the first account automatically
authorJonny Lamb <jonnylamb@gnome.org>
Tue, 3 Nov 2009 10:38:19 +0000 (10:38 +0000)
committerJonny Lamb <jonnylamb@gnome.org>
Tue, 3 Nov 2009 10:38:19 +0000 (10:38 +0000)
Sometimes it takes a while to get all account details, but getting the
account names is fairly quick. What tends to happen is that the tree
view of account names is populated immediately, but the account widget
is just grey until all details are retrieved. This time is enough to
select an account in the tree view for editing.

However, previously, once all details are retrieved, the first account
is automatically selected. This is of course sensible if the user has
not selected an account, but it's pretty annoying if you've already
selected your seventeenth jabber account and then it plonks you back
to number one.

This patch only selects the first account if there is not one already
selected.

Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
src/empathy-accounts-dialog.c

index 860d61531ee97ce51edc01bf67aefc043bf5f0dc..2a09e277b42659ae88221bc928b4ae537951de54 100644 (file)
@@ -542,14 +542,19 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
     {
       GtkTreeView  *view;
       GtkTreeModel *model;
+      GtkTreeSelection *selection;
 
       view = GTK_TREE_VIEW (priv->treeview);
       model = gtk_tree_view_get_model (view);
+      selection = gtk_tree_view_get_selection (view);
 
       if (gtk_tree_model_iter_n_children (model, NULL) > 0)
         {
-          /* We have configured accounts, select the first one */
-          accounts_dialog_model_select_first (dialog);
+          /* We have configured accounts, select the first one if there
+           * is no other account selected already. */
+          if (!gtk_tree_selection_get_selected (selection, NULL, NULL))
+            accounts_dialog_model_select_first (dialog);
+
           return;
         }
       if (empathy_connection_managers_get_cms_num (priv->cms) > 0)