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
=== modified file 'src/Plug.vala'
--- src/Plug.vala 2017-02-26 20:21:42 +0000
+++ src/Plug.vala 2017-02-27 19:50:43 +0000
@@ -62,26 +62,59 @@
62 return;62 return;
63 }63 }
6464
65 var label = new Gtk.Label (_("Some settings require administrator rights to be changed"));65 stack = new Gtk.Stack ();
6666
67 var infobar = new Gtk.InfoBar ();67 var grid = new Gtk.Grid ();
68 infobar.message_type = Gtk.MessageType.INFO;68 grid.attach (stack, 0, 3, 1, 1);
69 infobar.no_show_all = true;69
70 infobar.get_content_area ().add (label);70 try {
71 var permission = new Polkit.Permission.sync ("org.pantheon.security-privacy", Polkit.UnixProcess.new (Posix.getpid ()));
72
73 var label = new Gtk.Label (_("Some settings require administrator rights to be changed"));
74
75 var infobar = new Gtk.InfoBar ();
76 infobar.message_type = Gtk.MessageType.INFO;
77 infobar.no_show_all = true;
78 infobar.get_content_area ().add (label);
79
80 grid.attach (infobar, 0, 0, 1, 1);
81
82 lock_button = new Gtk.LockButton (permission);
83
84 var area = infobar.get_action_area () as Gtk.Container;
85 area.add (lock_button);
86
87 stack.notify["visible-child-name"].connect (() => {
88 if (permission.allowed == false && stack.visible_child_name == "firewall") {
89 infobar.no_show_all = false;
90 infobar.show_all ();
91 } else {
92 infobar.no_show_all = true;
93 infobar.hide ();
94 }
95 });
96
97 permission.notify["allowed"].connect (() => {
98 if (permission.allowed == false && stack.visible_child_name == "firewall") {
99 infobar.no_show_all = false;
100 infobar.show_all ();
101 } else {
102 infobar.no_show_all = true;
103 infobar.hide ();
104 }
105 });
106 } catch (Error e) {
107 critical (e.message);
108 }
71109
72 tracking = new TrackPanel ();110 tracking = new TrackPanel ();
73 var locking = new LockPanel ();111 var locking = new LockPanel ();
74 var firewall = new FirewallPanel ();112 var firewall = new FirewallPanel ();
75113
76 stack = new Gtk.Stack ();
77 stack.add_titled (tracking, "tracking", _("Privacy"));114 stack.add_titled (tracking, "tracking", _("Privacy"));
78 stack.add_titled (locking, "locking", _("Locking"));115 stack.add_titled (locking, "locking", _("Locking"));
79 stack.add_titled (firewall, "firewall", _("Firewall"));116 stack.add_titled (firewall, "firewall", _("Firewall"));
80117
81 var grid = new Gtk.Grid ();
82 grid.attach (infobar, 0, 0, 1, 1);
83 grid.attach (stack, 0, 3, 1, 1);
84
85 var service_list = new ServiceList ();118 var service_list = new ServiceList ();
86119
87 var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);120 var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
@@ -96,37 +129,6 @@
96 var title = ((ServiceItem)row).title;129 var title = ((ServiceItem)row).title;
97 stack.visible_child_name = title;130 stack.visible_child_name = title;
98 });131 });
99
100 try {
101 var permission = new Polkit.Permission.sync ("org.pantheon.security-privacy", Polkit.UnixProcess.new (Posix.getpid ()));
102
103 lock_button = new Gtk.LockButton (permission);
104
105 var area = infobar.get_action_area () as Gtk.Container;
106 area.add (lock_button);
107
108 stack.notify["visible-child-name"].connect (() => {
109 if (permission.allowed == false && stack.visible_child_name == "firewall") {
110 infobar.no_show_all = false;
111 infobar.show_all ();
112 } else {
113 infobar.no_show_all = true;
114 infobar.hide ();
115 }
116 });
117
118 permission.notify["allowed"].connect (() => {
119 if (permission.allowed == false && stack.visible_child_name == "firewall") {
120 infobar.no_show_all = false;
121 infobar.show_all ();
122 } else {
123 infobar.no_show_all = true;
124 infobar.hide ();
125 }
126 });
127 } catch (Error e) {
128 critical (e.message);
129 }
130 }132 }
131133
132 public override void hidden () {134 public override void hidden () {

Subscribers

People subscribed via source and target branches