[arch-commits] Commit in xfce4-power-manager/trunk (2 files)

Evangelos Foutras foutrelis at nymeria.archlinux.org
Sat Aug 3 15:41:24 UTC 2013


    Date: Saturday, August 3, 2013 @ 17:41:23
  Author: foutrelis
Revision: 191981

upgpkg: xfce4-power-manager 1.2.0-5

Use logind interfaces for suspend and hibernate (FS#36363).

Added:
  xfce4-power-manager/trunk/xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch
Modified:
  xfce4-power-manager/trunk/PKGBUILD

----------------------------------------------------------------------+
 PKGBUILD                                                             |   14 
 xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch |  156 ++++++++++
 2 files changed, 168 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-08-03 15:37:32 UTC (rev 191980)
+++ PKGBUILD	2013-08-03 15:41:23 UTC (rev 191981)
@@ -4,7 +4,7 @@
 
 pkgname=xfce4-power-manager
 pkgver=1.2.0
-pkgrel=4
+pkgrel=5
 pkgdesc="Power manager for Xfce desktop"
 arch=('i686' 'x86_64')
 url="http://www.xfce.org/"
@@ -15,18 +15,28 @@
 options=('!libtool')
 install=$pkgname.install
 source=(http://archive.xfce.org/src/apps/$pkgname/1.2/$pkgname-$pkgver.tar.bz2
+        xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch
         xfce4-power-manager-1.2.0-sync-en-gb-translation.patch)
 sha256sums=('d7fb98a540284b62f4201527de17d4b24123f9d26c9f49131dd497c8387184e9'
+            '4166f61234abfcd385d43b1e7f7ab5b73711bcb7335ef0f6b217ac799dc9266b'
             'c8e1dfafd685c2abf1fcc2b3682f5b1eb2e7f1d4fa557f11a7478437eef9a933')
 
-build() {
+prepare() {
   cd "$srcdir/$pkgname-$pkgver"
 
+  # Use logind interfaces for suspend and hibernate
+  # https://bugzilla.xfce.org/show_bug.cgi?id=9963
+  patch -Np1 -i "$srcdir/xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch"
+
   # Fix en_GB translation
   # https://bugs.archlinux.org/task/30055
   patch -d po -Np0 -i \
     "$srcdir/xfce4-power-manager-1.2.0-sync-en-gb-translation.patch"
+}
 
+build() {
+  cd "$srcdir/$pkgname-$pkgver"
+
   ./configure \
     --prefix=/usr \
     --sysconfdir=/etc \

Added: xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch
===================================================================
--- xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch	                        (rev 0)
+++ xfce4-power-manager-1.2.0-logind-support-for-suspend-hibernate.patch	2013-08-03 15:41:23 UTC (rev 191981)
@@ -0,0 +1,156 @@
+From 244d0f09561eace29cbef819c2deb55b13701e25 Mon Sep 17 00:00:00 2001
+From: Mikhail Efremov <sem at altlinux.org>
+Date: Mon, 8 Apr 2013 21:04:30 +0400
+Subject: [PATCH] Add systemd-logind support for suspend/hibernate.
+
+---
+ configure.ac.in         | 20 +++++++++++++++++
+ src/xfpm-power-common.h |  8 +++++++
+ src/xfpm-power.c        | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-
+ 3 files changed, 84 insertions(+), 1 deletion(-)
+
+diff --git a/src/xfpm-power-common.h b/src/xfpm-power-common.h
+index 1040aed..11eaedc 100644
+--- a/src/xfpm-power-common.h
++++ b/src/xfpm-power-common.h
+@@ -33,9 +33,17 @@
+ #define UPOWER_PATH_WAKEUPS   "/org/freedesktop/UPower/Wakeups"
+ #define UPOWER_IFACE_WAKEUPS  "org.freedesktop.UPower.Wakeups"
+ 
++#ifdef WITH_SLEEP_MANAGER_UPOWER
+ #define POLKIT_AUTH_SUSPEND   "org.freedesktop.upower.suspend"
+ #define	POLKIT_AUTH_HIBERNATE "org.freedesktop.upower.hibernate"
++#else
++#define LOGIND_NAME 	      "org.freedesktop.login1"
++#define LOGIND_PATH 	      "/org/freedesktop/login1"
++#define LOGIND_IFACE 	      "org.freedesktop.login1.Manager"
+ 
++#define POLKIT_AUTH_SUSPEND   "org.freedesktop.login1.suspend"
++#define	POLKIT_AUTH_HIBERNATE "org.freedesktop.login1.hibernate"
++#endif
+ 
+ GPtrArray 	*xfpm_power_enumerate_devices		(DBusGProxy *proxy);
+ 
+diff --git a/src/xfpm-power.c b/src/xfpm-power.c
+index 796bef8..4a91e33 100644
+--- a/src/xfpm-power.c
++++ b/src/xfpm-power.c
+@@ -72,7 +72,10 @@ struct XfpmPowerPrivate
+     
+     DBusGProxy      *proxy;
+     DBusGProxy      *proxy_prop;
+-    
++#ifndef WITH_SLEEP_MANAGER_UPOWER
++    DBusGProxy      *proxy_logind;
++#endif
++
+     GHashTable      *hash;
+     
+     XfpmConsoleKit  *console;
+@@ -153,6 +156,7 @@ xfpm_power_check_polkit_auth (XfpmPower *power)
+ }
+ #endif
+ 
++#ifdef WITH_SLEEP_MANAGER_UPOWER
+ static void
+ xfpm_power_check_pm (XfpmPower *power, GHashTable *props)
+ {
+@@ -186,6 +190,32 @@ xfpm_power_check_pm (XfpmPower *power, GHashTable *props)
+ 	power->priv->can_hibernate = ret;
+     }
+ }
++#else
++static gboolean
++xfpm_power_can_sleep_method (XfpmPower *power, const char *method)
++{
++    GError *error = NULL;
++    char *retstr = NULL;
++    gboolean ret = FALSE;
++
++    if (!dbus_g_proxy_call (power->priv->proxy_logind, method, &error,
++            G_TYPE_INVALID,
++            G_TYPE_STRING, &retstr,
++            G_TYPE_INVALID))
++    {
++        g_warning ("Unable to check %s method: %s", method, error->message);
++        g_error_free (error);
++
++        return FALSE;
++    }
++
++	if (retstr && !strcmp (retstr, "yes"))
++			ret = TRUE;
++	g_free (retstr);
++
++    return ret;
++}
++#endif
+ 
+ static void
+ xfpm_power_check_power (XfpmPower *power, GHashTable *props)
+@@ -276,7 +306,12 @@ xfpm_power_get_properties (XfpmPower *power)
+     
+     props = xfpm_power_get_interface_properties (power->priv->proxy_prop, UPOWER_IFACE);
+     
++#ifdef WITH_SLEEP_MANAGER_UPOWER
+     xfpm_power_check_pm (power, props);
++#else
++    power->priv->can_suspend = xfpm_power_can_sleep_method (power, "CanSuspend");
++    power->priv->can_hibernate = xfpm_power_can_sleep_method (power, "CanHibernate");
++#endif
+     xfpm_power_check_lid (power, props);
+     xfpm_power_check_power (power, props);
+ 
+@@ -347,9 +382,16 @@ xfpm_power_sleep (XfpmPower *power, const gchar *sleep_time, gboolean force)
+ 	xfpm_lock_screen ();
+     }
+     
++#ifdef WITH_SLEEP_MANAGER_UPOWER
+     dbus_g_proxy_call (power->priv->proxy, sleep_time, &error,
+ 		       G_TYPE_INVALID,
+ 		       G_TYPE_INVALID);
++#else
++    dbus_g_proxy_call (power->priv->proxy_logind, sleep_time, &error,
++		       G_TYPE_BOOLEAN, TRUE,
++		       G_TYPE_INVALID,
++		       G_TYPE_INVALID);
++#endif
+     
+     if ( error )
+     {
+@@ -1360,12 +1402,20 @@ xfpm_power_init (XfpmPower *power)
+ 							 UPOWER_NAME,
+ 							 UPOWER_PATH,
+ 							 DBUS_INTERFACE_PROPERTIES);
++
+     if (power->priv->proxy_prop == NULL) 
+     {
+ 	g_critical ("Unable to create proxy for %s", UPOWER_NAME);
+ 	goto out;
+     }
+     
++#ifndef WITH_SLEEP_MANAGER_UPOWER
++    power->priv->proxy_logind = dbus_g_proxy_new_for_name (power->priv->bus,
++						    LOGIND_NAME,
++						    LOGIND_PATH,
++						    LOGIND_IFACE);
++#endif
++
+     xfpm_power_get_power_devices (power);
+     xfpm_power_get_properties (power);
+ #ifdef ENABLE_POLKIT
+@@ -1467,6 +1517,11 @@ xfpm_power_finalize (GObject *object)
+     if ( power->priv->proxy_prop )
+ 	g_object_unref (power->priv->proxy_prop);
+ 
++#ifndef WITH_SLEEP_MANAGER_UPOWER
++    if ( power->priv->proxy_logind )
++	g_object_unref (power->priv->proxy_logind);
++#endif
++
+     g_hash_table_destroy (power->priv->hash);
+ 
+ #ifdef ENABLE_POLKIT
+-- 
+1.8.1.5
+




More information about the arch-commits mailing list