Merge lp:~elementary-pantheon/switchboard-plug-security-privacy/abstract-service-panel into lp:~elementary-apps/switchboard-plug-security-privacy/trunk
- abstract-service-panel
- Merge into trunk
Proposed by
Danielle Foré
Status: | Merged |
---|---|
Approved by: | David Hewitt |
Approved revision: | 317 |
Merged at revision: | 317 |
Proposed branch: | lp:~elementary-pantheon/switchboard-plug-security-privacy/abstract-service-panel |
Merge into: | lp:~elementary-apps/switchboard-plug-security-privacy/trunk |
Diff against target: |
415 lines (+126/-102) 8 files modified
src/CMakeLists.txt (+1/-0) src/Plug.vala (+0/-1) src/Views/AbstractServicePanel.vala (+81/-0) src/Views/FirewallPanel.vala (+5/-21) src/Views/LocationPanel.vala (+9/-22) src/Views/LockPanel.vala (+11/-14) src/Views/TrackPanel.vala (+16/-41) src/Widgets/ServiceList.vala (+3/-3) |
To merge this branch: | bzr merge lp:~elementary-pantheon/switchboard-plug-security-privacy/abstract-service-panel |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Hewitt | code, function | Approve | |
Review via email:
|
Commit message
Create AbstractService
Description of the change
This branch creates an abstract service panel and uses it. The main purpose here is to make sure that we keep the layout and design of each panel consistent and to make it easier to build future panels.
The abstract service panel comes with three areas: header_area, content_area, and action_area. The first one is private and you only interact with it by setting the icon_name, title, description?, and activatable properties of the panel. The latter are public and the naming should be familiar and predictable if you've used Gtk.Dialog
To post a comment you must log in.
- 316. By Danielle Foré
-
get rid of a weird method
- 317. By Danielle Foré
-
get rid of some extra margins
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
David Hewitt (davidmhewitt) wrote : | # |
review:
Approve
(code, function)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/CMakeLists.txt' | |||
2 | --- src/CMakeLists.txt 2017-02-27 23:35:21 +0000 | |||
3 | +++ src/CMakeLists.txt 2017-03-02 17:18:33 +0000 | |||
4 | @@ -18,6 +18,7 @@ | |||
5 | 18 | UFWHelpers.vala | 18 | UFWHelpers.vala |
6 | 19 | ZGUtilities.vala | 19 | ZGUtilities.vala |
7 | 20 | 20 | ||
8 | 21 | Views/AbstractServicePanel.vala | ||
9 | 21 | Views/FirewallPanel.vala | 22 | Views/FirewallPanel.vala |
10 | 22 | Views/LockPanel.vala | 23 | Views/LockPanel.vala |
11 | 23 | Views/TrackPanel.vala | 24 | Views/TrackPanel.vala |
12 | 24 | 25 | ||
13 | === modified file 'src/Plug.vala' | |||
14 | --- src/Plug.vala 2017-03-01 23:31:31 +0000 | |||
15 | +++ src/Plug.vala 2017-03-02 17:18:33 +0000 | |||
16 | @@ -168,7 +168,6 @@ | |||
17 | 168 | case "locking<sep>privacy-mode": | 168 | case "locking<sep>privacy-mode": |
18 | 169 | stack.set_visible_child_name ("locking"); | 169 | stack.set_visible_child_name ("locking"); |
19 | 170 | service_list.select_service_name ("locking"); | 170 | service_list.select_service_name ("locking"); |
20 | 171 | tracking.focus_privacy_switch (); | ||
21 | 172 | break; | 171 | break; |
22 | 173 | case "firewall": | 172 | case "firewall": |
23 | 174 | stack.set_visible_child_name ("firewall"); | 173 | stack.set_visible_child_name ("firewall"); |
24 | 175 | 174 | ||
25 | === added file 'src/Views/AbstractServicePanel.vala' | |||
26 | --- src/Views/AbstractServicePanel.vala 1970-01-01 00:00:00 +0000 | |||
27 | +++ src/Views/AbstractServicePanel.vala 2017-03-02 17:18:33 +0000 | |||
28 | @@ -0,0 +1,81 @@ | |||
29 | 1 | /* | ||
30 | 2 | * Copyright (c) 2017 elementary LLC. (http://launchpad.net/switchboard-plug-security-privacy) | ||
31 | 3 | * | ||
32 | 4 | * This program is free software; you can redistribute it and/or | ||
33 | 5 | * modify it under the terms of the GNU General Public | ||
34 | 6 | * License as published by the Free Software Foundation; either | ||
35 | 7 | * version 2 of the License, or (at your option) any later version. | ||
36 | 8 | * | ||
37 | 9 | * This program is distributed in the hope that it will be useful, | ||
38 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
40 | 12 | * General Public License for more details. | ||
41 | 13 | * | ||
42 | 14 | * You should have received a copy of the GNU General Public | ||
43 | 15 | * License along with this program; if not, write to the | ||
44 | 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
45 | 17 | * Boston, MA 02110-1301 USA | ||
46 | 18 | * | ||
47 | 19 | */ | ||
48 | 20 | |||
49 | 21 | public abstract class ServicePanel : Gtk.Grid { | ||
50 | 22 | public Gtk.ButtonBox action_area; | ||
51 | 23 | public Gtk.Grid content_area; | ||
52 | 24 | public Gtk.Switch? status_switch; | ||
53 | 25 | |||
54 | 26 | public bool activatable { get; construct; } | ||
55 | 27 | |||
56 | 28 | public string description { get; construct; } | ||
57 | 29 | public string icon_name { get; construct; } | ||
58 | 30 | public string title { get; construct; } | ||
59 | 31 | |||
60 | 32 | public ServicePanel () { | ||
61 | 33 | Object (activatable: activatable, | ||
62 | 34 | icon_name: icon_name, | ||
63 | 35 | description: description, | ||
64 | 36 | title: title); | ||
65 | 37 | } | ||
66 | 38 | |||
67 | 39 | construct { | ||
68 | 40 | var header_icon = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG); | ||
69 | 41 | |||
70 | 42 | var header_label = new Gtk.Label (title); | ||
71 | 43 | header_label.get_style_context ().add_class ("h2"); | ||
72 | 44 | |||
73 | 45 | var header_area = new Gtk.Grid (); | ||
74 | 46 | header_area.column_spacing = 12; | ||
75 | 47 | header_area.add (header_icon); | ||
76 | 48 | header_area.add (header_label); | ||
77 | 49 | |||
78 | 50 | if (description != null) { | ||
79 | 51 | var description_icon = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.MENU); | ||
80 | 52 | description_icon.xalign = 0; | ||
81 | 53 | description_icon.tooltip_text = description; | ||
82 | 54 | |||
83 | 55 | header_area.add (description_icon); | ||
84 | 56 | } | ||
85 | 57 | |||
86 | 58 | if (activatable) { | ||
87 | 59 | status_switch = new Gtk.Switch (); | ||
88 | 60 | status_switch.hexpand = true; | ||
89 | 61 | status_switch.halign = Gtk.Align.END; | ||
90 | 62 | status_switch.valign = Gtk.Align.CENTER; | ||
91 | 63 | header_area.add (status_switch); | ||
92 | 64 | } | ||
93 | 65 | |||
94 | 66 | content_area = new Gtk.Grid (); | ||
95 | 67 | content_area.column_spacing = 12; | ||
96 | 68 | content_area.row_spacing = 12; | ||
97 | 69 | |||
98 | 70 | action_area = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); | ||
99 | 71 | action_area.set_layout (Gtk.ButtonBoxStyle.END); | ||
100 | 72 | action_area.set_spacing (6); | ||
101 | 73 | |||
102 | 74 | margin = 12; | ||
103 | 75 | orientation = Gtk.Orientation.VERTICAL; | ||
104 | 76 | row_spacing = 24; | ||
105 | 77 | add (header_area); | ||
106 | 78 | add (content_area); | ||
107 | 79 | add (action_area); | ||
108 | 80 | } | ||
109 | 81 | } | ||
110 | 0 | 82 | ||
111 | === modified file 'src/Views/FirewallPanel.vala' | |||
112 | --- src/Views/FirewallPanel.vala 2017-03-01 22:38:37 +0000 | |||
113 | +++ src/Views/FirewallPanel.vala 2017-03-02 17:18:33 +0000 | |||
114 | @@ -20,14 +20,13 @@ | |||
115 | 20 | * Authored by: Corentin Noël <tintou@mailoo.org> | 20 | * Authored by: Corentin Noël <tintou@mailoo.org> |
116 | 21 | */ | 21 | */ |
117 | 22 | 22 | ||
119 | 23 | public class SecurityPrivacy.FirewallPanel : Gtk.Grid { | 23 | public class SecurityPrivacy.FirewallPanel : ServicePanel { |
120 | 24 | private Gtk.ListStore list_store; | 24 | private Gtk.ListStore list_store; |
121 | 25 | private Gtk.TreeView view; | 25 | private Gtk.TreeView view; |
122 | 26 | private Gtk.Toolbar list_toolbar; | 26 | private Gtk.Toolbar list_toolbar; |
123 | 27 | private bool loading = false; | 27 | private bool loading = false; |
124 | 28 | private Gtk.Popover add_popover; | 28 | private Gtk.Popover add_popover; |
125 | 29 | private Gtk.ToolButton remove_button; | 29 | private Gtk.ToolButton remove_button; |
126 | 30 | public Gtk.Switch status_switch; | ||
127 | 31 | 30 | ||
128 | 32 | private enum Columns { | 31 | private enum Columns { |
129 | 33 | ACTION, | 32 | ACTION, |
130 | @@ -40,22 +39,12 @@ | |||
131 | 40 | } | 39 | } |
132 | 41 | 40 | ||
133 | 42 | public FirewallPanel () { | 41 | public FirewallPanel () { |
137 | 43 | Object (column_spacing: 12, | 42 | Object (activatable: true, |
138 | 44 | margin: 12, | 43 | icon_name: "network-firewall", |
139 | 45 | row_spacing: 6); | 44 | title: _("Firewall")); |
140 | 46 | } | 45 | } |
141 | 47 | 46 | ||
142 | 48 | construct { | 47 | construct { |
143 | 49 | var status_icon = new Gtk.Image.from_icon_name ("network-firewall", Gtk.IconSize.DIALOG); | ||
144 | 50 | |||
145 | 51 | var status_label = new Gtk.Label (_("Firewall")); | ||
146 | 52 | status_label.get_style_context ().add_class ("h2"); | ||
147 | 53 | status_label.hexpand = true; | ||
148 | 54 | status_label.xalign = 0; | ||
149 | 55 | |||
150 | 56 | status_switch = new Gtk.Switch (); | ||
151 | 57 | status_switch.valign = Gtk.Align.CENTER; | ||
152 | 58 | |||
153 | 59 | status_switch.notify["active"].connect (() => { | 48 | status_switch.notify["active"].connect (() => { |
154 | 60 | if (loading == false) { | 49 | if (loading == false) { |
155 | 61 | view.sensitive = status_switch.active; | 50 | view.sensitive = status_switch.active; |
156 | @@ -64,10 +53,6 @@ | |||
157 | 64 | show_rules (); | 53 | show_rules (); |
158 | 65 | }); | 54 | }); |
159 | 66 | 55 | ||
160 | 67 | attach (status_icon, 0, 0, 1, 1); | ||
161 | 68 | attach (status_label, 1, 0, 1, 1); | ||
162 | 69 | attach (status_switch, 2, 0, 1, 1); | ||
163 | 70 | |||
164 | 71 | create_treeview (); | 56 | create_treeview (); |
165 | 72 | 57 | ||
166 | 73 | sensitive = false; | 58 | sensitive = false; |
167 | @@ -264,9 +249,8 @@ | |||
168 | 264 | view_grid.attach (list_toolbar, 0, 1, 1, 1); | 249 | view_grid.attach (list_toolbar, 0, 1, 1, 1); |
169 | 265 | 250 | ||
170 | 266 | var frame = new Gtk.Frame (null); | 251 | var frame = new Gtk.Frame (null); |
171 | 267 | frame.margin_top = 12; | ||
172 | 268 | frame.add (view_grid); | 252 | frame.add (view_grid); |
173 | 269 | 253 | ||
175 | 270 | attach (frame, 0, 1, 3, 1); | 254 | content_area.attach (frame, 0, 1, 3, 1); |
176 | 271 | } | 255 | } |
177 | 272 | } | 256 | } |
178 | 273 | 257 | ||
179 | === modified file 'src/Views/LocationPanel.vala' | |||
180 | --- src/Views/LocationPanel.vala 2017-03-01 22:38:37 +0000 | |||
181 | +++ src/Views/LocationPanel.vala 2017-03-02 17:18:33 +0000 | |||
182 | @@ -1,6 +1,6 @@ | |||
183 | 1 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
184 | 2 | /*- | 2 | /*- |
186 | 3 | * Copyright (c) 2017 elementary LLC. | 3 | * Copyright (c) 2017 elementary LLC. (http://launchpad.net/switchboard-plug-security-privacy) |
187 | 4 | * Copyright (C) 2017 David Hewitt <davidmhewitt@gmail.com> | 4 | * Copyright (C) 2017 David Hewitt <davidmhewitt@gmail.com> |
188 | 5 | * | 5 | * |
189 | 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
190 | @@ -20,7 +20,7 @@ | |||
191 | 20 | * Authored by: David Hewitt <davidmhewitt@gmail.com> | 20 | * Authored by: David Hewitt <davidmhewitt@gmail.com> |
192 | 21 | */ | 21 | */ |
193 | 22 | 22 | ||
195 | 23 | public class SecurityPrivacy.LocationPanel : Gtk.Grid { | 23 | public class SecurityPrivacy.LocationPanel : ServicePanel { |
196 | 24 | 24 | ||
197 | 25 | private GLib.Settings location_settings; | 25 | private GLib.Settings location_settings; |
198 | 26 | private Variant remembered_apps; | 26 | private Variant remembered_apps; |
199 | @@ -29,7 +29,6 @@ | |||
200 | 29 | private Gtk.TreeView tree_view; | 29 | private Gtk.TreeView tree_view; |
201 | 30 | private Gtk.Grid treeview_grid; | 30 | private Gtk.Grid treeview_grid; |
202 | 31 | private Gtk.Stack disabled_stack; | 31 | private Gtk.Stack disabled_stack; |
203 | 32 | public Gtk.Switch status_switch; | ||
204 | 33 | 32 | ||
205 | 34 | private enum Columns { | 33 | private enum Columns { |
206 | 35 | AUTHORIZED, | 34 | AUTHORIZED, |
207 | @@ -39,28 +38,17 @@ | |||
208 | 39 | N_COLUMNS | 38 | N_COLUMNS |
209 | 40 | } | 39 | } |
210 | 41 | 40 | ||
211 | 41 | public LocationPanel () { | ||
212 | 42 | Object (activatable: true, | ||
213 | 43 | icon_name: "find-location", | ||
214 | 44 | title: _("Location Services")); | ||
215 | 45 | } | ||
216 | 46 | |||
217 | 42 | construct { | 47 | construct { |
218 | 43 | column_spacing = 12; | ||
219 | 44 | row_spacing = 6; | ||
220 | 45 | margin = 12; | ||
221 | 46 | |||
222 | 47 | location_settings = new GLib.Settings ("org.pantheon.agent-geoclue2"); | 48 | location_settings = new GLib.Settings ("org.pantheon.agent-geoclue2"); |
223 | 48 | disabled_stack = new Gtk.Stack (); | 49 | disabled_stack = new Gtk.Stack (); |
224 | 49 | 50 | ||
239 | 50 | var status_icon = new Gtk.Image.from_icon_name ("find-location", Gtk.IconSize.DIALOG); | 51 | content_area.attach (disabled_stack, 0, 1, 3, 1); |
226 | 51 | |||
227 | 52 | var status_label = new Gtk.Label (_("Location Services")); | ||
228 | 53 | status_label.get_style_context ().add_class ("h2"); | ||
229 | 54 | status_label.hexpand = true; | ||
230 | 55 | status_label.xalign = 0; | ||
231 | 56 | |||
232 | 57 | status_switch = new Gtk.Switch (); | ||
233 | 58 | status_switch.valign = Gtk.Align.CENTER; | ||
234 | 59 | |||
235 | 60 | attach (status_icon, 0, 0, 1, 1); | ||
236 | 61 | attach (status_label, 1, 0, 1, 1); | ||
237 | 62 | attach (status_switch, 2, 0, 1, 1); | ||
238 | 63 | attach (disabled_stack, 0, 1, 3, 1); | ||
240 | 64 | 52 | ||
241 | 65 | create_treeview (); | 53 | create_treeview (); |
242 | 66 | create_disabled_panel (); | 54 | create_disabled_panel (); |
243 | @@ -144,7 +132,6 @@ | |||
244 | 144 | scrolled.add (tree_view); | 132 | scrolled.add (tree_view); |
245 | 145 | 133 | ||
246 | 146 | treeview_grid = new Gtk.Grid (); | 134 | treeview_grid = new Gtk.Grid (); |
247 | 147 | treeview_grid.margin_top = 12; | ||
248 | 148 | treeview_grid.row_spacing = 6; | 135 | treeview_grid.row_spacing = 6; |
249 | 149 | treeview_grid.attach (locations_label, 0, 0, 1, 1); | 136 | treeview_grid.attach (locations_label, 0, 0, 1, 1); |
250 | 150 | treeview_grid.attach (scrolled, 0, 1, 1, 1); | 137 | treeview_grid.attach (scrolled, 0, 1, 1, 1); |
251 | 151 | 138 | ||
252 | === modified file 'src/Views/LockPanel.vala' | |||
253 | --- src/Views/LockPanel.vala 2017-03-01 22:38:37 +0000 | |||
254 | +++ src/Views/LockPanel.vala 2017-03-02 17:18:33 +0000 | |||
255 | @@ -20,15 +20,16 @@ | |||
256 | 20 | * Authored by: Corentin Noël <corentin@elementary.io> | 20 | * Authored by: Corentin Noël <corentin@elementary.io> |
257 | 21 | */ | 21 | */ |
258 | 22 | 22 | ||
260 | 23 | public class SecurityPrivacy.LockPanel : Gtk.Grid { | 23 | public class SecurityPrivacy.LockPanel : ServicePanel { |
261 | 24 | 24 | ||
262 | 25 | Settings locker; | 25 | Settings locker; |
263 | 26 | 26 | ||
264 | 27 | public LockPanel () { | 27 | public LockPanel () { |
268 | 28 | column_spacing = 12; | 28 | Object (icon_name: "system-lock-screen", |
269 | 29 | row_spacing = 6; | 29 | title: _("Locking")); |
270 | 30 | margin = 12; | 30 | } |
271 | 31 | 31 | ||
272 | 32 | construct { | ||
273 | 32 | locker = new Settings ("apps.light-locker"); | 33 | locker = new Settings ("apps.light-locker"); |
274 | 33 | 34 | ||
275 | 34 | var lock_suspend_label = new Gtk.Label (_("Lock on sleep:")); | 35 | var lock_suspend_label = new Gtk.Label (_("Lock on sleep:")); |
276 | @@ -66,15 +67,11 @@ | |||
277 | 66 | lock_suspend_switch.halign = Gtk.Align.START; | 67 | lock_suspend_switch.halign = Gtk.Align.START; |
278 | 67 | lock_sleep_switch.halign = Gtk.Align.START; | 68 | lock_sleep_switch.halign = Gtk.Align.START; |
279 | 68 | 69 | ||
290 | 69 | var expander_grid = new Gtk.Grid (); | 70 | content_area.hexpand = true; |
291 | 70 | expander_grid.hexpand = true; | 71 | content_area.halign = Gtk.Align.CENTER; |
292 | 71 | 72 | content_area.attach (lock_suspend_label, 0, 0, 1, 1); | |
293 | 72 | attach (expander_grid, 0, 0, 4, 1); | 73 | content_area.attach (lock_sleep_label, 0, 1, 1, 1); |
294 | 73 | attach (lock_suspend_label, 1, 0, 1, 1); | 74 | content_area.attach (lock_suspend_switch, 1, 0, 1, 1); |
295 | 74 | attach (lock_sleep_label, 1, 1, 1, 1); | 75 | content_area.attach (lock_sleep_switch, 1, 1, 1, 1); |
286 | 75 | attach (lock_suspend_switch, 2, 0, 1, 1); | ||
287 | 76 | attach (lock_sleep_switch, 2, 1, 1, 1); | ||
288 | 77 | |||
289 | 78 | hexpand = true; | ||
296 | 79 | } | 76 | } |
297 | 80 | } | 77 | } |
298 | 81 | 78 | ||
299 | === modified file 'src/Views/TrackPanel.vala' | |||
300 | --- src/Views/TrackPanel.vala 2017-03-01 23:31:31 +0000 | |||
301 | +++ src/Views/TrackPanel.vala 2017-03-02 17:18:33 +0000 | |||
302 | @@ -1,6 +1,6 @@ | |||
303 | 1 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
304 | 2 | /*- | 2 | /*- |
306 | 3 | * Copyright (c) 2014 elementary LLC. ((http://launchpad.net/switchboard-plug-security-privacy) | 3 | * Copyright (c) 2014 elementary LLC. (http://launchpad.net/switchboard-plug-security-privacy) |
307 | 4 | * | 4 | * |
308 | 5 | * This library is free software; you can redistribute it and/or | 5 | * This library is free software; you can redistribute it and/or |
309 | 6 | * modify it under the terms of the GNU Lesser General Public | 6 | * modify it under the terms of the GNU Lesser General Public |
310 | @@ -20,14 +20,14 @@ | |||
311 | 20 | * Authored by: Corentin Noël <tintou@mailoo.org> | 20 | * Authored by: Corentin Noël <tintou@mailoo.org> |
312 | 21 | */ | 21 | */ |
313 | 22 | 22 | ||
315 | 23 | public class SecurityPrivacy.TrackPanel : Gtk.Grid { | 23 | public class SecurityPrivacy.TrackPanel : ServicePanel { |
316 | 24 | private Widgets.ClearUsagePopover remove_popover; | 24 | private Widgets.ClearUsagePopover remove_popover; |
317 | 25 | public Gtk.Switch record_switch; | ||
318 | 26 | 25 | ||
319 | 27 | public TrackPanel () { | 26 | public TrackPanel () { |
323 | 28 | Object (column_spacing: 12, | 27 | Object (activatable: true, |
324 | 29 | margin: 12, | 28 | description: _("This operating system can gather useful statistics about file and app usage to provide extra functionality. If other people can see or access your account, you may wish to limit which items are recorded."), |
325 | 30 | row_spacing: 12); | 29 | icon_name: "document-open-recent", |
326 | 30 | title: _("History")); | ||
327 | 31 | } | 31 | } |
328 | 32 | 32 | ||
329 | 33 | construct { | 33 | construct { |
330 | @@ -43,30 +43,9 @@ | |||
331 | 43 | description_frame.no_show_all = true; | 43 | description_frame.no_show_all = true; |
332 | 44 | description_frame.add (alert); | 44 | description_frame.add (alert); |
333 | 45 | 45 | ||
355 | 46 | var header_image = new Gtk.Image.from_icon_name ("document-open-recent", Gtk.IconSize.DIALOG); | 46 | status_switch.active = true; |
335 | 47 | |||
336 | 48 | var record_label = new Gtk.Label (_("History")); | ||
337 | 49 | record_label.get_style_context ().add_class ("h2"); | ||
338 | 50 | |||
339 | 51 | record_switch = new Gtk.Switch (); | ||
340 | 52 | record_switch.active = true; | ||
341 | 53 | record_switch.valign = Gtk.Align.CENTER; | ||
342 | 54 | |||
343 | 55 | var info_button = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.MENU); | ||
344 | 56 | info_button.hexpand = true; | ||
345 | 57 | info_button.xalign = 0; | ||
346 | 58 | info_button.tooltip_text = _("This operating system can gather useful statistics about file and app usage to provide extra functionality. If other people can see or access your account, you may wish to limit which items are recorded."); | ||
347 | 59 | |||
348 | 60 | var header_grid = new Gtk.Grid (); | ||
349 | 61 | header_grid.column_spacing = 12; | ||
350 | 62 | header_grid.margin_bottom = 12; | ||
351 | 63 | header_grid.add (header_image); | ||
352 | 64 | header_grid.add (record_label); | ||
353 | 65 | header_grid.add (info_button); | ||
354 | 66 | header_grid.add (record_switch); | ||
356 | 67 | 47 | ||
357 | 68 | var clear_data = new Gtk.ToggleButton.with_label (_("Clear History…")); | 48 | var clear_data = new Gtk.ToggleButton.with_label (_("Clear History…")); |
358 | 69 | clear_data.halign = Gtk.Align.END; | ||
359 | 70 | clear_data.notify["active"].connect (() => { | 49 | clear_data.notify["active"].connect (() => { |
360 | 71 | if (clear_data.active == false) { | 50 | if (clear_data.active == false) { |
361 | 72 | remove_popover.hide (); | 51 | remove_popover.hide (); |
362 | @@ -83,14 +62,14 @@ | |||
363 | 83 | var include_treeview = new IncludeTreeView (); | 62 | var include_treeview = new IncludeTreeView (); |
364 | 84 | var exclude_treeview = new ExcludeTreeView (); | 63 | var exclude_treeview = new ExcludeTreeView (); |
365 | 85 | 64 | ||
374 | 86 | attach (header_grid, 0, 0, 2, 1); | 65 | content_area.attach (description_frame, 0, 1, 2, 1); |
375 | 87 | attach (description_frame, 0, 1, 2, 1); | 66 | content_area.attach (include_treeview, 0, 1, 1, 1); |
376 | 88 | attach (include_treeview, 0, 1, 1, 1); | 67 | content_area.attach (exclude_treeview, 1, 1, 1, 1); |
377 | 89 | attach (exclude_treeview, 1, 1, 1, 1); | 68 | |
378 | 90 | attach (clear_data, 1, 2, 1, 1); | 69 | action_area.add (clear_data); |
379 | 91 | 70 | ||
380 | 92 | record_switch.notify["active"].connect (() => { | 71 | status_switch.notify["active"].connect (() => { |
381 | 93 | bool privacy_mode = !record_switch.active; | 72 | bool privacy_mode = !status_switch.active; |
382 | 94 | include_treeview.visible = !privacy_mode; | 73 | include_treeview.visible = !privacy_mode; |
383 | 95 | exclude_treeview.visible = !privacy_mode; | 74 | exclude_treeview.visible = !privacy_mode; |
384 | 96 | description_frame.visible = privacy_mode; | 75 | description_frame.visible = privacy_mode; |
385 | @@ -104,11 +83,7 @@ | |||
386 | 104 | } | 83 | } |
387 | 105 | }); | 84 | }); |
388 | 106 | 85 | ||
394 | 107 | record_switch.active = !blacklist.get_incognito (); | 86 | status_switch.active = !blacklist.get_incognito (); |
390 | 108 | } | ||
391 | 109 | |||
392 | 110 | public void focus_privacy_switch () { | ||
393 | 111 | record_switch.grab_focus (); | ||
395 | 112 | } | 87 | } |
396 | 113 | 88 | ||
397 | 114 | private string get_operating_system_name () { | 89 | private string get_operating_system_name () { |
398 | 115 | 90 | ||
399 | === modified file 'src/Widgets/ServiceList.vala' | |||
400 | --- src/Widgets/ServiceList.vala 2017-03-01 23:31:31 +0000 | |||
401 | +++ src/Widgets/ServiceList.vala 2017-03-02 17:18:33 +0000 | |||
402 | @@ -39,10 +39,10 @@ | |||
403 | 39 | update_service_status (firewall_item, SecurityPrivacy.firewall.status_switch.active); | 39 | update_service_status (firewall_item, SecurityPrivacy.firewall.status_switch.active); |
404 | 40 | }); | 40 | }); |
405 | 41 | 41 | ||
407 | 42 | update_service_status (privacy_item, SecurityPrivacy.tracking.record_switch.active); | 42 | update_service_status (privacy_item, SecurityPrivacy.tracking.status_switch.active); |
408 | 43 | 43 | ||
411 | 44 | SecurityPrivacy.tracking.record_switch.notify["active"].connect (() => { | 44 | SecurityPrivacy.tracking.status_switch.notify["active"].connect (() => { |
412 | 45 | update_service_status (privacy_item, SecurityPrivacy.tracking.record_switch.active); | 45 | update_service_status (privacy_item, SecurityPrivacy.tracking.status_switch.active); |
413 | 46 | }); | 46 | }); |
414 | 47 | 47 | ||
415 | 48 | if (SecurityPrivacy.LocationPanel.location_agent_installed ()) { | 48 | if (SecurityPrivacy.LocationPanel.location_agent_installed ()) { |
This is good. Definitely simplifies the code in the panels. I think we should maybe look at making the AlertView when a service is disabled and the enabled/disabled status indicators a bit more generic too, so there's not as much repeated code there.
But this is a really good start.