summaryrefslogtreecommitdiffstats
path: root/x11
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-10-25 08:14:32 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-10-25 08:14:32 +0800
commit7ad79bc9c0a71874e1a39bbaadbf7440269b37de (patch)
treeb4be5471684204f040e8061ae1fcb1fb1d01e1d8 /x11
parent143e51e09f6a958fac3fb5096cf63fa97f47596a (diff)
downloadmarcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar.gz
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar.bz2
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar.lz
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar.xz
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.tar.zst
marcuscom-ports-7ad79bc9c0a71874e1a39bbaadbf7440269b37de.zip
Add back code to use gnome-power-manager.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@13188 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11')
-rw-r--r--x11/gdm/Makefile3
-rw-r--r--x11/gdm/files/patch-gui_simple-greeter_gdm-greeter-login-window.c155
2 files changed, 157 insertions, 1 deletions
diff --git a/x11/gdm/Makefile b/x11/gdm/Makefile
index 8e076bfeb..3e452f267 100644
--- a/x11/gdm/Makefile
+++ b/x11/gdm/Makefile
@@ -3,11 +3,12 @@
# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
#
# $FreeBSD$
-# $MCom: ports/x11/gdm/Makefile,v 1.160 2009/10/14 17:00:33 marcus Exp $
+# $MCom: ports/x11/gdm/Makefile,v 1.161 2009/10/20 10:40:55 kwm Exp $
#
PORTNAME= gdm
PORTVERSION= 2.28.1
+PORTREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2
diff --git a/x11/gdm/files/patch-gui_simple-greeter_gdm-greeter-login-window.c b/x11/gdm/files/patch-gui_simple-greeter_gdm-greeter-login-window.c
new file mode 100644
index 000000000..55f6d7ec8
--- /dev/null
+++ b/x11/gdm/files/patch-gui_simple-greeter_gdm-greeter-login-window.c
@@ -0,0 +1,155 @@
+--- gui/simple-greeter/gdm-greeter-login-window.c.orig 2009-10-24 20:05:24.000000000 -0400
++++ gui/simple-greeter/gdm-greeter-login-window.c 2009-10-24 20:11:02.000000000 -0400
+@@ -56,10 +56,6 @@
+ #include <dbus/dbus-glib.h>
+ #include <dbus/dbus-glib-lowlevel.h>
+
+-#ifdef HAVE_DEVICEKIT_POWER
+-#include <devkit-power-gobject/devicekit-power.h>
+-#endif
+-
+ #include "gdm-settings-client.h"
+ #include "gdm-settings-keys.h"
+ #include "gdm-profile.h"
+@@ -83,6 +79,10 @@
+ #define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat"
+ #define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
+
++#define GPM_DBUS_NAME "org.freedesktop.PowerManagement"
++#define GPM_DBUS_PATH "/org/freedesktop/PowerManagement"
++#define GPM_DBUS_INTERFACE "org.freedesktop.PowerManagement"
++
+ #define GLADE_XML_FILE "gdm-greeter-login-window.glade"
+
+ #define KEY_GREETER_DIR "/apps/gdm/simple-greeter"
+@@ -477,22 +477,46 @@ adjust_other_login_visibility(GdmGreeter
+ }
+ }
+
+-#ifdef HAVE_DEVICEKIT_POWER
+ static gboolean
+ can_suspend (GdmGreeterLoginWindow *login_window)
+ {
+- gboolean ret;
+- DkpClient *dkp_client;
++ DBusGConnection *connection;
++ DBusGProxy *proxy;
++ GError *error;
++ gboolean ret;
++ gboolean res;
++
++ error = NULL;
++ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
++ if (error != NULL) {
++ g_warning ("Couldn't connect to power manager: %s", error->message);
++ g_error_free (error);
++ return FALSE;
++ }
++ proxy = dbus_g_proxy_new_for_name (connection,
++ GPM_DBUS_NAME,
++ GPM_DBUS_PATH,
++ GPM_DBUS_INTERFACE);
++
++ ret = FALSE;
++
++ res = dbus_g_proxy_call (proxy, "CanSuspend",
++ &error,
++ G_TYPE_INVALID,
++ G_TYPE_BOOLEAN,
++ &ret,
++ G_TYPE_INVALID);
++ if (!res) {
++ if (error != NULL) {
++ g_warning ("Could not ask power manager if user can suspend: %s",
++ error->message);
++ g_error_free (error);
++ }
++ ret = FALSE;
++ }
+
+- /* use DeviceKit-power to get data */
+- dkp_client = dkp_client_new ();
+- g_object_get (dkp_client,
+- "can-suspend", &ret,
+- NULL);
+- g_object_unref (dkp_client);
+- return ret;
++ return ret;
+ }
+-#endif
+
+ static void
+ remove_sensitize_power_buttons_timeout (GdmGreeterLoginWindow *login_window)
+@@ -544,11 +568,7 @@ switch_mode (GdmGreeterLoginWindow *logi
+
+ show_restart_buttons = get_show_restart_buttons (login_window);
+
+-#ifdef HAVE_DEVICEKIT_POWER
+ show_suspend_button = can_suspend (login_window);
+-#else
+- show_suspend_button = FALSE;
+-#endif
+
+ /* we want to run this even if we're supposed to
+ be in the mode already so that we reset everything
+@@ -634,25 +654,39 @@ do_disconnect (GdmGreeterLoginWindow *lo
+ gtk_main_quit ();
+ }
+
+-#ifdef HAVE_DEVICEKIT_POWER
+ static void
+ do_suspend (GdmGreeterLoginWindow *login_window)
+ {
+- gboolean ret;
+- DkpClient *dkp_client;
+- GError *error = NULL;
+-
+- /* use DeviceKit-power to get data */
+- dkp_client = dkp_client_new ();
+- ret = dkp_client_suspend (dkp_client, &error);
+- if (!ret) {
++ GError *error;
++ DBusGConnection *connection;
++ DBusGProxy *proxy;
++
++ g_debug ("GdmGreeterLoginWindow: Suspend button clicked");
++
++ error = NULL;
++ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
++ if (error != NULL) {
+ g_warning ("Couldn't suspend: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+- g_object_unref (dkp_client);
++ proxy = dbus_g_proxy_new_for_name (connection,
++ GPM_DBUS_NAME,
++ GPM_DBUS_PATH,
++ GPM_DBUS_INTERFACE);
++ error = NULL;
++ dbus_g_proxy_call (proxy,
++ "Suspend",
++ &error,
++ G_TYPE_INVALID,
++ G_TYPE_INVALID);
++ if (error != NULL) {
++ g_warning ("Couldn't suspend: %s", error->message);
++ g_error_free (error);
++ return;
++ }
++ g_object_unref (proxy);
+ }
+-#endif
+
+ static void
+ delete_entry_text (GtkWidget *entry)
+@@ -971,9 +1005,7 @@ static void
+ suspend_button_clicked (GtkButton *button,
+ GdmGreeterLoginWindow *login_window)
+ {
+-#ifdef HAVE_DEVICEKIT_POWER
+ do_suspend (login_window);
+-#endif
+ }
+
+