From 7a65a910b77ad191d69881098c47f9b0c852d92e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 13 Aug 2013 01:33:19 -0700 Subject: Tue Aug 13 01:31:08 PDT 2013 --- ...ogind-to-discover-critical-action-availab.patch | 77 ++++++++++++++++++++++ extra/gnome-settings-daemon/PKGBUILD | 15 +++-- 2 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 extra/gnome-settings-daemon/0001-power-Use-logind-to-discover-critical-action-availab.patch (limited to 'extra/gnome-settings-daemon') diff --git a/extra/gnome-settings-daemon/0001-power-Use-logind-to-discover-critical-action-availab.patch b/extra/gnome-settings-daemon/0001-power-Use-logind-to-discover-critical-action-availab.patch new file mode 100644 index 000000000..7e678f936 --- /dev/null +++ b/extra/gnome-settings-daemon/0001-power-Use-logind-to-discover-critical-action-availab.patch @@ -0,0 +1,77 @@ +From 1271864ddfc053a1567d046b5fcdf8351da3f438 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +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 + #include + #include +-#define UPOWER_ENABLE_DEPRECATED 1 + #include + #include + #include +@@ -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 + diff --git a/extra/gnome-settings-daemon/PKGBUILD b/extra/gnome-settings-daemon/PKGBUILD index 4cc694531..c2a375b44 100644 --- a/extra/gnome-settings-daemon/PKGBUILD +++ b/extra/gnome-settings-daemon/PKGBUILD @@ -1,9 +1,9 @@ -# $Id: PKGBUILD 191201 2013-07-19 20:57:52Z heftig $ +# $Id: PKGBUILD 192484 2013-08-12 21:17:34Z heftig $ # Maintainer: Jan Alexander Steffens (heftig) pkgname=gnome-settings-daemon pkgver=3.8.4 -pkgrel=1 +pkgrel=2 pkgdesc="The GNOME Settings daemon" arch=('i686' 'x86_64') license=('GPL') @@ -14,8 +14,15 @@ options=('!emptydirs' '!libtool') 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 -- cgit v1.2.3-54-g00ecf