Merge lp:~jbicha/activity-log-manager/add-security-tab into lp:activity-log-manager

Proposed by Jeremy Bícha
Status: Merged
Merged at revision: 66
Proposed branch: lp:~jbicha/activity-log-manager/add-security-tab
Merge into: lp:activity-log-manager
Diff against target: 241 lines (+187/-0)
5 files modified
po/POTFILES.in (+1/-0)
po/POTFILES.skip (+1/-0)
src/Makefile.am (+1/-0)
src/activity-log-manager.vala (+9/-0)
src/security-widget.vala (+175/-0)
To merge this branch: bzr merge lp:~jbicha/activity-log-manager/add-security-tab
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) Approve
Review via email: mp+173295@code.launchpad.net

Description of the change

Based mostly on https://wiki.ubuntu.com/SecurityAndPrivacySettings

- According to the design, there should be one more option for "Require my password when logging in" (autologin)

- Also, I couldn't figure out how to directly call the Change Password widget from user-accounts.

I plan to move the other two settings (brightness slider and "delay before the screen blanks") from the Brightness & Lock panel to the Power panel when we land this in Saucy. That's where those settings are in gnome-control-center 3.8 anyway.

To post a comment you must log in.
64. By Jeremy Bícha

add Security tab for Unity (LP: #1189313)

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2013-06-12 23:31:37 +0000
+++ po/POTFILES.in 2013-07-07 19:53:22 +0000
@@ -3,6 +3,7 @@
3src/activity-log-manager.vala3src/activity-log-manager.vala
4src/alm.vala4src/alm.vala
5src/alm-cc.c5src/alm-cc.c
6src/security-widget.vala
6src/unified-privacy-files.vala7src/unified-privacy-files.vala
7src/unified-privacy-applications.vala8src/unified-privacy-applications.vala
8src/unified-privacy-history.vala9src/unified-privacy-history.vala
910
=== modified file 'po/POTFILES.skip'
--- po/POTFILES.skip 2013-04-19 06:59:09 +0000
+++ po/POTFILES.skip 2013-07-07 19:53:22 +0000
@@ -1,5 +1,6 @@
1src/activity-log-manager.c1src/activity-log-manager.c
2src/alm.c2src/alm.c
3src/security-widget.c
3src/unified-privacy-applications.c4src/unified-privacy-applications.c
4src/unified-privacy-history.c5src/unified-privacy-history.c
5src/unified-privacy.c6src/unified-privacy.c
67
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2013-07-03 08:09:42 +0000
+++ src/Makefile.am 2013-07-07 19:53:22 +0000
@@ -24,6 +24,7 @@
24SHARED_SOURCES = \24SHARED_SOURCES = \
25 blacklist-dbus.vala \25 blacklist-dbus.vala \
26 activity-log-manager.vala \26 activity-log-manager.vala \
27 security-widget.vala \
27 unified-privacy-files.vala \28 unified-privacy-files.vala \
28 unified-privacy-applications.vala \29 unified-privacy-applications.vala \
29 unified-privacy-history.vala \30 unified-privacy-history.vala \
3031
=== modified file 'src/activity-log-manager.vala'
--- src/activity-log-manager.vala 2013-06-28 16:24:00 +0000
+++ src/activity-log-manager.vala 2013-07-07 19:53:22 +0000
@@ -25,6 +25,7 @@
2525
26 public class ActivityLogManager : Gtk.Box {26 public class ActivityLogManager : Gtk.Box {
27 private Gtk.Notebook notebook;27 private Gtk.Notebook notebook;
28 private SecurityWidget security_widget;
28 private PrivacyWidget privacy_widget;29 private PrivacyWidget privacy_widget;
29 private Gtk.Widget whoopsie;30 private Gtk.Widget whoopsie;
3031
@@ -45,6 +46,14 @@
45 this.pack_start(notebook, true, true, 0);46 this.pack_start(notebook, true, true, 0);
46 var privacy_label = new Gtk.Label(_("Files & Applications"));47 var privacy_label = new Gtk.Label(_("Files & Applications"));
47 notebook.append_page(privacy_widget, privacy_label);48 notebook.append_page(privacy_widget, privacy_label);
49
50 if (GLib.Environment.get_variable ("XDG_CURRENT_DESKTOP") == "Unity")
51 {
52 security_widget = new SecurityWidget();
53 var security_label = new Gtk.Label(_("Security"));
54 notebook.prepend_page(security_widget, security_label);
55 }
56
48 var whoopsie_label = new Gtk.Label(_("Diagnostics"));57 var whoopsie_label = new Gtk.Label(_("Diagnostics"));
49 notebook.append_page(whoopsie, whoopsie_label);58 notebook.append_page(whoopsie, whoopsie_label);
50 this.show_all();59 this.show_all();
5160
=== added file 'src/security-widget.vala'
--- src/security-widget.vala 1970-01-01 00:00:00 +0000
+++ src/security-widget.vala 2013-07-07 19:53:22 +0000
@@ -0,0 +1,175 @@
1/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
2/* alm
3 *
4 * Copyright (C) 2013 Jeremy Bicha <jbicha@ubuntu.com>
5 *
6 * alm is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * alm is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20using Gtk;
21using Gee;
22
23namespace Alm {
24
25 public class SecurityWidget : Gtk.Box {
26
27 private GLib.Settings power_settings;
28 private GLib.Settings screensaver_settings;
29
30 public SecurityWidget () {
31 Object (orientation: Orientation.VERTICAL);
32 this.spacing = 5;
33 this.set_border_width(12);
34
35 power_settings = new GLib.Settings ("org.gnome.settings-daemon.plugins.power");
36 screensaver_settings = new GLib.Settings ("org.gnome.desktop.screensaver");
37
38 this.set_up_ui ();
39 }
40
41 private void set_up_ui () {
42
43 Gtk.ListStore liststore_delay = new Gtk.ListStore (2, typeof (string), typeof (int));
44 Gtk.TreeIter iter;
45 liststore_delay.append (out iter);
46 liststore_delay.set (iter, 0, "1 second", 1, 0);
47 liststore_delay.append (out iter);
48 liststore_delay.set (iter, 0, "30 seconds", 1, 30);
49 liststore_delay.append (out iter);
50 liststore_delay.set (iter, 0, "1 minute", 1, 60);
51 liststore_delay.append (out iter);
52 liststore_delay.set (iter, 0, "2 minutes", 1, 120);
53 liststore_delay.append (out iter);
54 liststore_delay.set (iter, 0, "3 minutes", 1, 180);
55 liststore_delay.append (out iter);
56 liststore_delay.set (iter, 0, "5 minutes", 1, 300);
57 liststore_delay.append (out iter);
58 liststore_delay.set (iter, 0, "10 minutes", 1, 600);
59 liststore_delay.append (out iter);
60 liststore_delay.set (iter, 0, "30 minutes", 1, 1800);
61 liststore_delay.append (out iter);
62 liststore_delay.set (iter, 0, "1 hour", 1, 3600);
63
64 var grid = new Grid();
65 grid.set_halign(Align.START);
66 grid.set_valign(Align.START);
67 grid.set_margin_top(25);
68 grid.set_margin_left(25);
69 grid.set_column_spacing(25);
70 grid.set_row_spacing(5);
71 this.add(grid);
72
73 var list_focus = new GLib.List<Widget> ();
74
75 var header = new Label("");
76 header.set_markup("<b>%s</b>".printf(_("Require my password when:")));
77 grid.attach(header, 0, 0, 1, 1);
78
79 var checkbox_suspend = new CheckButton.with_mnemonic (_("_Waking from suspend"));
80 screensaver_settings.bind ("ubuntu-lock-on-suspend", checkbox_suspend, "active", SettingsBindFlags.DEFAULT);
81 list_focus.append(checkbox_suspend);
82 grid.attach(checkbox_suspend, 0, 1, 1, 1);
83
84 var checkbox_screensaver = new CheckButton.with_mnemonic (_("_Returning from blank screen"));
85 screensaver_settings.bind ("lock-enabled", checkbox_screensaver, "active", SettingsBindFlags.DEFAULT);
86 list_focus.append(checkbox_screensaver);
87 grid.attach(checkbox_screensaver, 0, 2, 1, 1);
88
89 var label_combo_delay = new Label(null);
90 label_combo_delay.set_markup_with_mnemonic(_("_if screen has been blank for"));
91 label_combo_delay.set_margin_left(18);
92 grid.attach(label_combo_delay, 0, 3, 1, 1);
93
94 var combo_delay = new ComboBox.with_model(liststore_delay);
95 combo_delay.changed.connect(set_delay_cb);
96 label_combo_delay.set_mnemonic_widget(combo_delay);
97 var cell = new CellRendererText();
98 combo_delay.pack_start(cell, false);
99 combo_delay.add_attribute(cell, "text", 0);
100 list_focus.append(combo_delay);
101 screensaver_settings.changed["lock-enabled"].connect (() => {
102 combo_delay.sensitive = screensaver_settings.get_boolean("lock-enabled");
103 });
104 combo_delay.sensitive = screensaver_settings.get_boolean("lock-enabled");
105 screensaver_settings.changed["lock-delay"].connect (() => {
106 get_delay_cb(combo_delay);
107 });
108 get_delay_cb(combo_delay);
109 grid.attach(combo_delay, 1, 3, 1, 1);
110
111 var link_password = new Gtk.LinkButton (_("Password Settings"));
112 link_password.activate_link.connect (() => {
113 try {
114 Process.spawn_command_line_async ("gnome-control-center user-accounts");
115 } catch (SpawnError e) {
116 stdout.printf ("Error: %s\n", e.message);
117 }
118 return true;
119 });
120 link_password.set_halign(Align.START);
121 list_focus.append(link_password);
122 grid.attach(link_password, 2, 0, 1, 1);
123
124 var link_power = new Gtk.LinkButton(_("Power Settings"));
125 link_power.activate_link.connect (() => {
126 try {
127 Process.spawn_command_line_async ("gnome-control-center power");
128 } catch (SpawnError e) {
129 stdout.printf ("Error: %s\n", e.message);
130 }
131 return true;
132 });
133 link_power.set_halign(Align.START);
134 list_focus.append(link_power);
135 grid.attach(link_power, 2, 1, 1, 1);
136
137 grid.set_focus_chain(list_focus);
138
139 }
140
141 private void set_delay_cb (Gtk.ComboBox combo)
142 {
143 uint seconds;
144 TreeIter iter;
145 combo.get_active_iter(out iter);
146 combo.model.get(iter, 1, out seconds);
147 screensaver_settings.set_uint("lock-delay", seconds);
148 }
149
150 private void get_delay_cb (Gtk.ComboBox combo)
151 {
152 /* try to make the UI match the lock setting */
153 int i = 0;
154 int value_prev = 0;
155 int value_tmp = 0;
156 TreeModel model = combo.get_model();
157 TreeIter iter;
158 model.get_iter_first(out iter);
159 var value = screensaver_settings.get_uint("lock-delay");
160 do {
161 model.get(iter, 1, out value_tmp);
162 if (value == value_tmp ||
163 (value_tmp > value_prev && value < value_tmp))
164 {
165 combo.set_active_iter(iter);
166 return;
167 }
168 value_prev = value_tmp;
169 i++;
170 } while (model.iter_next(ref iter));
171 combo.set_active(i - 1);
172 }
173
174 }
175}

Subscribers

People subscribed via source and target branches