[arch-commits] Commit in gnome-settings-daemon/trunk (2 files)
Jan Steffens
heftig at nymeria.archlinux.org
Mon Aug 5 16:40:47 UTC 2013
Date: Monday, August 5, 2013 @ 18:40:47
Author: heftig
Revision: 192078
Add patch for upower
Added:
gnome-settings-daemon/trunk/0001-power-Use-logind-to-discover-critical-action-availab.patch
Modified:
gnome-settings-daemon/trunk/PKGBUILD
-----------------------------------------------------------------+
0001-power-Use-logind-to-discover-critical-action-availab.patch | 77 ++++++++++
PKGBUILD | 13 +
2 files changed, 87 insertions(+), 3 deletions(-)
Added: 0001-power-Use-logind-to-discover-critical-action-availab.patch
===================================================================
--- 0001-power-Use-logind-to-discover-critical-action-availab.patch (rev 0)
+++ 0001-power-Use-logind-to-discover-critical-action-availab.patch 2013-08-05 16:40:47 UTC (rev 192078)
@@ -0,0 +1,77 @@
+From 1271864ddfc053a1567d046b5fcdf8351da3f438 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens at gmail.com>
+Date: Mon, 5 Aug 2013 18:15:00 +0200
+Subject: [PATCH] power: Use logind to discover critical action availability
+
+The upower functionality is deprecated and will return an
+error unless upower is built with --enable-deprecated.
+
+Follows a similar patch to gnome-control-center.
+---
+ plugins/power/gsd-power-manager.c | 42 ++++++++++++++++++++++++++++-----------
+ 1 file changed, 30 insertions(+), 12 deletions(-)
+
+diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
+index fde90ef..8bd124f 100644
+--- a/plugins/power/gsd-power-manager.c
++++ b/plugins/power/gsd-power-manager.c
+@@ -27,7 +27,6 @@
+ #include <string.h>
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
+-#define UPOWER_ENABLE_DEPRECATED 1
+ #include <libupower-glib/upower.h>
+ #include <libnotify/notify.h>
+ #include <canberra-gtk.h>
+@@ -1164,18 +1163,37 @@ static GsdPowerActionType
+ manager_critical_action_get (GsdPowerManager *manager,
+ gboolean is_ups)
+ {
+- GsdPowerActionType policy;
++ GsdPowerActionType policy = GSD_POWER_ACTION_SHUTDOWN;
++ GsdPowerActionType setpolicy;
++ GVariant *result = NULL;
++ gchar *s;
+
+- policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action");
+- if (policy == GSD_POWER_ACTION_SUSPEND) {
+- if (is_ups == FALSE &&
+- up_client_get_can_suspend (manager->priv->up_client))
+- return policy;
+- return GSD_POWER_ACTION_SHUTDOWN;
+- } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
+- if (up_client_get_can_hibernate (manager->priv->up_client))
+- return policy;
+- return GSD_POWER_ACTION_SHUTDOWN;
++ setpolicy = g_settings_get_enum (manager->priv->settings, "critical-battery-action");
++
++ if (setpolicy == GSD_POWER_ACTION_SUSPEND) {
++ if (is_ups == FALSE) {
++ result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
++ "CanSuspend",
++ NULL,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1, NULL, NULL);
++ }
++ } else if (setpolicy == GSD_POWER_ACTION_HIBERNATE) {
++ result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
++ "CanHibernate",
++ NULL,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1, NULL, NULL);
++ } else {
++ /* Other actions need no check */
++ return setpolicy;
++ }
++
++ if (result) {
++ g_variant_get (result, "(s)", &s);
++ if (g_strcmp0 (s, "yes") == 0)
++ policy = setpolicy;
++ g_variant_unref (result);
+ }
+
+ return policy;
+--
+1.8.3.4
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2013-08-05 16:37:39 UTC (rev 192077)
+++ PKGBUILD 2013-08-05 16:40:47 UTC (rev 192078)
@@ -3,7 +3,7 @@
pkgname=gnome-settings-daemon
pkgver=3.8.4
-pkgrel=1
+pkgrel=2
pkgdesc="The GNOME Settings daemon"
arch=('i686' 'x86_64')
license=('GPL')
@@ -14,9 +14,16 @@
install=gnome-settings-daemon.install
url="http://www.gnome.org"
groups=('gnome')
-source=(http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz)
-sha256sums=('03ad56a8d517faf0754efcf2e7e26257e9ddbe32ef2931f3579138659cc178bc')
+source=(http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
+ 0001-power-Use-logind-to-discover-critical-action-availab.patch)
+sha256sums=('03ad56a8d517faf0754efcf2e7e26257e9ddbe32ef2931f3579138659cc178bc'
+ '9825d3486665d87d4fc54355a6d318d68f5d3caeb286bdd659147920a85c56d9')
+prepare() {
+ cd $pkgname-$pkgver
+ patch -Np1 -i ../0001-power-Use-logind-to-discover-critical-action-availab.patch
+}
+
build() {
cd $pkgname-$pkgver
More information about the arch-commits
mailing list