aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/gtk-dialog/gtk-logout-helper.c49
-rw-r--r--src/session-service.c4
3 files changed, 52 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 221da2c..b3bfd8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-session, 0.2.3)
+AM_INIT_AUTOMAKE(indicator-session, 0.2.4)
AM_MAINTAINER_MODE
diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c
index d8aea6b..c8635e6 100644
--- a/src/gtk-dialog/gtk-logout-helper.c
+++ b/src/gtk-dialog/gtk-logout-helper.c
@@ -30,6 +30,53 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "gconf-helper.h"
static void
+consolekit_fallback (LogoutDialogAction action)
+{
+ DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
+ g_return_if_fail(sbus != NULL); /* worst case */
+ DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager");
+
+ if (proxy == NULL) {
+ g_warning("Unable to get consolekit proxy");
+ return;
+ }
+
+ GError * error = NULL;
+
+ switch (action) {
+ case LOGOUT_DIALOG_LOGOUT:
+ g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");
+ break;
+ case LOGOUT_DIALOG_SHUTDOWN:
+ dbus_g_proxy_call(proxy,
+ "Stop",
+ &error,
+ G_TYPE_INVALID);
+ break;
+ case LOGOUT_DIALOG_RESTART:
+ dbus_g_proxy_call(proxy,
+ "Restart",
+ &error,
+ G_TYPE_INVALID);
+ break;
+ default:
+ g_warning("Unknown action");
+ break;
+ }
+
+ g_object_unref(proxy);
+
+ if (error != NULL) {
+ g_error("Unable to signal ConsoleKit: %s", error->message);
+ g_error_free(error);
+ }
+
+ return;
+}
+
+static void
session_action (LogoutDialogAction action)
{
DBusGConnection * sbus;
@@ -50,6 +97,8 @@ session_action (LogoutDialogAction action)
if (sm_proxy == NULL) {
g_warning("Unable to get DBus proxy to SessionManager interface: %s", error->message);
g_error_free(error);
+
+ consolekit_fallback(action);
return;
}
diff --git a/src/session-service.c b/src/session-service.c
index 9fb9ee7..289bff8 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -226,7 +226,7 @@ up_changed_cb (DBusGProxy * proxy, gpointer user_data)
G_TYPE_STRING,
UP_INTERFACE,
G_TYPE_STRING,
- "can-suspend",
+ "CanSuspend",
G_TYPE_INVALID,
G_TYPE_VALUE,
G_TYPE_INVALID);
@@ -242,7 +242,7 @@ up_changed_cb (DBusGProxy * proxy, gpointer user_data)
G_TYPE_STRING,
UP_INTERFACE,
G_TYPE_STRING,
- "can-hibernate",
+ "CanHibernate",
G_TYPE_INVALID,
G_TYPE_VALUE,
G_TYPE_INVALID);