aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-07-23 21:53:04 -0500
committerTed Gould <ted@canonical.com>2009-07-23 21:53:04 -0500
commitdb481c5758ce617524fc8ba373538d8be7ed0c8e (patch)
tree397dae754284338d3ec0fc60f20f31302e3b5774
parent7419d52e1e26079f01c8981306d8fed50fd8c265 (diff)
downloadayatana-indicator-session-db481c5758ce617524fc8ba373538d8be7ed0c8e.tar.gz
ayatana-indicator-session-db481c5758ce617524fc8ba373538d8be7ed0c8e.tar.bz2
ayatana-indicator-session-db481c5758ce617524fc8ba373538d8be7ed0c8e.zip
Adding in the function to make the calls to DKP
-rw-r--r--src/session-service.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/session-service.c b/src/session-service.c
index 7b686d5..f17a2d6 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -18,6 +18,24 @@ static GMainLoop * mainloop = NULL;
static DBusGProxy * dkp_main_proxy = NULL;
static DBusGProxy * dkp_prop_proxy = NULL;
+/* Hibernate the machine */
+static void
+sleep (DbusmenuMenuitem * mi, gpointer userdata)
+{
+ gchar * type = (gchar *)userdata;
+
+ if (dkp_main_proxy == NULL) {
+ g_warning("Can not %s as no DeviceKit Power Proxy", type);
+ }
+
+ dbus_g_proxy_call_no_reply(dkp_main_proxy,
+ type,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ return;
+}
+
/* This function goes through and sets up what we need for
DKp checking. We're even setting up the calls for the props
we need */
@@ -83,12 +101,12 @@ create_items (DbusmenuMenuitem * root) {
mi = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(mi, "label", _("Suspend"));
dbusmenu_menuitem_child_append(root, mi);
- g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "suspend");
+ g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(sleep), "Suspend");
mi = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(mi, "label", _("Hibernate"));
dbusmenu_menuitem_child_append(root, mi);
- g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "hibernate");
+ g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(sleep), "Hibernate");
mi = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(mi, "label", _("Restart"));