Merge lp:~elementary-pantheon/switchboard-plug-security-privacy/fix-regression-firewall into lp:~elementary-apps/switchboard-plug-security-privacy/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: David Hewitt
Approved revision: 302
Merged at revision: 301
Proposed branch: lp:~elementary-pantheon/switchboard-plug-security-privacy/fix-regression-firewall
Merge into: lp:~elementary-apps/switchboard-plug-security-privacy/trunk
Diff against target: 112 lines (+44/-42)
1 file modified
src/Plug.vala (+44/-42)
To merge this branch: bzr merge lp:~elementary-pantheon/switchboard-plug-security-privacy/fix-regression-firewall
Reviewer Review Type Date Requested Status
David Hewitt Approve
Review via email: mp+318399@code.launchpad.net

Commit message

Plug.vala: Get permission before doing anything else. Fixes regression in firewall page

Description of the change

Fixes a regression introduced in 295 that makes it so you can't ever auth into the firewall page

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

fix an oops

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Fixes the regression

review: Approve

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-26 20:21:42 +0000
3+++ src/Plug.vala 2017-02-27 19:50:43 +0000
4@@ -62,26 +62,59 @@
5 return;
6 }
7
8- var label = new Gtk.Label (_("Some settings require administrator rights to be changed"));
9-
10- var infobar = new Gtk.InfoBar ();
11- infobar.message_type = Gtk.MessageType.INFO;
12- infobar.no_show_all = true;
13- infobar.get_content_area ().add (label);
14+ stack = new Gtk.Stack ();
15+
16+ var grid = new Gtk.Grid ();
17+ grid.attach (stack, 0, 3, 1, 1);
18+
19+ try {
20+ var permission = new Polkit.Permission.sync ("org.pantheon.security-privacy", Polkit.UnixProcess.new (Posix.getpid ()));
21+
22+ var label = new Gtk.Label (_("Some settings require administrator rights to be changed"));
23+
24+ var infobar = new Gtk.InfoBar ();
25+ infobar.message_type = Gtk.MessageType.INFO;
26+ infobar.no_show_all = true;
27+ infobar.get_content_area ().add (label);
28+
29+ grid.attach (infobar, 0, 0, 1, 1);
30+
31+ lock_button = new Gtk.LockButton (permission);
32+
33+ var area = infobar.get_action_area () as Gtk.Container;
34+ area.add (lock_button);
35+
36+ stack.notify["visible-child-name"].connect (() => {
37+ if (permission.allowed == false && stack.visible_child_name == "firewall") {
38+ infobar.no_show_all = false;
39+ infobar.show_all ();
40+ } else {
41+ infobar.no_show_all = true;
42+ infobar.hide ();
43+ }
44+ });
45+
46+ permission.notify["allowed"].connect (() => {
47+ if (permission.allowed == false && stack.visible_child_name == "firewall") {
48+ infobar.no_show_all = false;
49+ infobar.show_all ();
50+ } else {
51+ infobar.no_show_all = true;
52+ infobar.hide ();
53+ }
54+ });
55+ } catch (Error e) {
56+ critical (e.message);
57+ }
58
59 tracking = new TrackPanel ();
60 var locking = new LockPanel ();
61 var firewall = new FirewallPanel ();
62
63- stack = new Gtk.Stack ();
64 stack.add_titled (tracking, "tracking", _("Privacy"));
65 stack.add_titled (locking, "locking", _("Locking"));
66 stack.add_titled (firewall, "firewall", _("Firewall"));
67
68- var grid = new Gtk.Grid ();
69- grid.attach (infobar, 0, 0, 1, 1);
70- grid.attach (stack, 0, 3, 1, 1);
71-
72 var service_list = new ServiceList ();
73
74 var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
75@@ -96,37 +129,6 @@
76 var title = ((ServiceItem)row).title;
77 stack.visible_child_name = title;
78 });
79-
80- try {
81- var permission = new Polkit.Permission.sync ("org.pantheon.security-privacy", Polkit.UnixProcess.new (Posix.getpid ()));
82-
83- lock_button = new Gtk.LockButton (permission);
84-
85- var area = infobar.get_action_area () as Gtk.Container;
86- area.add (lock_button);
87-
88- stack.notify["visible-child-name"].connect (() => {
89- if (permission.allowed == false && stack.visible_child_name == "firewall") {
90- infobar.no_show_all = false;
91- infobar.show_all ();
92- } else {
93- infobar.no_show_all = true;
94- infobar.hide ();
95- }
96- });
97-
98- permission.notify["allowed"].connect (() => {
99- if (permission.allowed == false && stack.visible_child_name == "firewall") {
100- infobar.no_show_all = false;
101- infobar.show_all ();
102- } else {
103- infobar.no_show_all = true;
104- infobar.hide ();
105- }
106- });
107- } catch (Error e) {
108- critical (e.message);
109- }
110 }
111
112 public override void hidden () {

Subscribers

People subscribed via source and target branches