Merge lp:~elementary-pantheon/switchboard-plug-security-privacy/history-sidebar-status into lp:~elementary-apps/switchboard-plug-security-privacy/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Danielle Foré
Approved revision: 312
Merged at revision: 312
Proposed branch: lp:~elementary-pantheon/switchboard-plug-security-privacy/history-sidebar-status
Merge into: lp:~elementary-apps/switchboard-plug-security-privacy/trunk
Diff against target: 86 lines (+17/-16)
3 files modified
src/Plug.vala (+1/-1)
src/Views/TrackPanel.vala (+1/-1)
src/Widgets/ServiceList.vala (+15/-14)
To merge this branch: bzr merge lp:~elementary-pantheon/switchboard-plug-security-privacy/history-sidebar-status
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+318689@code.launchpad.net

Commit message

ServiceList.vala:
* Change update_location_status to generic update_service_status
* Use above method for firewall and history status

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Plug.vala'
2--- src/Plug.vala 2017-02-28 22:10:20 +0000
3+++ src/Plug.vala 2017-03-01 22:45:00 +0000
4@@ -27,12 +27,12 @@
5 public static Blacklist blacklist;
6 public static LocationPanel location;
7 public static FirewallPanel firewall;
8+ public static TrackPanel tracking;
9
10 public class Plug : Switchboard.Plug {
11 Gtk.Grid main_grid;
12 Gtk.Stack stack;
13
14- TrackPanel tracking;
15 ServiceList service_list;
16
17 bool location_agent_installed = false;
18
19=== modified file 'src/Views/TrackPanel.vala'
20--- src/Views/TrackPanel.vala 2017-02-28 17:09:23 +0000
21+++ src/Views/TrackPanel.vala 2017-03-01 22:45:00 +0000
22@@ -22,7 +22,7 @@
23
24 public class SecurityPrivacy.TrackPanel : Gtk.Grid {
25 private Widgets.ClearUsagePopover remove_popover;
26- private Gtk.Switch record_switch;
27+ public Gtk.Switch record_switch;
28
29 public TrackPanel () {
30 Object (column_spacing: 12,
31
32=== modified file 'src/Widgets/ServiceList.vala'
33--- src/Widgets/ServiceList.vala 2017-02-28 22:10:20 +0000
34+++ src/Widgets/ServiceList.vala 2017-03-01 22:45:00 +0000
35@@ -6,8 +6,6 @@
36 selection_mode: Gtk.SelectionMode.SINGLE);
37 }
38
39- ServiceItem? location_item;
40-
41 construct {
42 var privacy_item = new ServiceItem ("document-open-recent", "tracking", _("History"));
43 var lock_item = new ServiceItem ("system-lock-screen", "locking", _("Locking"));
44@@ -18,28 +16,31 @@
45 add_service (firewall_item);
46
47 SecurityPrivacy.firewall.status_switch.notify["active"].connect (() => {
48- if (SecurityPrivacy.firewall.status_switch.active) {
49- firewall_item.status = ServiceItem.Status.ENABLED;
50- } else {
51- firewall_item.status = ServiceItem.Status.DISABLED;
52- }
53+ update_service_status (firewall_item, SecurityPrivacy.firewall.status_switch.active);
54+ });
55+
56+ update_service_status (privacy_item, SecurityPrivacy.tracking.record_switch.active);
57+
58+ SecurityPrivacy.tracking.record_switch.notify["active"].connect (() => {
59+ update_service_status (privacy_item, SecurityPrivacy.tracking.record_switch.active);
60 });
61
62 if (SecurityPrivacy.LocationPanel.location_agent_installed ()) {
63- location_item = new ServiceItem ("find-location", "location", _("Location Services"));
64+ var location_item = new ServiceItem ("find-location", "location", _("Location Services"));
65 add_service (location_item);
66- update_location_status ();
67+ update_service_status (location_item, SecurityPrivacy.location.status_switch.active);
68+
69 SecurityPrivacy.location.status_switch.notify["active"].connect (() => {
70- update_location_status ();
71+ update_service_status (location_item, SecurityPrivacy.location.status_switch.active);
72 });
73 }
74 }
75
76- private void update_location_status () {
77- if (SecurityPrivacy.location.status_switch.active) {
78- location_item.status = ServiceItem.Status.ENABLED;
79+ private void update_service_status (ServiceItem service_item, bool service_status) {
80+ if (service_status) {
81+ service_item.status = ServiceItem.Status.ENABLED;
82 } else {
83- location_item.status = ServiceItem.Status.DISABLED;
84+ service_item.status = ServiceItem.Status.DISABLED;
85 }
86 }
87

Subscribers

People subscribed via source and target branches