Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #36 from BlankOn/mijortsa-patch-1

add reboot session
  • Loading branch information...
commit f41eb40701e25bfb6f2638269e5d0e77fef938fe 2 parents b77db7a + c5941aa
@mijortsa mijortsa authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 src/panel-session-manager.vala
View
35 src/panel-session-manager.vala
@@ -5,6 +5,8 @@ using JSCore;
interface SessionManager : GLib.Object {
public abstract void register_client (string app_id, string startup_id, out ObjectPath path) throws IOError;
public abstract async void shutdown () throws IOError;
+ public abstract async void reboot () throws IOError;
+
public abstract async void logout (uint32 mode) throws IOError;
public abstract bool can_shutdown () throws IOError;
}
@@ -86,6 +88,17 @@ public class PanelSessionManager {
}
}
+ public async void reboot () {
+ if (session != null) {
+ try {
+ session.reboot ();
+ } catch (Error e) {
+ stderr.printf("Unable to reboot: %s\n", e.message);
+ }
+ }
+ }
+
+
public async void shutdown () {
if (session != null) {
try {
@@ -117,9 +130,15 @@ public class PanelSessionManager {
var s = new String.with_utf8_c_string ("canShutdown");
var f = new JSCore.Object.function_with_callback (ctx, s, js_can_shutdown);
o.set_property (ctx, s, f, 0, null);
+
s = new String.with_utf8_c_string ("logout");
f = new JSCore.Object.function_with_callback (ctx, s, js_logout);
o.set_property (ctx, s, f, 0, null);
+
+ s = new String.with_utf8_c_string ("reboot");
+ f = new JSCore.Object.function_with_callback (ctx, s, js_reboot);
+ o.set_property (ctx, s, f, 0, null);
+
s = new String.with_utf8_c_string ("shutdown");
f = new JSCore.Object.function_with_callback (ctx, s, js_shutdown);
o.set_property (ctx, s, f, 0, null);
@@ -159,6 +178,22 @@ public class PanelSessionManager {
return new JSCore.Value.undefined (ctx);
}
+ public static JSCore.Value js_reboot (Context ctx,
+ JSCore.Object function,
+ JSCore.Object thisObject,
+ JSCore.Value[] arguments,
+
+ out JSCore.Value exception) {
+
+ exception = null;
+ var i = thisObject.get_private() as PanelSessionManager;
+ if (i != null) {
+ i.reboot();
+ }
+ return new JSCore.Value.undefined (ctx);
+ }
+
+
public static JSCore.Value js_logout (Context ctx,
JSCore.Object function,
JSCore.Object thisObject,
Please sign in to comment.
Something went wrong with that request. Please try again.