After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774222 - Update the Online Accounts panel UI
Update the Online Accounts panel UI
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Online Accounts
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
Control-Center Maintainers
: 702345 (view as bug list)
Depends on: 778353
Blocks: 779187
 
 
Reported: 2016-11-10 17:09 UTC by Georges Basile Stavracas Neto
Modified: 2017-02-24 16:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
online-accounts: turn into a final template class (14.68 KB, patch)
2016-11-10 17:09 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: use a listbox instead of a treeview (42.48 KB, patch)
2016-11-10 17:09 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: use the ui file to connect to signals (4.21 KB, patch)
2016-11-10 17:09 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: use a dialog to manage the online account (10.98 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
needs-work Details | Review
online-accounts: make the main listbox non-selectable (7.67 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add a header label (1.80 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: make the entire panel scrollable (11.06 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add a providers listbox to the panel (11.54 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: remove unused widgets (16.24 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add a stack to the account dialog (3.51 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: make adding an account inline to the edit dialog (6.06 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
none Details | Review
online-account: explicitly remove the dialog's border width (1.05 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: add a remove button to the account dialog (2.39 KB, patch)
2016-11-10 17:10 UTC, Georges Basile Stavracas Neto
none Details | Review
online-account: bring back account removal (12.49 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: fix indentation (6.63 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: keep account editor dialog visible when adding account (2.92 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: small UI improvement (1.18 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: add separators between listbox rows (1.73 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: hide remove button when account is locked (1.77 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: add a bottom row to display non-branded providers (6.79 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: drop GoaAddAccountDialog (22.53 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: add an offline message label (3.29 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: make the account editor box vertical (1.22 KB, patch)
2016-11-10 17:11 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: align the panel widgets in the middle (5.44 KB, patch)
2016-11-10 21:19 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: only show the accounts list when there are accounts (2.91 KB, patch)
2016-11-10 21:29 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: only show the accounts list when there are accounts (2.92 KB, patch)
2016-11-10 21:40 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: turn into a final template class (14.67 KB, patch)
2016-11-25 22:31 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: use a listbox instead of a treeview (42.49 KB, patch)
2016-11-26 10:08 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: Fix the namespace prefix (1.31 KB, patch)
2016-11-30 16:17 UTC, Debarshi Ray
committed Details | Review
online-accounts: Use G_DECLARE_FINAL_TYPE (2.01 KB, patch)
2016-11-30 16:17 UTC, Debarshi Ray
committed Details | Review
online-accounts: Remove unnecessary code (1.73 KB, patch)
2016-11-30 16:17 UTC, Debarshi Ray
committed Details | Review
online-accounts: Turn into a template class (12.98 KB, patch)
2016-11-30 16:18 UTC, Debarshi Ray
committed Details | Review
online-accounts: Use a listbox instead of a treeview (42.73 KB, patch)
2016-11-30 16:18 UTC, Debarshi Ray
committed Details | Review
online-accounts: Use a dialog to manage the online account (15.01 KB, patch)
2016-11-30 19:14 UTC, Debarshi Ray
committed Details | Review
online-accounts: Use a dialog to manage the online account (14.41 KB, patch)
2016-12-15 18:12 UTC, Debarshi Ray
committed Details | Review
online-accounts: Update the UI if IsLocked changes (2.01 KB, patch)
2016-12-15 18:41 UTC, Debarshi Ray
committed Details | Review
online-accounts: Make the main listbox non-selectable (7.32 KB, patch)
2016-12-15 18:42 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add a header label as per the latest mockups (1.73 KB, patch)
2017-01-03 14:05 UTC, Debarshi Ray
committed Details | Review
online-accounts: Simplify setting the margin (1.15 KB, patch)
2017-01-03 14:05 UTC, Debarshi Ray
committed Details | Review
online-accounts: Remove unused 'id' (1.12 KB, patch)
2017-01-03 16:06 UTC, Debarshi Ray
committed Details | Review
online-accounts: Make the entire panel scrollable (11.12 KB, patch)
2017-01-03 16:07 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add a providers listbox to the panel (10.42 KB, patch)
2017-01-03 17:00 UTC, Debarshi Ray
committed Details | Review
online-accounts: Remove unused widgets (15.46 KB, patch)
2017-01-03 17:43 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add a stack to the account dialog (3.58 KB, patch)
2017-01-03 17:58 UTC, Debarshi Ray
committed Details | Review
online-accounts: make adding an account inline to the edit dialog (6.66 KB, patch)
2017-01-25 22:53 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: explicitly remove the dialog's border width (1.04 KB, patch)
2017-01-25 22:53 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add a remove button to the account dialog (2.40 KB, patch)
2017-01-25 22:53 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: bring back account removal (12.20 KB, patch)
2017-01-25 22:53 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: keep account editor dialog visible when adding account (2.96 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
reviewed Details | Review
online-accounts: small UI improvement (1.48 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add separators between listbox rows (1.68 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: hide remove button when account is locked (2.22 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add a bottom row to display non-branded providers (6.60 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: drop GoaAddAccountDialog (22.55 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add an offline message label (3.51 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: make the account editor box vertical (1.23 KB, patch)
2017-01-25 22:54 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: align the panel widgets in the middle (5.07 KB, patch)
2017-01-25 22:55 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: only show the accounts list when there are accounts (2.93 KB, patch)
2017-01-25 22:55 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: Fix typo (1.06 KB, patch)
2017-02-08 16:29 UTC, Debarshi Ray
committed Details | Review
online-accounts: Make adding an account inline to the edit dialog (5.77 KB, patch)
2017-02-08 16:30 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add a remove button to the account dialog (2.35 KB, patch)
2017-02-08 17:30 UTC, Debarshi Ray
committed Details | Review
online-accounts: Bring back account removal (16.64 KB, patch)
2017-02-13 13:44 UTC, Debarshi Ray
committed Details | Review
online-accounts: Small UI improvement (1.50 KB, patch)
2017-02-13 13:57 UTC, Debarshi Ray
committed Details | Review
online-accounts: Hide remove button when account is locked (2.07 KB, patch)
2017-02-13 14:57 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add a bottom row to display non-branded providers (6.68 KB, patch)
2017-02-13 16:18 UTC, Georges Basile Stavracas Neto
accepted-commit_now Details | Review
online-accounts: Add an offline message label (3.57 KB, patch)
2017-02-13 16:18 UTC, Georges Basile Stavracas Neto
accepted-commit_after_freeze Details | Review
online-accounts: Align the panel widgets in the middle (5.42 KB, patch)
2017-02-13 16:19 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: Only show the accounts list when there are accounts (2.95 KB, patch)
2017-02-13 16:19 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: Make the account editor box vertical (1.23 KB, patch)
2017-02-13 16:19 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: Add a bottom row to display non-branded providers (6.73 KB, patch)
2017-02-15 11:22 UTC, Debarshi Ray
committed Details | Review
online-accounts: Add an offline message label (3.58 KB, patch)
2017-02-15 14:11 UTC, Debarshi Ray
committed Details | Review
online-accounts: Align the panel widgets in the middle (10.68 KB, patch)
2017-02-16 11:42 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: Only show the accounts list when there are accounts (2.98 KB, patch)
2017-02-16 11:44 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: always keep editor dialog size the minimum (2.47 KB, patch)
2017-02-16 12:01 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: add margins to the rows' icons (1.67 KB, patch)
2017-02-16 12:08 UTC, Georges Basile Stavracas Neto
committed Details | Review
online-accounts: Only show the accounts list when there are accounts (3.95 KB, patch)
2017-02-20 11:15 UTC, Georges Basile Stavracas Neto
none Details | Review
online-accounts: Shuffle some code around (2.60 KB, patch)
2017-02-22 12:28 UTC, Debarshi Ray
committed Details | Review
online-accounts: Consolidate the row modification code a bit (4.62 KB, patch)
2017-02-22 12:29 UTC, Debarshi Ray
committed Details | Review
online-accounts: Only show the accounts list when there are accounts (3.19 KB, patch)
2017-02-22 12:29 UTC, Debarshi Ray
committed Details | Review

Description Georges Basile Stavracas Neto 2016-11-10 17:09:41 UTC
We have new mockups for the Online Accounts panel. This bug is meant to track G-C-C side of the changes - GOA patches will be provided soon.
Comment 1 Georges Basile Stavracas Neto 2016-11-10 17:09:47 UTC
Created attachment 339508 [details] [review]
online-accounts: turn into a final template class

Since CcPanel has support for G_DEFINE_{FINAL|DERIVABLE}_TYPE now,
lets use it in the Online Accounts panel and simplify some code.
Comment 2 Georges Basile Stavracas Neto 2016-11-10 17:09:54 UTC
Created attachment 339509 [details] [review]
online-accounts: use a listbox instead of a treeview

As part of the port to the redesigned Online Accounts panel,
the main widget to be displayed is a GtkListBox, so we can have
finer control of the UI elements and eventually be able to put
real widgets instead of using cell renderers.

This commit, then, makes the Online Account panel use a listbox
widget in the sidebar. The behavior of the panel was not changed.

Since its using a listbox now, we can drop the custom GoaPanelAccountsModel
class.
Comment 3 Georges Basile Stavracas Neto 2016-11-10 17:09:59 UTC
Created attachment 339510 [details] [review]
online-accounts: use the ui file to connect to signals

Simplify the code by using the GtkBuilder file to connect to
the signals instead of manually doing it in the code.
Comment 4 Georges Basile Stavracas Neto 2016-11-10 17:10:05 UTC
Created attachment 339511 [details] [review]
online-accounts: use a dialog to manage the online account

Following the mockups, the Online Accounts panel shall use
a modal dialog to edit online accounts.

This commit moves the current widgets to a dialog, and show
this dialog whenever an account is selected.
Comment 5 Georges Basile Stavracas Neto 2016-11-10 17:10:11 UTC
Created attachment 339512 [details] [review]
online-accounts: make the main listbox non-selectable

Instead of selecting an account, this commit makes the account
editor dialog only visible through explicit activation of the
account row.

As a side effect, this commit temporarily makes removing an
account non-functional.
Comment 6 Georges Basile Stavracas Neto 2016-11-10 17:10:16 UTC
Created attachment 339513 [details] [review]
online-accounts: add a header label

Add a header label as per the latest mockups.
Comment 7 Georges Basile Stavracas Neto 2016-11-10 17:10:22 UTC
Created attachment 339514 [details] [review]
online-accounts: make the entire panel scrollable

The current implementation of the Online Accounts panel
allows only the account list to scroll. To prepare ouselves
for the future changes, lets make the entire panel scrollable.
Comment 8 Georges Basile Stavracas Neto 2016-11-10 17:10:27 UTC
Created attachment 339515 [details] [review]
online-accounts: add a providers listbox to the panel

This commit starts moving the contents of the add account dialog
class to the panel itself, by adding a providers listbox below
the list of available account as per the new mockups.

The next commits are focused on finishing this move and removing
the add account dialog.
Comment 9 Georges Basile Stavracas Neto 2016-11-10 17:10:33 UTC
Created attachment 339516 [details] [review]
online-accounts: remove unused widgets

These widgets are not used anymore, and they're not present in
the latest designs.
Comment 10 Georges Basile Stavracas Neto 2016-11-10 17:10:39 UTC
Created attachment 339517 [details] [review]
online-accounts: add a stack to the account dialog

This will be used to unify the account creation proccess and
the account editor.
Comment 11 Georges Basile Stavracas Neto 2016-11-10 17:10:45 UTC
Created attachment 339518 [details] [review]
online-accounts: make adding an account inline to the edit dialog

When adding an account, the old proccess was: use the (removed) toolbar
to open the New Account dialog, select a provider in that dialog, add
the account and see the newly created account in the panel itself.

That approach had issues, e.g. the user would have to close the dialog
if she mistakenly selected a provider. After moving the provider list
to the panel itself, it doesn't make sense anymore to have another
provider list inside the dialog.

Fix this by moving the new account view to the accounts dialog.
Comment 12 Georges Basile Stavracas Neto 2016-11-10 17:10:50 UTC
Created attachment 339519 [details] [review]
online-account: explicitly remove the dialog's border width

Looks like Gtk+ assumes all dialogs' internal-vbox widgets have a
2px border, so explicitly set it to 0.
Comment 13 Georges Basile Stavracas Neto 2016-11-10 17:10:55 UTC
Created attachment 339520 [details] [review]
online-accounts: add a remove button to the account dialog

After temporarily removing the ability to delete accounts in efa03cfa57b,
lets start bringing it back again by adding a Remove Account button to the
account editor dialog, as per the recent mockups.
Comment 14 Georges Basile Stavracas Neto 2016-11-10 17:11:01 UTC
Created attachment 339521 [details] [review]
online-account: bring back account removal

Following the previous commit, this commit effectively brings
back the account removal feature that was temporarily removed
by efa03cfa57b.

This is now reimplemented as an in-app notification, and users
now have the option to undo an accidentally removed account.
Comment 15 Georges Basile Stavracas Neto 2016-11-10 17:11:07 UTC
Created attachment 339522 [details] [review]
online-accounts: fix indentation

To not clutter the previous commit, the indentation of the
UI file was not changed. This commit does nothing but fix
the indentation.
Comment 16 Georges Basile Stavracas Neto 2016-11-10 17:11:14 UTC
Created attachment 339523 [details] [review]
online-accounts: keep account editor dialog visible when adding account

When adding a new account, the account editor dialog always gets hidden
when any response is given. This breaks, e.g., the ownCloud process, and
hides the dialog while it's still validating the account.

Fix that by only hiding the dialog on cancel or close.
Comment 17 Georges Basile Stavracas Neto 2016-11-10 17:11:19 UTC
Created attachment 339524 [details] [review]
online-accounts: small UI improvement

Add more margin to the lists.
Comment 18 Georges Basile Stavracas Neto 2016-11-10 17:11:25 UTC
Created attachment 339525 [details] [review]
online-accounts: add separators between listbox rows
Comment 19 Georges Basile Stavracas Neto 2016-11-10 17:11:32 UTC
Created attachment 339526 [details] [review]
online-accounts: hide remove button when account is locked
Comment 20 Georges Basile Stavracas Neto 2016-11-10 17:11:38 UTC
Created attachment 339527 [details] [review]
online-accounts: add a bottom row to display non-branded providers

As per the mockups, and mimicking the dialog behavior, add a bottom
row that shows non-branded providers.
Comment 21 Georges Basile Stavracas Neto 2016-11-10 17:11:44 UTC
Created attachment 339528 [details] [review]
online-accounts: drop GoaAddAccountDialog

The dialog is not used anymore, and can be safely removed.
Comment 22 Georges Basile Stavracas Neto 2016-11-10 17:11:50 UTC
Created attachment 339529 [details] [review]
online-accounts: add an offline message label

When offline, we currently block the new accounts listbox
so that users can't add new accounts. There is, however,
no visual indication that we're offline, besides the listbox.

Fix that by adding a descriptive label that's only visible
when offline.
Comment 23 Georges Basile Stavracas Neto 2016-11-10 17:11:56 UTC
Created attachment 339530 [details] [review]
online-accounts: make the account editor box vertical

When credentials expire, they're being added horizontally since
this is the default value of the GtkOrientable:orientation property.

Fix that by making the account editor box vertical, and adding some
spacing.
Comment 24 Georges Basile Stavracas Neto 2016-11-10 21:19:19 UTC
Created attachment 339543 [details] [review]
online-accounts: align the panel widgets in the middle

The current implementation of the Online Accounts panel allows
2 states: either the widgets of the panel fill the whole horizontal
space, or they shrink and fill only the absolutely minimum. The
ideal solution, however, is to make them grow with the panel.

Fix that by turn the main box into a GtkGrid, and adding stub widgets
that expand horizontally and pull the main widgets to the middle,
allowing them to cover at most 1/3 of the screen.
Comment 25 Georges Basile Stavracas Neto 2016-11-10 21:29:37 UTC
Created attachment 339544 [details] [review]
online-accounts: only show the accounts list when there are accounts

When the user has no account set, the current implementation of the Online
Accounts panel shows a weird 1px line that is the empty list.

Fix that by only showing the list when there are accounts available.
Comment 26 Georges Basile Stavracas Neto 2016-11-10 21:40:08 UTC
Created attachment 339550 [details] [review]
online-accounts: only show the accounts list when there are accounts

Found an issue in the last patch.
Comment 27 Debarshi Ray 2016-11-21 18:59:32 UTC
Review of attachment 339508 [details] [review]:

Thanks for these patches!

::: panels/online-accounts/cc-online-accounts-panel.c
@@ -243,3 @@
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-  context = gtk_widget_get_style_context (panel->toolbar);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);

This chunk is not really related to this patch. Could you please split it into a separate one?

::: panels/online-accounts/cc-online-accounts-panel.h
@@ +26,3 @@
 G_BEGIN_DECLS
 
+#define CC_TYPE_ONLINE_ACCOUNTS_PANEL (cc_goa_panel_get_type())

While it doesn't break the build or anything, this isn't right. Typo? :)

The correct thing to do would be to do:
s/CC_GOA_TYPE_PANEL/CC_TYPE_GOA_PANEL
... in a separate patch.
Comment 28 Debarshi Ray 2016-11-21 20:11:10 UTC
Review of attachment 339509 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +420,3 @@
   else
     {
+      show_page_nothing_selected (self);

This isn't getting called for the 'no configured accounts' case. I don't know why.

::: panels/online-accounts/online-accounts.ui
@@ -33,3 @@
                     <child>
-                      <object class="GtkTreeView" id="accounts_treeview">
-                        <property name="width_request">278</property>

Without the width_request, the list box will be very narrow when there are no accounts ...

@@ +35,3 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="vexpand">True</property>

... and the vexpand isn't really needed.

Not a big deal, but would be nice to avoid spurious changes.

@@ +37,3 @@
+                        <property name="vexpand">True</property>
+                        <property name="selection_mode">browse</property>
+                        <signal name="row-selected" handler="on_listbox_selection_changed" object="CcGoaPanel" swapped="no" />

Isn't swapped="no" the default? If we really want to be verbose then there is also G_CONNECT_AFTER. :)
Comment 29 Georges Basile Stavracas Neto 2016-11-25 22:31:22 UTC
Created attachment 340778 [details] [review]
online-accounts: turn into a final template class

Code review applied.
Comment 30 Georges Basile Stavracas Neto 2016-11-26 10:08:09 UTC
Created attachment 340790 [details] [review]
online-accounts: use a listbox instead of a treeview

Code review applied.
Comment 31 Debarshi Ray 2016-11-30 16:15:43 UTC
Review of attachment 340778 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ -243,3 @@
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-  context = gtk_widget_get_style_context (panel->toolbar);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);

Would have been nice to split this out.
Comment 32 Debarshi Ray 2016-11-30 16:15:52 UTC
Review of attachment 340790 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ -295,3 @@
-
- out:
-  gtk_widget_show_all (GTK_WIDGET (panel));

Let's keep this and use GtkWidget:no-show-all. See below.

@@ +438,2 @@
+  /* Select the first row */
+  gtk_list_box_select_row (listbox, gtk_list_box_get_row_at_index (listbox, 0));

We need to call show_page_nothing_selected here. Otherwise, it won't properly show the empty view if the panel is started without any accounts.

@@ +459,3 @@
+  box = g_object_new (GTK_TYPE_BOX,
+                      "spacing", 6,
+                      "margin", 6,

We didn't have a margin.

@@ +477,3 @@
     }
 
+  icon = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DND);

GTK_ICON_SIZE_DIALOG, not DND.

Creating a GtkImage with a NULL GIcon will lead to a CRITICAL. Even though the GIcon will only be NULL on a broken system, it would be nice to avoid the CRITICAL since we already handle the GError.

@@ +491,3 @@
+                        "xalign", 0.0,
+                        "use-markup", TRUE,
+                        "hexpand", TRUE,

We should also set ellipsize=END.

@@ +498,3 @@
+
+  /* "Needs attention" icon */
+  icon = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_BUTTON);

It will be safer to set GtkWidget:no-show-all on 'icon', instead of selectively calling gtk_widget_show on the others.

@@ +499,3 @@
+  /* "Needs attention" icon */
+  icon = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_BUTTON);
+  gtk_style_context_add_class (gtk_widget_get_style_context (icon), "dim-label");

If this is needed by the new design, then we should do it in a separate patch.

@@ +553,3 @@
+
+  children = gtk_container_get_children (GTK_CONTAINER (self->accounts_listbox));
+  prev = NULL;

'prev' is not needed because GList is a doubly-linked list.

@@ +563,3 @@
+      if (row_object == object)
+        {
+          gtk_list_box_select_row (GTK_LIST_BOX (self->accounts_listbox), prev ? prev->data : NULL);

We also need to account for the case where 'prev' might be NULL. ie. deleting the first account in a list of more than one accounts.

@@ +723,3 @@
+  gint response;
+
+  selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (panel->accounts_listbox));

I would check selected_row for NULL here. Just in case, you know.

::: panels/online-accounts/online-accounts.ui
@@ +35,3 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="width_request">278</property>

Since we set hexpand=TRUE on the GtkLabels in each row, we need to set hexpand=FALSE on the GtkListBox for the width_request to be honoured. This is different from calling gtk_tree_view_column_pack_start with expand=TRUE.

Sorry for not mentioning this earlier.
Comment 33 Debarshi Ray 2016-11-30 16:17:12 UTC
Created attachment 341069 [details] [review]
online-accounts: Fix the namespace prefix

I took the liberty to fix the above issues and pushed to master.
Comment 34 Debarshi Ray 2016-11-30 16:17:28 UTC
Created attachment 341070 [details] [review]
online-accounts: Use G_DECLARE_FINAL_TYPE
Comment 35 Debarshi Ray 2016-11-30 16:17:49 UTC
Created attachment 341071 [details] [review]
online-accounts: Remove unnecessary code
Comment 36 Debarshi Ray 2016-11-30 16:18:06 UTC
Created attachment 341072 [details] [review]
online-accounts: Turn into a template class
Comment 37 Debarshi Ray 2016-11-30 16:18:25 UTC
Created attachment 341073 [details] [review]
online-accounts: Use a listbox instead of a treeview
Comment 38 Debarshi Ray 2016-11-30 16:26:48 UTC
Review of attachment 339510 [details] [review]:

Perfect! Pushed to master.
Comment 39 Debarshi Ray 2016-11-30 16:28:39 UTC
*** Bug 702345 has been marked as a duplicate of this bug. ***
Comment 40 Debarshi Ray 2016-11-30 19:11:57 UTC
Review of attachment 339511 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +378,3 @@
+
+  gtk_header_bar_set_subtitle (GTK_HEADER_BAR (panel->edit_account_headerbar),
+                               goa_account_get_presentation_identity (account));

These mockups specify the header bar title as "<GoaAccount:provider-name> account":
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/online-accounts/aday-alt/online-accounts-account-dialogs.png

@@ -386,3 @@
     }
 
-  gtk_list_box_select_row (GTK_LIST_BOX (panel->accounts_listbox), account_row);

This will break the following command line invocation:
$ gnome-control-center online-accounts account_1480532693_35

@@ -553,3 @@
       if (row_object == object)
         {
-          gtk_list_box_select_row (GTK_LIST_BOX (self->accounts_listbox), prev ? prev->data : NULL);

Since we are no longer selecting a new row after removing an account, it will be nice to teach on_listbox_selection_changed to check if the GtkListBox is empty before calling show_page_nothing_selected.

::: panels/online-accounts/online-accounts.ui
@@ +143,2 @@
                 <child>
+                  <object class="GtkButton" id="add_account_button">

Can't we completely remove this? The new designs don't have any "Add an online account" text, and it would certainly make the diff more readable.
Comment 41 Debarshi Ray 2016-11-30 19:14:17 UTC
Created attachment 341082 [details] [review]
online-accounts: Use a dialog to manage the online account

I address the above comments, and tried to keep it as functional as possible.
Comment 42 Debarshi Ray 2016-12-15 16:34:19 UTC
Comment on attachment 339511 [details] [review]
online-accounts: use a dialog to manage the online account

This is an obsolete patch that was marked as needs-work. I changed it to committed by mistake. Sorry.
Comment 43 Debarshi Ray 2016-12-15 18:12:29 UTC
Created attachment 342035 [details] [review]
online-accounts: Use a dialog to manage the online account

I should never touch a computer while I am hungry and sleepy. Somehow had managed to attach the wrong version of the patch, while I actually pushed the right one.

Sorry.
Comment 44 Debarshi Ray 2016-12-15 18:40:06 UTC
Review of attachment 339512 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +374,3 @@
                       const gchar *account_id)
 {
+  GoaObject *row_object;

Looks suspicious. See below.

@@ +388,1 @@
       account = goa_object_peek_account (row_object);

Looks like a typo. row_object would be NULL here. The s/row_object/object/ change seems unnecessary.

@@ -553,3 @@
-
-  if (selected_object == object)
-    show_page_account (panel, selected_object);

I wouldn't remove this.

Even with the new designs, if the account that we are looking at changes state (ie, GoaClient::account-changed is emitted) we will have to update the UI. Since GtkListBox doesn't offer a way to get the last activated row, I think we should track it ourselves and update the UI if the active object changes.

::: panels/online-accounts/online-accounts.ui
@@ +37,3 @@
                         <property name="vexpand">True</property>
+                        <property name="selection_mode">none</property>
+                        <signal name="row-activated" handler="on_listbox_row_activated" object="CcGoaPanel" swapped="no" />

We can do swapped="yes" since the GtkListBox is an instance variable.
Comment 45 Debarshi Ray 2016-12-15 18:41:37 UTC
Created attachment 342038 [details] [review]
online-accounts: Update the UI if IsLocked changes

Fixes a minor bug and will simplify future changes.
Comment 46 Debarshi Ray 2016-12-15 18:42:40 UTC
Created attachment 342039 [details] [review]
online-accounts: Make the main listbox non-selectable

I took the liberty to rebase it against current master and makd the above changes.
Comment 47 Debarshi Ray 2017-01-03 14:04:20 UTC
Review of attachment 339513 [details] [review]:

::: panels/online-accounts/online-accounts.ui
@@ +12,2 @@
         <property name="spacing">18</property>
+        <property name="margin">18</property>

Don't we need even more than 18? I am looking at:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/online-accounts/aday-alt/online-accounts-panel.png

Or we can just commit the addition of the GtkLabel and do the pixel counting in a later commit.
Comment 48 Debarshi Ray 2017-01-03 14:05:34 UTC
Created attachment 342768 [details] [review]
online-accounts: Add a header label as per the latest mockups

I pushed the bit that adds the GtkLabel without changing the margin and border-width, since those need to be higher anyway.
Comment 49 Debarshi Ray 2017-01-03 14:05:55 UTC
Created attachment 342770 [details] [review]
online-accounts: Simplify setting the margin
Comment 50 Debarshi Ray 2017-01-03 14:28:13 UTC
Review of attachment 339514 [details] [review]:

Are you sure about this? The new mockups [1] are not terribly explicit about how scrolling should work, but it gives the impression that only the list boxes should scroll. Or am I missing something?

[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/online-accounts/aday-alt/online-accounts-panel.png
Comment 51 Debarshi Ray 2017-01-03 14:42:28 UTC
(In reply to Debarshi Ray from comment #50)
> Review of attachment 339514 [details] [review] [review]:
> 
> Are you sure about this? The new mockups [1] are not terribly explicit about
> how scrolling should work, but it gives the impression that only the list
> boxes should scroll. Or am I missing something?

From #gnome-design on GIMPNet:

14:29 <rishi> feaneron: aday: Hey! Am I misunderstanding something here:        
      https://bugzilla.gnome.org/show_bug.cgi?id=774222#c50 ?
14:30 <aday> rishi: the whole panel should scroll
14:31 <aday> like the notifications panel
Comment 52 Debarshi Ray 2017-01-03 16:06:21 UTC
Review of attachment 339514 [details] [review]:

Looks great, apart from one minor nitpick and the fact that it needs to be rebased on top of master.

::: panels/online-accounts/online-accounts.ui
@@ +42,3 @@
+                        <child>
+                          <object class="GtkListBox" id="accounts_listbox">
+                            <property name="visible">True</property>

Now that the GtkScrolledWindow's min-content-height doesn't directly affect the list box, we need to (temporarily) set vexpand=TRUE so that:
(a) the GtkListBox doesn't disappear when there are no accounts
(b) seems like the 'add' button doesn't work with the mouse pointer when that happens
Comment 53 Debarshi Ray 2017-01-03 16:06:54 UTC
Created attachment 342776 [details] [review]
online-accounts: Remove unused 'id'
Comment 54 Debarshi Ray 2017-01-03 16:07:24 UTC
Created attachment 342777 [details] [review]
online-accounts: Make the entire panel scrollable

Rebased and pushed.
Comment 55 Debarshi Ray 2017-01-03 16:59:51 UTC
Review of attachment 339515 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +130,3 @@
+  gtk_container_add (GTK_CONTAINER (self->providers_listbox), row);
+
+  image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DND);

GTK_ICON_SIZE_DIALOG, not DND.

@@ +157,3 @@
+
+  return g_strcmp0 (goa_provider_get_provider_name (a_provider, NULL),
+                    goa_provider_get_provider_name (b_provider, NULL));

Umm... we shouldn't sort the providers alphabetically. Long ago, we decided to sort them based on some vague hand-wavy perception of their popularity, and the quality of integration in GNOME. It seems that the new mockups haven't changed this.

This order is hard-coded inside gnome-online-accounts, and goa_provider_get_all respects it:
https://git.gnome.org/browse/gnome-online-accounts/tree/src/goabackend/goaprovider.c#n108
Comment 56 Debarshi Ray 2017-01-03 17:00:51 UTC
Created attachment 342778 [details] [review]
online-accounts: Add a providers listbox to the panel

Rebased, fixed and pushed.
Comment 57 Debarshi Ray 2017-01-03 17:42:26 UTC
Review of attachment 339516 [details] [review]:

Looks good, but needs to be rebased.
Comment 58 Debarshi Ray 2017-01-03 17:43:07 UTC
Created attachment 342783 [details] [review]
online-accounts: Remove unused widgets

Rebased and pushed.
Comment 59 Debarshi Ray 2017-01-03 17:57:27 UTC
Review of attachment 339517 [details] [review]:

Looks good, apart from needing a rebase.
Comment 60 Debarshi Ray 2017-01-03 17:58:01 UTC
Created attachment 342785 [details] [review]
online-accounts: Add a stack to the account dialog

Rebased and pushed.
Comment 61 Debarshi Ray 2017-01-04 14:37:41 UTC
Review of attachment 339518 [details] [review]:

::: panels/online-accounts/online-accounts.ui
@@ +79,3 @@
     <property name="resizable">False</property>
     <property name="modal">True</property>
+    <signal name="response" handler="gtk_widget_hide" object="edit_account_dialog" swapped="no" />

We can't hide the GtkDialog on every 'response' emission. The code inside goa_provider_add_account may emit 'response' multiple times and it isn't always appropriate to hide the dialog. eg., if you click 'connect' with a wrong password when adding an ownCloud account. Instead of hiding it, you want to show a message and let the user re-enter the password. If we hide it like this, then the user will see it flicker as it gets hidden and then shown.

Instead, we should hide it after goa_provider_add_account returns.

In a broader sense, I think it might be easier to destroy the GtkDialog than trying to re-use the same instance across multiple provider and account types. eg., if you try to add an ownCloud account after adding a Google account, the dialog is taller than it needs to be.

Some of the GoaProvider sub-classes don't disconnect their signal handlers from the dialog when the add_account vfunc ends. This means that they can run into a memory error next time the dialog is used. Ideally, they should disconnect, but destroying the dialog is more defensive.

And if we do decide to destroy it, it might be nicer to move the dialog into its own sub-class and files.

Thoughts?
Comment 62 Georges Basile Stavracas Neto 2017-01-25 22:53:34 UTC
Created attachment 344264 [details] [review]
online-accounts: make adding an account inline to the edit dialog

When adding an account, the old proccess was: use the (removed) toolbar
to open the New Account dialog, select a provider in that dialog, add
the account and see the newly created account in the panel itself.

That approach had issues, e.g. the user would have to close the dialog
if she mistakenly selected a provider. After moving the provider list
to the panel itself, it doesn't make sense anymore to have another
provider list inside the dialog.

Fix this by moving the new account view to the accounts dialog.
Comment 63 Georges Basile Stavracas Neto 2017-01-25 22:53:43 UTC
Created attachment 344265 [details] [review]
online-accounts: explicitly remove the dialog's border width

Looks like Gtk+ assumes all dialogs' internal-vbox widgets have a
2px border, so explicitly set it to 0.
Comment 64 Georges Basile Stavracas Neto 2017-01-25 22:53:50 UTC
Created attachment 344266 [details] [review]
online-accounts: add a remove button to the account dialog

After temporarily removing the ability to delete accounts in efa03cfa57b,
lets start bringing it back again by adding a Remove Account button to the
account editor dialog, as per the recent mockups.
Comment 65 Georges Basile Stavracas Neto 2017-01-25 22:53:57 UTC
Created attachment 344267 [details] [review]
online-accounts: bring back account removal

Following the previous commit, this commit effectively brings
back the account removal feature that was temporarily removed
by efa03cfa57b.

This is now reimplemented as an in-app notification, and users
now have the option to undo an accidentally removed account.
Comment 66 Georges Basile Stavracas Neto 2017-01-25 22:54:07 UTC
Created attachment 344268 [details] [review]
online-accounts: keep account editor dialog visible when adding account

When adding a new account, the account editor dialog always gets hidden
when any response is given. This breaks, e.g., the ownCloud process, and
hides the dialog while it's still validating the account.

Fix that by only hiding the dialog on cancel or close.
Comment 67 Georges Basile Stavracas Neto 2017-01-25 22:54:14 UTC
Created attachment 344269 [details] [review]
online-accounts: small UI improvement

Add more margin to the lists.
Comment 68 Georges Basile Stavracas Neto 2017-01-25 22:54:21 UTC
Created attachment 344270 [details] [review]
online-accounts: add separators between listbox rows
Comment 69 Georges Basile Stavracas Neto 2017-01-25 22:54:28 UTC
Created attachment 344271 [details] [review]
online-accounts: hide remove button when account is locked
Comment 70 Georges Basile Stavracas Neto 2017-01-25 22:54:36 UTC
Created attachment 344272 [details] [review]
online-accounts: add a bottom row to display non-branded providers

As per the mockups, and mimicking the dialog behavior, add a bottom
row that shows non-branded providers.
Comment 71 Georges Basile Stavracas Neto 2017-01-25 22:54:44 UTC
Created attachment 344273 [details] [review]
online-accounts: drop GoaAddAccountDialog

The dialog is not used anymore, and can be safely removed.
Comment 72 Georges Basile Stavracas Neto 2017-01-25 22:54:52 UTC
Created attachment 344274 [details] [review]
online-accounts: add an offline message label

When offline, we currently block the new accounts listbox
so that users can't add new accounts. There is, however,
no visual indication that we're offline, besides the listbox.

Fix that by adding a descriptive label that's only visible
when offline.
Comment 73 Georges Basile Stavracas Neto 2017-01-25 22:54:59 UTC
Created attachment 344275 [details] [review]
online-accounts: make the account editor box vertical

When credentials expire, they're being added horizontally since
this is the default value of the GtkOrientable:orientation property.

Fix that by making the account editor box vertical, and adding some
spacing.
Comment 74 Georges Basile Stavracas Neto 2017-01-25 22:55:07 UTC
Created attachment 344276 [details] [review]
online-accounts: align the panel widgets in the middle

The current implementation of the Online Accounts panel allows
2 states: either the widgets of the panel fill the whole horizontal
space, or they shrink and fill only the absolutely minimum. The
ideal solution, however, is to make them grow with the panel.

Fix that by turn the main box into a GtkGrid, and adding stub widgets
that expand horizontally and pull the main widgets to the middle,
allowing them to cover at most 1/3 of the screen.
Comment 75 Georges Basile Stavracas Neto 2017-01-25 22:55:15 UTC
Created attachment 344277 [details] [review]
online-accounts: only show the accounts list when there are accounts

When the user has no account set, the current implementation of the Online
Accounts panel shows a weird 1px line that is the empty list.

Fix that by only showing the list when there are accounts available.
Comment 76 Georges Basile Stavracas Neto 2017-02-07 13:17:52 UTC
(In reply to Debarshi Ray from comment #61)

> We can't hide the GtkDialog on every 'response' emission. The code inside
> goa_provider_add_account may emit 'response' multiple times and it isn't
> always appropriate to hide the dialog. eg., if you click 'connect' with a
> wrong password when adding an ownCloud account. Instead of hiding it, you
> want to show a message and let the user re-enter the password. If we hide it
> like this, then the user will see it flicker as it gets hidden and then
> shown.

That's correct.

> Instead, we should hide it after goa_provider_add_account returns.

OK.

> In a broader sense, I think it might be easier to destroy the GtkDialog than
> trying to re-use the same instance across multiple provider and account
> types. eg., if you try to add an ownCloud account after adding a Google
> account, the dialog is taller than it needs to be.

This can be fixed (and I couldn't reproduce).
 
> Some of the GoaProvider sub-classes don't disconnect their signal handlers
> from the dialog when the add_account vfunc ends. This means that they can
> run into a memory error next time the dialog is used. Ideally, they should
> disconnect, but destroying the dialog is more defensive.

I have no strong feelings about either destroying or keeping it alive, except that keeping it alive makes the code much smaller. If GOA has issues not disconnecting some signals, I can gladly fix those issues in GOA. But yet, I don't see any strong and appealing reasons to destroy it and make it a custom class.
Comment 77 Debarshi Ray 2017-02-08 16:29:09 UTC
Review of attachment 344264 [details] [review]:

Thanks for the rebases, Georges! Some minor comments:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +130,3 @@
   if (provider == NULL)
     {
+      g_object_set_data (G_OBJECT (row), "goa-provider", NULL);

Oops. That was my mistake. Sorry. Would be nice to split it out, though.

@@ +182,3 @@
+                                     GTK_DIALOG (self->edit_account_dialog),
+                                     GTK_BOX (self->new_account_vbox),
+                                     &error);

As mentioned in comment 61, we shouldn't hide the dialog on every response event. Instead we should do it after returning from goa_provider_add_account if object == NULL.

@@ +185,3 @@
+
+  if (object)
+    show_page_account (self, object);

Between successfully adding an account and showing it, I see a flicker - as if the window got hidden and re-shown. I was expecting a smooth GtkStack transition instead. Do you see this too? I am seeing this even after fixing the above problem.
Comment 78 Debarshi Ray 2017-02-08 16:29:59 UTC
Created attachment 345248 [details] [review]
online-accounts: Fix typo
Comment 79 Debarshi Ray 2017-02-08 16:30:46 UTC
Created attachment 345249 [details] [review]
online-accounts: Make adding an account inline to the edit dialog

I took the liberty to avoid hiding on every response. However the flickering between add and show is still there.
Comment 80 Debarshi Ray 2017-02-08 16:33:12 UTC
Review of attachment 344265 [details] [review]:

++
Comment 81 Debarshi Ray 2017-02-08 16:39:06 UTC
(In reply to Debarshi Ray from comment #61)
> Some of the GoaProvider sub-classes don't disconnect their signal handlers
> from the dialog when the add_account vfunc ends. This means that they can
> run into a memory error next time the dialog is used. Ideally, they should
> disconnect, but destroying the dialog is more defensive.

I filed bug 778353
Comment 82 Debarshi Ray 2017-02-08 17:06:35 UTC
Review of attachment 344266 [details] [review]:

::: panels/online-accounts/online-accounts.ui
@@ +117,3 @@
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkBox"  id="accounts_vbox">

Nitpick: tiny whitespace oddity.

@@ +128,3 @@
+                    <property name="valign">end</property>
+                    <property name="halign">end</property>
+                    <property name="vexpand">True</property>

Are you sure that we should vexpand the GtkButton, and not the GtkBox above it? It seems to work as expected right now. I am worried that it might break if things get moved around or gtk+ subtly changes behaviour.
Comment 83 Georges Basile Stavracas Neto 2017-02-08 17:19:37 UTC
(In reply to Debarshi Ray from comment #82)

> Are you sure that we should vexpand the GtkButton, and not the GtkBox above
> it? It seems to work as expected right now. I am worried that it might break
> if things get moved around or gtk+ subtly changes behaviour.

I don't expect GtkBox to change it's behavior. It was declared stable, and changing it without further noticing devs would be a bug. But if moving the 'vexpand' to the parent box works, I don't mind having it there.
Comment 84 Debarshi Ray 2017-02-08 17:30:04 UTC
Created attachment 345252 [details] [review]
online-accounts: Add a remove button to the account dialog

Moved the vexpand to accounts_vbox and pushed.
Comment 85 Debarshi Ray 2017-02-08 18:47:32 UTC
Review of attachment 344267 [details] [review]:

Nice. Thanks for implementing undoable delete.

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +42,3 @@
   GoaObject *active_object;
 
+  GoaObject *edited_object;

This is the same as active_object.

@@ +718,3 @@
+      GoaObject *row_object = g_object_get_data (l->data, "goa-object");
+
+      if (goa_object_peek_account (row_object) == account)

You can directly use the GoaObject. See below.

@@ +829,3 @@
+
+  /* Show the notification... */
+  label = g_strdup_printf (_("Account <b>%s</b> removed"), goa_account_get_presentation_identity (account));

The comments are redundant. :) Your code is quite readable and self-explanatory. On the other hand, it would be good to add a comment explaining the '%s' for translators.

By the way, did the designers ask for the bold face? We usually try to avoid exposing such markup to translators, and at least some other applications don't use it. For example, see bug 745756

@@ +835,3 @@
+
+  /* ... and hide both the account row and the account dialog */
+  row = get_row_for_account (panel, account);

Just pass panel->removed_object instead of account.

@@ +841,3 @@
+
+  /* Fire up a timer to remove the account */
+  panel->remove_account_timeout_id = g_timeout_add_seconds (7, on_remove_account_timeout, panel);

Curious - why 7? :) Are other notifications using 7 second timeouts? For what it's worth, Documents and Photos use 10 seconds.

::: panels/online-accounts/online-accounts.ui
@@ +47,3 @@
+                        <style>
+                          <class name="flat" />
+                          <class name="image-button" />

The "image-button" style class is auto-magically added by GtkButton.

@@ +66,3 @@
+            </child>
+          </object>
+        </child>

Nitpick: the identation is off.

I'd really like to split this entire file into separate smaller widgets. As the amount of XML increases, it gets harder to read it, understand diffs and resolve conflicts. But we can do it later. Not a blocker for this patch.
Comment 86 Debarshi Ray 2017-02-13 13:44:38 UTC
Created attachment 345626 [details] [review]
online-accounts: Bring back account removal

Tweaked the notification string to be '<b>foo@bar.org</b> removed', as suggested by Allan in #gnome-design; fixed the rest of the issues; and pushed.
Comment 87 Debarshi Ray 2017-02-13 13:50:16 UTC
Review of attachment 344268 [details] [review]:

Georges, could you please confirm this:

::: panels/online-accounts/online-accounts.ui
@@ +145,3 @@
     <property name="modal">True</property>
     <signal name="delete-event" handler="on_edit_account_dialog_delete_event" object="CcGoaPanel" swapped="yes" />
+    <signal name="response" handler="on_dialog_response" object="CcGoaPanel" swapped="no" />

This might not be needed anymore. Cancelling and closing the dialog is taken care of by the delete-event handler. Plus, we hide it once after goa_provider_add_account returns.
Comment 88 Debarshi Ray 2017-02-13 13:57:28 UTC
Review of attachment 344269 [details] [review]:

Needs to be rebased.
Comment 89 Debarshi Ray 2017-02-13 13:57:55 UTC
Created attachment 345629 [details] [review]
online-accounts: Small UI improvement
Comment 90 Debarshi Ray 2017-02-13 14:03:15 UTC
Review of attachment 344270 [details] [review]:

++
Comment 91 Debarshi Ray 2017-02-13 14:16:55 UTC
Review of attachment 344271 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +493,3 @@
 
+  /* Hide the Remove button for locked accounts */
+  is_locked = goa_account_get_is_locked (goa_object_peek_account (object));

We can use 'account' from the following block of code.
Comment 92 Debarshi Ray 2017-02-13 14:57:29 UTC
Created attachment 345630 [details] [review]
online-accounts: Hide remove button when account is locked
Comment 93 Debarshi Ray 2017-02-13 15:21:18 UTC
Review of attachment 344273 [details] [review]:

++
Comment 94 Debarshi Ray 2017-02-13 15:22:46 UTC
Review of attachment 344272 [details] [review]:

Needs to be rebased.
Comment 95 Debarshi Ray 2017-02-13 15:50:01 UTC
(In reply to Debarshi Ray from comment #87)
> Review of attachment 344268 [details] [review] [review]:
> 
> Georges, could you please confirm this:
> 
> ::: panels/online-accounts/online-accounts.ui
> @@ +145,3 @@
>      <property name="modal">True</property>
>      <signal name="delete-event"
> handler="on_edit_account_dialog_delete_event" object="CcGoaPanel"
> swapped="yes" />
> +    <signal name="response" handler="on_dialog_response"
> object="CcGoaPanel" swapped="no" />
> 
> This might not be needed anymore. Cancelling and closing the dialog is taken
> care of by the delete-event handler. Plus, we hide it once after
> goa_provider_add_account returns.

From #control-center on GIMPNet:

15:23 <rishi> feaneron: Question for you:                                       
      https://bugzilla.gnome.org/show_bug.cgi?id=774222#c87
15:35 <feaneron> rishi: you're right about the first comment
15:35 <feaneron> sorry, that slipped through during the rebase
15:35 <feaneron> no need to have that "+ <signal..." line
Comment 96 Georges Basile Stavracas Neto 2017-02-13 16:18:17 UTC
Created attachment 345640 [details] [review]
online-accounts: Add a bottom row to display non-branded providers

As per the mockups, and mimicking the dialog behavior, add a bottom
row that shows non-branded providers.
Comment 97 Georges Basile Stavracas Neto 2017-02-13 16:18:48 UTC
Created attachment 345641 [details] [review]
online-accounts: Add an offline message label

When offline, we currently block the new accounts listbox
so that users can't add new accounts. There is, however,
no visual indication that we're offline, besides the listbox.

Fix that by adding a descriptive label that's only visible
when offline.
Comment 98 Georges Basile Stavracas Neto 2017-02-13 16:19:02 UTC
Created attachment 345642 [details] [review]
online-accounts: Align the panel widgets in the middle

The current implementation of the Online Accounts panel allows
2 states: either the widgets of the panel fill the whole horizontal
space, or they shrink and fill only the absolutely minimum. The
ideal solution, however, is to make them grow with the panel.

Fix that by turn the main box into a GtkGrid, and adding stub widgets
that expand horizontally and pull the main widgets to the middle,
allowing them to cover at most 1/3 of the screen.
Comment 99 Georges Basile Stavracas Neto 2017-02-13 16:19:28 UTC
Created attachment 345643 [details] [review]
online-accounts: Only show the accounts list when there are accounts

When the user has no account set, the current implementation of the Online
Accounts panel shows a weird 1px line that is the empty list.

Fix that by only showing the list when there are accounts available.
Comment 100 Georges Basile Stavracas Neto 2017-02-13 16:19:43 UTC
Created attachment 345644 [details] [review]
online-accounts: Make the account editor box vertical

When credentials expire, they're being added horizontally since
this is the default value of the GtkOrientable:orientation property.

Fix that by making the account editor box vertical, and adding some
spacing.
Comment 101 Debarshi Ray 2017-02-15 11:21:03 UTC
Review of attachment 345640 [details] [review]:

Thanks for the rebase, Georges. Looks good apart from some minor details:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +129,3 @@
   GtkWidget *row;
   GtkWidget *row_grid;
+  GIcon *icon;

Nitpick: tiny little spurious change.

@@ +164,3 @@
+  features = goa_provider_get_provider_features (provider);
+
+  if ((features & GOA_PROVIDER_FEATURE_BRANDED) > 0)

I'll sleep better if you checked for inequality instead.

An enumerated type is only guaranteed to be large enough to hold 'int' values. However compilers are allowed to choose the actual type used to represent an enum. For example, if the constants are small enough to fit into a smaller type or are positive, then the compiler might go for something other than 'int'. Right now, GoaProviderFeatures doesn't have any negative constants, so this code might be fine, but there are no guarantees.

Checking for inequality saves us the trouble of reading the C specification, experimenting with language implementations, and some head-scratching. Plus it's more common. :)

@@ +185,3 @@
+  self = user_data;
+
+  if (a == (GtkListBoxRow*) self->more_providers_row)

Nitpick: would be nice to use GTK_LIST_BOX (...) instead.

Since GObject is primarily a run-time type system, it's nice to have the added run-time assertions, as long as it doesn't hurt performance.

@@ +194,3 @@
+
+  a_branded = (goa_provider_get_provider_features (a_provider) & GOA_PROVIDER_FEATURE_BRANDED) > 0;
+  b_branded = (goa_provider_get_provider_features (b_provider) & GOA_PROVIDER_FEATURE_BRANDED) > 0;

Same thing about using inequality.

@@ +197,3 @@
+
+  if (a_branded != b_branded)
+    return b_branded - a_branded;

Again, I'll sleep better if you opened this code up a bit.

In C, any non-zero counts as 'true'. So both negative and positive values will evaluate as a logical true expression.
Comment 102 Debarshi Ray 2017-02-15 11:22:12 UTC
Created attachment 345808 [details] [review]
online-accounts: Add a bottom row to display non-branded providers

Fixed the above issues.
Comment 103 Debarshi Ray 2017-02-15 14:07:38 UTC
Review of attachment 345641 [details] [review]:

I can't test this because NetworkManager is not correctly reflecting my connectivity status. It thinks I am connected even if I have switched off all my interfaces. However, the patch is quite straightforward, so I'll assume that it works.

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +451,3 @@
   goa_provider_get_all (get_all_providers_cb, panel);
 
+  gtk_widget_show (GTK_WIDGET (panel));

Setting GtkWidget:no-show-all on the GtkLabel might be slightly safer, but if it works, then fine.

::: panels/online-accounts/online-accounts.ui
@@ +97,3 @@
+                    <property name="can_focus">False</property>
+                    <property name="wrap">True</property>
+                    <property name="label" translatable="yes">No internet connection - connect to setup new online accounts</property>

Would be nicer to use the Unicode em-dash ('—') instead.
Comment 104 Debarshi Ray 2017-02-15 14:11:02 UTC
Created attachment 345825 [details] [review]
online-accounts: Add an offline message label

Changed it to use the Unicode em-dash.
Comment 105 Debarshi Ray 2017-02-15 14:50:45 UTC
Review of attachment 345642 [details] [review]:

++
Comment 106 Debarshi Ray 2017-02-15 15:15:37 UTC
Review of attachment 345643 [details] [review]:

Needs a few fixes to make it work the undoable remove.

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +716,3 @@
   gtk_container_add (GTK_CONTAINER (self->accounts_listbox), row);
   gtk_widget_show_all (row);
+  gtk_widget_show (self->accounts_frame);

We need to do the same in on_undo_button_clicked ...

@@ +760,3 @@
 
+  /* Hide the list if we removed the last account */
+  gtk_widget_set_visible (self->accounts_frame, children != NULL);

... and the same in on_remove_button_clicked. The comment is a bit redundant, but whatever.
Comment 107 Debarshi Ray 2017-02-15 15:21:06 UTC
Review of attachment 345644 [details] [review]:

++
Comment 108 Debarshi Ray 2017-02-15 15:28:45 UTC
Review of attachment 345643 [details] [review]:

Another problem is that when we hide the accounts list, the row spacing between the heading and the providers list gets doubled. We need to avoid this for any row whose visibility might get toggled. One option could be to use GtkWidget:margin-{bottom,top} instead of GtkGrid:row-spacing for spacing.

This might (I can't test) also affect the label that we added to indicate the absence of network connectivity.
Comment 109 Debarshi Ray 2017-02-15 15:38:23 UTC
(In reply to Debarshi Ray from comment #103)
> Review of attachment 345641 [details] [review] [review]:
> 
> I can't test this because NetworkManager is not correctly reflecting my
> connectivity status. It thinks I am connected even if I have switched off
> all my interfaces. However, the patch is quite straightforward, so I'll
> assume that it works.

That's bug 778688 for the record.
Comment 110 Debarshi Ray 2017-02-15 15:46:18 UTC
What is supposed to happen if an account needs attention? Right now it opens a second pop-up to let the user interact.

(In reply to Debarshi Ray from comment #61)
> In a broader sense, I think it might be easier to destroy the GtkDialog than
> trying to re-use the same instance across multiple provider and account
> types. eg., if you try to add an ownCloud account after adding a Google
> account, the dialog is taller than it needs to be.

This problem is still present.

> Some of the GoaProvider sub-classes don't disconnect their signal handlers
> from the dialog when the add_account vfunc ends. This means that they can
> run into a memory error next time the dialog is used. Ideally, they should
> disconnect, but destroying the dialog is more defensive.

That's bug 778353
Comment 111 Georges Basile Stavracas Neto 2017-02-16 11:42:43 UTC
Created attachment 345934 [details] [review]
online-accounts: Align the panel widgets in the middle

The current implementation of the Online Accounts panel allows
2 states: either the widgets of the panel fill the whole horizontal
space, or they shrink and fill only the absolutely minimum. The
ideal solution, however, is to make them grow with the panel.

Fix that by turn the main box into a GtkGrid, and adding stub widgets
that expand horizontally and pull the main widgets to the middle,
allowing them to cover at most 1/3 of the screen. The widgets themselves
are inside a GtkBox, so that hiding them automatically removes the
spacing in between.
Comment 112 Georges Basile Stavracas Neto 2017-02-16 11:44:43 UTC
Created attachment 345935 [details] [review]
online-accounts: Only show the accounts list when there are accounts

Updated to match the rework.
Comment 113 Georges Basile Stavracas Neto 2017-02-16 12:01:09 UTC
Created attachment 345936 [details] [review]
online-accounts: always keep editor dialog size the minimum

When adding and editing accounts, the different options that Online
Accounts provides may require different sizes of the dialog. There
is, however, a specific issue where the dialog can't resize because
a provider widget is interefering with the others.

Fix that by making the dialog's stack non-homogeneous, and making
sure to always reset the dialog size before showing it.
Comment 114 Georges Basile Stavracas Neto 2017-02-16 12:08:55 UTC
Created attachment 345937 [details] [review]
online-accounts: add margins to the rows' icons

Per Allan's request, add more margin to the rows' icons.
Comment 115 Debarshi Ray 2017-02-17 16:13:23 UTC
Review of attachment 345937 [details] [review]:

++
Comment 116 Debarshi Ray 2017-02-17 16:21:21 UTC
Review of attachment 345936 [details] [review]:

++

Let's get this in. Preventing the dialog from getting expanding under certain situations isn't really a UI freeze break. It's a bug fix.
Comment 117 Debarshi Ray 2017-02-17 16:22:03 UTC
(In reply to Debarshi Ray from comment #116)
> Review of attachment 345936 [details] [review] [review]:
> 
> ++
> 
> Let's get this in. Preventing the dialog from getting expanding under
> certain situations isn't really a UI freeze break. It's a bug fix.

"from expanding"
Comment 118 Debarshi Ray 2017-02-17 16:24:56 UTC
Comment on attachment 345937 [details] [review]
online-accounts: add margins to the rows' icons

From #release-team on GIMPNet:

16:22 <rishi> Do I need to ask from freeze break exceptions for things like     
      adding margin around icons?
16:22 <rishi> *ask for
16:22 <mcatanzaro> rishi: No
16:23 <mcatanzaro> It's not *that* strict :P
Comment 119 Debarshi Ray 2017-02-17 16:32:40 UTC
Review of attachment 345935 [details] [review]:

As mentioned in comment 106, I think:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +721,3 @@
   gtk_container_add (GTK_CONTAINER (self->accounts_listbox), row);
   gtk_widget_show_all (row);
+  gtk_widget_show (self->accounts_frame);

We need to do the same in on_undo_button_clicked ...

@@ +765,3 @@
 
+  /* Hide the list if we removed the last account */
+  gtk_widget_set_visible (self->accounts_frame, children != NULL);

... and the same in on_remove_button_clicked. The comment is a bit redundant, but whatever.
Comment 120 Debarshi Ray 2017-02-17 16:34:38 UTC
Review of attachment 345934 [details] [review]:

Looks better. Using a GtkBox instead of a GtkGrid to hold the column of widgets seems to have fixed the problem of left-over row-spacing when hiding rows. However, let's till the other patch is nailed down to avoid needless to and fro at this late hour.
Comment 121 Georges Basile Stavracas Neto 2017-02-20 11:15:10 UTC
Created attachment 346255 [details] [review]
online-accounts: Only show the accounts list when there are accounts

When the user has no account set, the current implementation of the Online
Accounts panel shows a weird 1px line that is the empty list.

Fix that by only showing the list when there are accounts available.
Comment 122 Debarshi Ray 2017-02-22 12:27:44 UTC
Review of attachment 346255 [details] [review]:

::: panels/online-accounts/cc-online-accounts-panel.c
@@ +945,3 @@
 
+  children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_listbox));
+  gtk_widget_set_visible (panel->accounts_frame, children != NULL);

This doesn't work because hiding a child won't remove it from the list of children.
Comment 123 Debarshi Ray 2017-02-22 12:28:53 UTC
Created attachment 346430 [details] [review]
online-accounts: Shuffle some code around

I spotted an opportunity for some clean-ups and took the liberty to fix the above issue.
Comment 124 Debarshi Ray 2017-02-22 12:29:08 UTC
Created attachment 346431 [details] [review]
online-accounts: Consolidate the row modification code a bit
Comment 125 Debarshi Ray 2017-02-22 12:29:33 UTC
Created attachment 346432 [details] [review]
online-accounts: Only show the accounts list when there are accounts
Comment 126 Georges Basile Stavracas Neto 2017-02-23 02:10:33 UTC
Attachment 345644 [details] pushed as 4662c5b - online-accounts: Make the account editor box vertical
Attachment 345808 [details] pushed as e9198bd - online-accounts: Add a bottom row to display non-branded providers
Attachment 345825 [details] pushed as 1e580c6 - online-accounts: Add an offline message label
Attachment 345934 [details] pushed as 1594d8c - online-accounts: Align the panel widgets in the middle
Attachment 346430 [details] pushed as 25f97f1 - online-accounts: Shuffle some code around
Attachment 346431 [details] pushed as af7c214 - online-accounts: Consolidate the row modification code a bit
Attachment 346432 [details] pushed as fa81d16 - online-accounts: Only show the accounts list when there are accounts

Thanks Debarshi for this extensive work of review, and all the corrections you did throughout the process. Lets follow up this work with eventual bugfixes.