Merge lp:~amigadave/gnome-control-center-signon/add-account-order into lp:gnome-control-center-signon

Proposed by David King
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 111
Merged at revision: 110
Proposed branch: lp:~amigadave/gnome-control-center-signon/add-account-order
Merge into: lp:gnome-control-center-signon
Diff against target: 81 lines (+27/-6)
2 files modified
src/cc-credentials-accounts-model.vala (+11/-6)
src/cc-credentials-accounts-page.vala (+16/-0)
To merge this branch: bzr merge lp:~amigadave/gnome-control-center-signon/add-account-order
Reviewer Review Type Date Requested Status
Alberto Mardegan (community) Approve
jenkins (community) continuous-integration Needs Fixing
Review via email: mp+126920@code.launchpad.net

Description of the change

Add new accounts to the bottom of the account list (but above the ‘Add accounts…’ row)

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

The code looks good and delivers the described functionality. But please verify with Calum whether this is actually desired (I'm not sure what problem we are trying to solve -- if it's about visibility of the new account, shouldn't we also select it as well)?

Revision history for this message
David King (amigadave) wrote :

The specification already says “The user’s accounts are listed in the order in which they are created.”, so this is just fixing up some previously-unnoticed behaviour, as before this change the account appeared at the top of the list (which was then sorted correctly after closing and opening the panel).

The UI specification indeed says that “[once] the account is created … information is shown about which applications on the desktop will use the account.” which means that the new account should be selected too. Fixing that should be quite straightforward.

111. By David King

Select new accounts automatically

The UI specification says that once “the account is created …
information is shown about which applications on the desktop will use
the account.” which means that the newly-created account should be
selected.

Revision history for this message
David King (amigadave) wrote :

This works well for me.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

And for me too :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/cc-credentials-accounts-model.vala'
2--- src/cc-credentials-accounts-model.vala 2012-07-09 11:19:21 +0000
3+++ src/cc-credentials-accounts-model.vala 2012-09-28 12:48:19 +0000
4@@ -97,10 +97,6 @@
5 set_column_types (types);
6
7 accounts_manager = new Ag.Manager ();
8- var accounts = accounts_manager.list ();
9-
10- accounts.foreach (add_account);
11-
12 // Add a placeholder row at the end of the list.
13 var add_account_text = _("Add account…");
14
15@@ -116,7 +112,7 @@
16 message ("Error looking up themed add icon: %s", error.message);
17 }
18
19- insert_with_values (null, int.MAX,
20+ insert_with_values (null, 0,
21 ModelColumns.ACCOUNT_ID, 0,
22 ModelColumns.PROVIDER_ICON, provider_icon,
23 ModelColumns.ACCOUNT_DESCRIPTION, add_account_text,
24@@ -124,6 +120,12 @@
25 ModelColumns.NEEDS_ATTENTION, false,
26 -1);
27
28+ var accounts = accounts_manager.list ();
29+
30+ // Sort by account ID.
31+ accounts.sort ((a, b) => { return (int)a - (int)b; });
32+ accounts.foreach (add_account);
33+
34 try
35 {
36
37@@ -169,8 +171,11 @@
38 return;
39 }
40
41+ /* Insert the new account at the bottom of the list of accounts, but
42+ * before the ‘Add account’ row.
43+ */
44 var record = fill_column_record (account_id);
45- insert_with_values (null, 0,
46+ insert_with_values (null, this.iter_n_children (null) - 1,
47 ModelColumns.ACCOUNT_ID, record.account_id,
48 ModelColumns.ACCOUNT, record.account,
49 ModelColumns.PROVIDER_ICON, record.icon,
50
51=== modified file 'src/cc-credentials-accounts-page.vala'
52--- src/cc-credentials-accounts-page.vala 2012-09-26 14:38:12 +0000
53+++ src/cc-credentials-accounts-page.vala 2012-09-28 12:48:19 +0000
54@@ -106,6 +106,9 @@
55 var selection = accounts_tree.get_selection ();
56 on_accounts_selection_changed (selection);
57
58+ // Update the selection if a new account was added.
59+ accounts_store.row_inserted.connect (on_accounts_store_row_inserted);
60+
61 set_size_request (-1, 400);
62
63 show ();
64@@ -408,4 +411,17 @@
65 {
66 account_edit_options_request (plugin);
67 }
68+
69+ /**
70+ * Select the newly-added row, as required by the UI specification.
71+ *
72+ * @param path the Gtk.TreePath of the newly-added row
73+ * @param iter the Gtk.TreeIter of the newly-added row
74+ */
75+ private void on_accounts_store_row_inserted (Gtk.TreePath path,
76+ Gtk.TreeIter iter)
77+ {
78+ var selection = accounts_tree.get_selection ();
79+ selection.select_iter (iter);
80+ }
81 }

Subscribers

People subscribed via source and target branches

to all changes: