Merge lp:~elementary-pantheon/switchboard-plug-onlineaccounts/accountview-redesign into lp:~elementary-apps/switchboard-plug-onlineaccounts/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Corentin Noël
Approved revision: 321
Merged at revision: 318
Proposed branch: lp:~elementary-pantheon/switchboard-plug-onlineaccounts/accountview-redesign
Merge into: lp:~elementary-apps/switchboard-plug-onlineaccounts/trunk
Diff against target: 335 lines (+65/-96)
7 files modified
plugins/Providers/FastMail/fastmail-mail.service (+2/-2)
plugins/Providers/Google/google-gmail.service (+2/-2)
plugins/Providers/Microsoft/microsoft-mails.service (+2/-2)
src/CMakeLists.txt (+1/-1)
src/Translation.vala (+2/-2)
src/Views/ACListBox.vala (+10/-19)
src/Views/AccountView.vala (+46/-68)
To merge this branch: bzr merge lp:~elementary-pantheon/switchboard-plug-onlineaccounts/accountview-redesign
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+300642@code.launchpad.net

Commit message

AccountView.vala:
* Use provider icon
* Put user name and provider name on separate lines
* Remove extra grid
* Don't cast when we don't need to
* Put switch on the outside
* Emails -> Email
* Add apps to the main view

To post a comment you must log in.
321. By Danielle Foré

rename the ACLPopover

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Providers/FastMail/fastmail-mail.service'
2--- plugins/Providers/FastMail/fastmail-mail.service 2016-07-20 16:09:07 +0000
3+++ plugins/Providers/FastMail/fastmail-mail.service 2016-07-21 07:55:52 +0000
4@@ -1,8 +1,8 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6 <service id="fastmail-mail">
7 <type>mail</type>
8- <name>Emails</name>
9- <description>Sync your emails</description>
10+ <name>Email</name>
11+ <description>Sync your email</description>
12 <icon>internet-mail</icon>
13 <provider>fastmail</provider>
14 <translations>pantheon-online-accounts</translations>
15
16=== modified file 'plugins/Providers/Google/google-gmail.service'
17--- plugins/Providers/Google/google-gmail.service 2016-04-25 16:14:02 +0000
18+++ plugins/Providers/Google/google-gmail.service 2016-07-21 07:55:52 +0000
19@@ -1,8 +1,8 @@
20 <?xml version="1.0" encoding="UTF-8"?>
21 <service id="google-gmail">
22 <type>mail</type>
23- <name>Emails</name>
24- <description>Sync your emails</description>
25+ <name>Email</name>
26+ <description>Sync your email</description>
27 <icon>internet-mail</icon>
28 <provider>google</provider>
29 <translations>pantheon-online-accounts</translations>
30
31=== modified file 'plugins/Providers/Microsoft/microsoft-mails.service'
32--- plugins/Providers/Microsoft/microsoft-mails.service 2016-01-14 21:54:38 +0000
33+++ plugins/Providers/Microsoft/microsoft-mails.service 2016-07-21 07:55:52 +0000
34@@ -1,8 +1,8 @@
35 <?xml version="1.0" encoding="UTF-8"?>
36 <service id="microsoft-mails">
37 <type>mail</type>
38- <name>Emails</name>
39- <description>Sync your emails</description>
40+ <name>Email</name>
41+ <description>Sync your email</description>
42 <icon>internet-mail</icon>
43 <provider>microsoft</provider>
44 <translations>pantheon-online-accounts</translations>
45
46=== modified file 'src/CMakeLists.txt'
47--- src/CMakeLists.txt 2015-09-24 18:33:58 +0000
48+++ src/CMakeLists.txt 2016-07-21 07:55:52 +0000
49@@ -26,7 +26,7 @@
50 OnlineAccounts.vala
51 Views/SourceSelector.vala
52 Views/AccountView.vala
53- Views/ACLPopover.vala
54+ Views/ACListBox.vala
55 Authentification/Server.vala
56 Authentification/DialogService.vala
57 Authentification/RequestQueue.vala
58
59=== modified file 'src/Translation.vala'
60--- src/Translation.vala 2016-07-20 16:09:07 +0000
61+++ src/Translation.vala 2016-07-21 07:55:52 +0000
62@@ -26,8 +26,8 @@
63 _("Contacts");
64 _("Sync your contacts");
65 _("Sync your files");
66-_("Emails");
67-_("Sync your emails");
68+_("Email");
69+_("Sync your email");
70 _("Sync your photos");
71 _("Watch your newsfeed");
72 _("Chat with your friends");
73
74=== renamed file 'src/Views/ACLPopover.vala' => 'src/Views/ACListBox.vala'
75--- src/Views/ACLPopover.vala 2016-07-20 16:09:07 +0000
76+++ src/Views/ACListBox.vala 2016-07-21 07:55:52 +0000
77@@ -20,37 +20,25 @@
78 * Authored by: Corentin Noël <corentin@elementary.io>
79 */
80
81-public class OnlineAccounts.ACLPopover : Gtk.Popover {
82+public class OnlineAccounts.ACListBox : Gtk.ListBox {
83 Ag.Account account;
84 Signon.Identity identity;
85 unowned Signon.SecurityContextList acl = null;
86- Gtk.ListBox list_box;
87 Ag.Service service;
88
89- public ACLPopover (Ag.Account account, Ag.Service service, Signon.Identity identity) {
90+ public ACListBox (Ag.Account account, Ag.Service service, Signon.Identity identity) {
91 this.account = account;
92 this.service = service;
93 this.identity = identity;
94 account.manager.list_applications_by_service (service).foreach ((app) => {
95 var row = new AppRow (account, app, service, identity);
96- list_box.add (row);
97+ add (row);
98 row.show_all ();
99 });
100
101 update_acl.begin ();
102 }
103
104- construct {
105- height_request = 100;
106- list_box = new Gtk.ListBox ();
107- var scrolled = new Gtk.ScrolledWindow (null, null);
108- scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER;
109- scrolled.margin = 6;
110- scrolled.expand = true;
111- scrolled.add (list_box);
112- add (scrolled);
113- }
114-
115 private async void update_acl () {
116 identity.query_info ((self, info, error) => {
117 if (error != null) {
118@@ -59,7 +47,7 @@
119 }
120
121 acl = info.get_access_control_list ();
122- list_box.get_children ().foreach ((child) => {
123+ get_children ().foreach ((child) => {
124 var approw = child as AppRow;
125 approw.check_acl (acl);
126 });
127@@ -67,14 +55,14 @@
128 }
129
130 public void allow_service () {
131- list_box.get_children ().foreach ((child) => {
132+ get_children ().foreach ((child) => {
133 var approw = child as AppRow;
134 approw.allow_app ();
135 });
136 }
137
138 public void deny_service () {
139- list_box.get_children ().foreach ((child) => {
140+ get_children ().foreach ((child) => {
141 var approw = child as AppRow;
142 approw.deny_app ();
143 });
144@@ -102,12 +90,15 @@
145 construct {
146 activatable = false;
147 selectable = false;
148+ margin = 6;
149+
150 app_image = new Gtk.Image ();
151- app_image.icon_size = Gtk.IconSize.LARGE_TOOLBAR;
152+ app_image.icon_size = Gtk.IconSize.DND;
153 app_name = new Gtk.Label (null);
154 app_name.halign = Gtk.Align.START;
155 app_name.hexpand = true;
156 app_switch = new Gtk.Switch ();
157+ app_switch.valign = Gtk.Align.CENTER;
158 app_switch.activate.connect (() => {
159 if (app_switch.active) {
160 allow_app ();
161
162=== modified file 'src/Views/AccountView.vala'
163--- src/Views/AccountView.vala 2015-09-24 17:22:45 +0000
164+++ src/Views/AccountView.vala 2016-07-21 07:55:52 +0000
165@@ -21,94 +21,79 @@
166 */
167
168 public class OnlineAccounts.AccountView : Gtk.Grid {
169- Gtk.Grid main_grid;
170 OnlineAccounts.Account plugin;
171 Signon.Identity identity;
172
173 public AccountView (OnlineAccounts.Account plugin) {
174+ column_spacing = 6;
175+ row_spacing = 3;
176+ margin = 24;
177 orientation = Gtk.Orientation.VERTICAL;
178 this.plugin = plugin;
179- main_grid = new Gtk.Grid ();
180- main_grid.orientation = Gtk.Orientation.VERTICAL;
181- main_grid.margin = 12;
182- main_grid.column_spacing = 6;
183- main_grid.row_spacing = 6;
184
185 plugin.account.select_service (null);
186 var v_id = plugin.account.get_variant (OnlineAccounts.Account.gsignon_id, null);
187 identity = new Signon.Identity.from_db (v_id.get_uint32 ());
188
189- string label_str = plugin.account.manager.get_provider (plugin.account.get_provider_name ()).get_display_name ();
190- var name = plugin.account.get_display_name ();
191- if (name != "" && name != null) {
192- label_str = "%s - %s".printf (plugin.account.get_display_name (), label_str);
193- }
194-
195- var user_label = new Gtk.Label (Markup.escape_text (label_str));
196- Granite.Widgets.Utils.apply_text_style_to_label (Granite.TextStyle.H2, user_label);
197+ var provider = plugin.account.get_manager ().get_provider (plugin.account.get_provider_name ());
198+
199+ var provider_image = new Gtk.Image.from_icon_name (provider.get_icon_name (), Gtk.IconSize.DIALOG);
200+ provider_image.use_fallback = true;
201+
202+ var user_label = new Gtk.Label (Markup.escape_text (plugin.account.get_display_name ()));
203+ user_label.get_style_context ().add_class ("h2");
204 user_label.hexpand = true;
205+ user_label.xalign = 0;
206
207- var apps_label = new Gtk.Label ("");
208- apps_label.set_markup ("<b>%s</b>".printf (Markup.escape_text (_("Content to synchronise:"))));
209- ((Gtk.Misc) apps_label).xalign = 0;
210- apps_label.margin_top = 12;
211+ var provider_label = new Gtk.Label (provider.get_display_name ());
212+ provider_label.xalign = 0;
213
214 var scrolled_window = new Gtk.ScrolledWindow (null, null);
215 scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER;
216 scrolled_window.expand = true;
217
218 var apps_grid = new Gtk.Grid ();
219- apps_grid.margin_bottom = 12;
220- apps_grid.margin_left = 12;
221- apps_grid.margin_right = 12;
222+ apps_grid.margin = 6;
223+ apps_grid.margin_top = 12;
224 apps_grid.column_spacing = 12;
225 apps_grid.row_spacing = 6;
226
227- int i = 1;
228+ int i = 0;
229 plugin.account.list_services ().foreach ((service) => {
230 if (plugin.account.manager.list_applications_by_service (service).length () == 0)
231 return;
232
233 unowned string i18n_domain = service.get_i18n_domain ();
234
235- var service_image = new Gtk.Image.from_icon_name (service.get_icon_name (), Gtk.IconSize.DIALOG);
236-
237- var service_label = new Gtk.Label ("");
238- service_label.set_markup ("<big>%s</big>".printf (Markup.escape_text (GLib.dgettext (i18n_domain, service.get_display_name ()))));
239- ((Gtk.Misc) service_label).xalign = 0;
240+ var service_label = new Gtk.Label (Markup.escape_text (GLib.dgettext (i18n_domain, service.get_display_name ())));
241+ service_label.get_style_context ().add_class ("h4");
242+ service_label.hexpand = true;
243+ service_label.xalign = 0;
244
245 var service_switch = new Gtk.Switch ();
246+ service_switch.margin_end = 6;
247 service_switch.valign = Gtk.Align.CENTER;
248 service_switch.tooltip_text = GLib.dgettext (i18n_domain, service.get_description ());
249 plugin.account.select_service (service);
250 service_switch.active = plugin.account.get_enabled ();
251
252- var app_button = new Gtk.ToggleButton ();
253- app_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
254- app_button.image = new Gtk.Image.from_icon_name ("application-menu-symbolic", Gtk.IconSize.MENU);
255- app_button.sensitive = plugin.account.get_enabled ();
256-
257- var popover = new ACLPopover (plugin.account, service, identity);
258- popover.relative_to = app_button;
259- popover.hide.connect (() => {
260- app_button.active = false;
261- });
262-
263- app_button.toggled.connect (() => {
264- if (app_button.active) {
265- popover.show_all ();
266- }
267- });
268-
269- var app_button_grid = new Gtk.Grid ();
270- app_button_grid.valign = Gtk.Align.CENTER;
271- app_button_grid.add (app_button);
272- service_switch.notify["active"].connect (() => {on_service_switch_activated (service_switch.active, service, app_button, popover);});
273-
274- apps_grid.attach (service_image, 1, i, 1, 1);
275- apps_grid.attach (service_label, 2, i, 1, 1);
276- apps_grid.attach (service_switch, 3, i, 1, 1);
277- apps_grid.attach (app_button_grid, 4, i, 1, 1);
278+ var acl_list = new ACListBox (plugin.account, service, identity);
279+
280+ var frame = new Gtk.Frame (null);
281+ frame.margin_bottom = 12;
282+ frame.add (acl_list);
283+
284+ var acl_revealer = new Gtk.Revealer ();
285+ acl_revealer.reveal_child = service_switch.active;
286+ acl_revealer.add (frame);
287+
288+ service_switch.bind_property ("active", acl_revealer, "reveal-child", BindingFlags.DEFAULT);
289+ service_switch.notify["active"].connect (() => {on_service_switch_activated (service_switch.active, service, acl_list);});
290+
291+ apps_grid.attach (service_label, 0, i, 1, 1);
292+ apps_grid.attach (service_switch, 1, i, 1, 1);
293+ i++;
294+ apps_grid.attach (acl_revealer, 0, i, 2, 1);
295 i++;
296 });
297
298@@ -118,29 +103,22 @@
299 var alert = new Granite.Widgets.AlertView (_("No Apps"), no_service_label, "applications-internet-symbolic");
300 this.add (alert);
301 } else {
302- var fake_grid_l = new Gtk.Grid ();
303- fake_grid_l.hexpand = true;
304- var fake_grid_r = new Gtk.Grid ();
305- fake_grid_r.hexpand = true;
306- apps_grid.attach (fake_grid_l, 0, 0, 1, 1);
307- apps_grid.attach (fake_grid_r, 5, 0, 1, 1);
308-
309 scrolled_window.add_with_viewport (apps_grid);
310- main_grid.add (user_label);
311- this.add (main_grid);
312- this.add (scrolled_window);
313- apps_grid.attach (apps_label, 1, 0, 2, 1);
314+
315+ attach (provider_image, 0, 0, 1, 2);
316+ attach (user_label, 1, 0, 1, 1);
317+ attach (provider_label, 1, 1, 1, 1);
318+ attach (scrolled_window, 0, 2, 2, 1);
319 }
320 }
321
322- private void on_service_switch_activated (bool enabled, Ag.Service service, Gtk.Button button, ACLPopover popover) {
323- button.sensitive = enabled;
324+ private void on_service_switch_activated (bool enabled, Ag.Service service, ACListBox listbox) {
325 plugin.account.select_service (service);
326 plugin.account.set_enabled (enabled);
327 if (enabled) {
328- popover.allow_service ();
329+ listbox.allow_service ();
330 } else {
331- popover.deny_service ();
332+ listbox.deny_service ();
333 }
334 }
335 }

Subscribers

People subscribed via source and target branches