Hello community,

here is the log from the commit of package xfce4-power-manager for 
openSUSE:12.3 checked in at 2013-03-04 17:35:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:12.3/xfce4-power-manager (Old)
 and      /work/SRC/openSUSE:12.3/.xfce4-power-manager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xfce4-power-manager", Maintainer is "xfce-maintain...@suse.de"

Changes:
--------
--- /work/SRC/openSUSE:12.3/xfce4-power-manager/xfce4-power-manager.changes     
2013-01-31 01:45:51.000000000 +0100
+++ 
/work/SRC/openSUSE:12.3/.xfce4-power-manager.new/xfce4-power-manager.changes    
    2013-03-04 17:35:19.000000000 +0100
@@ -1,0 +2,6 @@
+Tue Feb 26 06:57:49 UTC 2013 - g...@opensuse.org
+
+- added xfce4-power-manager-systemd-inhibit.patch which adds
+  systemd inhibit support (bnc#789057)
+
+-------------------------------------------------------------------

New:
----
  xfce4-power-manager-systemd-inhibit.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xfce4-power-manager.spec ++++++
--- /var/tmp/diff_new_pack.JFx3ML/_old  2013-03-04 17:35:19.000000000 +0100
+++ /var/tmp/diff_new_pack.JFx3ML/_new  2013-03-04 17:35:19.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package xfce4-power-manager
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -30,6 +30,8 @@
 Patch0:         xfce4-power-manager-fix-help.patch
 # PATCH-FIX-UPSTREAM xfce4-power-manager-fix-broken-translations.patch 
bnc#788361 g...@opensuse.org -- Fix broken format strings in translations 
causing crashes
 Patch1:         xfce4-power-manager-fix-broken-translations.patch
+# PATCH-FEATURE-UPSTREAM xfce4-power-manager-systemd-inhibit.patch bnc#789057 
g...@opensuse.org -- Add systemd inhibit support
+Patch2:         xfce4-power-manager-systemd-inhibit.patch
 BuildRequires:  ed
 BuildRequires:  fdupes
 BuildRequires:  intltool
@@ -83,6 +85,7 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 # show in LXDE as well
 ed -s src/xfce4-power-manager.desktop.in 2>/dev/null <<'EOF'
 ,s/^OnlyShowIn=XFCE;/OnlyShowIn=XFCE;LXDE;/

++++++ xfce4-power-manager-systemd-inhibit.patch ++++++
>From 3d721db740dc0016da71e323eac4d8caef6439a3 Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <s...@altlinux.org>
Date: Thu, 21 Feb 2013 15:03:44 +0400
Subject: [PATCH] Don't allow systemd to handle suspend/hibernate events.

---
 src/xfpm-main.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 85 insertions(+), 2 deletions(-)

diff --git a/src/xfpm-main.c b/src/xfpm-main.c
index a98583b..f23f1ce 100644
--- a/src/xfpm-main.c
+++ b/src/xfpm-main.c
@@ -194,16 +194,96 @@ xfpm_dump_remote (DBusGConnection *bus)
     g_hash_table_destroy (hash);
 }
 
+static gint
+xfpm_inhibit_sleep_systemd (DBusGConnection *bus)
+{
+    DBusConnection *bus_connection;
+    DBusMessage *message = NULL, *reply = NULL;
+    DBusError error;
+    gint fd = -1;
+    const char *what = 
"handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch";
+    const char *who = "xfce4-power-manager";
+    const char *why = "xfce4-power-manager handles these events";
+    const char *mode = "block";
+
+    bus_connection = dbus_g_connection_get_connection (bus);
+    if (!xfpm_dbus_name_has_owner (bus_connection, "org.freedesktop.login1"))
+        return -1;
+
+    dbus_error_init (&error);
+
+    message = dbus_message_new_method_call ("org.freedesktop.login1",
+                                            "/org/freedesktop/login1",
+                                            "org.freedesktop.login1.Manager",
+                                            "Inhibit");
+
+    if (!message)
+    {
+        g_warning ("Unable to call Inhibit()");
+        goto done;
+    }
+
+
+    if (!dbus_message_append_args (message,
+                            DBUS_TYPE_STRING, &what,
+                            DBUS_TYPE_STRING, &who,
+                            DBUS_TYPE_STRING, &why,
+                            DBUS_TYPE_STRING, &mode,
+                            DBUS_TYPE_INVALID))
+    {
+        g_warning ("Unable to call Inhibit()");
+        goto done;
+    }
+
+
+    reply = dbus_connection_send_with_reply_and_block (bus_connection, 
message, -1, &error);
+    if (!reply)
+    {
+        g_warning ("Unable to inhibit systemd sleep: %s", error.message);
+        goto done;
+    }
+
+    if (!dbus_message_get_args (reply, &error,
+                                DBUS_TYPE_UNIX_FD, &fd,
+                                DBUS_TYPE_INVALID))
+    {
+        g_warning ("Inhibit() reply parsing failed: %s", error.message);
+    }
+
+done:
+
+    if (message)
+        dbus_message_unref (message);
+    if (reply)
+        dbus_message_unref (reply);
+    dbus_error_free (&error);
+
+    return fd;
+}
+
 static void G_GNUC_NORETURN
 xfpm_start (DBusGConnection *bus, const gchar *client_id, gboolean dump)
 {
+    DBusGConnection *system_bus;
     XfpmManager *manager;
     GError *error = NULL;
+    gint inhibit_fd = -1;
     
     XFPM_DEBUG ("Starting the power manager");
     
     manager = xfpm_manager_new (bus, client_id);
-    
+
+    /* Don't allow systemd to handle power/suspend/hibernate buttons
+     * and lid-switch */
+    system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+    if (system_bus)
+        inhibit_fd = xfpm_inhibit_sleep_systemd (system_bus);
+    else
+    {
+        g_warning ("Unable connect to system bus: %s", error->message);
+        g_clear_error (&error);
+    }
+
     if ( xfce_posix_signal_handler_init (&error)) 
     {
         xfce_posix_signal_handler_set_handler (SIGHUP,
@@ -238,7 +318,10 @@ xfpm_start (DBusGConnection *bus, const gchar *client_id, 
gboolean dump)
     gtk_main ();
     
     g_object_unref (manager);
-    
+
+    if (inhibit_fd >= 0)
+        close (inhibit_fd);
+
     exit (EXIT_SUCCESS);
 }
 
-- 
1.8.1.3

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to