Merge lp:~robert-ancell/unity-greeter/shutdown-session-warning into lp:unity-greeter

Proposed by Robert Ancell
Status: Merged
Merged at revision: 1179
Proposed branch: lp:~robert-ancell/unity-greeter/shutdown-session-warning
Merge into: lp:unity-greeter
Diff against target: 64 lines (+32/-0)
3 files modified
src/fixes.vapi (+1/-0)
src/main-window.vala (+7/-0)
src/shutdown-dialog.vala (+24/-0)
To merge this branch: bzr merge lp:~robert-ancell/unity-greeter/shutdown-session-warning
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Robert Ancell Approve
Review via email: mp+212949@code.launchpad.net

Commit message

Show a warning when shutting down and users are logged in

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/fixes.vapi'
--- src/fixes.vapi 2013-11-13 22:19:41 +0000
+++ src/fixes.vapi 2014-03-26 20:46:52 +0000
@@ -52,6 +52,7 @@
52 public const int KEY_M;52 public const int KEY_M;
53 public const int KEY_s;53 public const int KEY_s;
54 public const int KEY_z;54 public const int KEY_z;
55 public const int KEY_Z;
55 public const int KEY_plus;56 public const int KEY_plus;
56 public const int KEY_minus;57 public const int KEY_minus;
57 public const int KEY_equal;58 public const int KEY_equal;
5859
=== modified file 'src/main-window.vala'
--- src/main-window.vala 2014-02-27 04:53:21 +0000
+++ src/main-window.vala 2014-03-26 20:46:52 +0000
@@ -335,6 +335,13 @@
335 return true;335 return true;
336 }336 }
337 break;337 break;
338 case Gdk.KEY_Z:
339 if (UnityGreeter.singleton.test_mode && (event.state & Gdk.ModifierType.MOD1_MASK) != 0)
340 {
341 show_shutdown_dialog (ShutdownDialogType.RESTART);
342 return true;
343 }
344 break;
338 }345 }
339346
340 return base.key_press_event (event);347 return base.key_press_event (event);
341348
=== modified file 'src/shutdown-dialog.vala'
--- src/shutdown-dialog.vala 2014-02-16 22:15:43 +0000
+++ src/shutdown-dialog.vala 2014-03-26 20:46:52 +0000
@@ -112,6 +112,30 @@
112 text = _("Are you sure you want to shut down the computer?");112 text = _("Are you sure you want to shut down the computer?");
113 }113 }
114114
115 var have_open_sessions = false;
116 try
117 {
118 var b = Bus.get_sync (BusType.SYSTEM);
119 var result = b.call_sync ("org.freedesktop.DisplayManager",
120 "/org/freedesktop/DisplayManager",
121 "org.freedesktop.DBus.Properties",
122 "Get",
123 new Variant ("(ss)", "org.freedesktop.DisplayManager", "Sessions"),
124 new VariantType ("(v)"),
125 DBusCallFlags.NONE,
126 -1,
127 null);
128 Variant value;
129 result.get ("(v)", out value);
130 have_open_sessions = value.n_children () > 0;
131 }
132 catch (Error e)
133 {
134 warning ("Failed to check sessions from logind: %s", e.message);
135 }
136 if (have_open_sessions)
137 text = "%s\n\n%s".printf (_("Other users are currently logged in to this computer, shutting down now will also close these other sessions."), text);
138
115 var label = new Gtk.Label (text);139 var label = new Gtk.Label (text);
116 label.set_line_wrap (true);140 label.set_line_wrap (true);
117 label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12"));141 label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12"));

Subscribers

People subscribed via source and target branches