[sound-juicer] Convert sound-juicer from using gnome-power-manager to gnome-session for inhibits



commit 2ac0279eb2cb16fa4049c0eaf896f474a5bac1bc
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 28 09:33:21 2009 +0100

    Convert sound-juicer from using gnome-power-manager to gnome-session for inhibits

 src/sj-extracting.c |    4 +++-
 src/sj-inhibit.c    |   12 +++++++-----
 src/sj-inhibit.h    |    2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/sj-extracting.c b/src/sj-extracting.c
index e44a589..b7118b1 100644
--- a/src/sj-extracting.c
+++ b/src/sj-extracting.c
@@ -30,6 +30,7 @@
 #include <glib.h>
 #include <gio/gio.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkx.h>
 
 #include <brasero-volume.h>
 #include <canberra-gtk.h>
@@ -821,7 +822,8 @@ on_extract_activate (GtkWidget *button, gpointer user_data)
   }
   
   cookie = sj_inhibit (g_get_application_name (),
-                       _("Extracting audio from CD"));
+                       _("Extracting audio from CD"),
+                       GDK_WINDOW_XID(main_window->window));
 
   /* Save the genre */
   save_genre (genre_entry);
diff --git a/src/sj-inhibit.c b/src/sj-inhibit.c
index 7fc60e0..93ec101 100644
--- a/src/sj-inhibit.c
+++ b/src/sj-inhibit.c
@@ -26,13 +26,13 @@
 #include "sj-inhibit.h"
  
 /* PowerManagent defines */
-#define	PM_DBUS_SERVICE    "org.freedesktop.PowerManagement"
-#define	PM_DBUS_INHIBIT_PATH   "/org/freedesktop/PowerManagement/Inhibit"
-#define	PM_DBUS_INHIBIT_INTERFACE    "org.freedesktop.PowerManagement.Inhibit"
+#define	PM_DBUS_SERVICE    "org.gnome.SessionManager"
+#define	PM_DBUS_INHIBIT_PATH   "/org/gnome/SessionManager"
+#define	PM_DBUS_INHIBIT_INTERFACE    "org.gnome.SessionManager"
 
 /** cookie is returned as an unsigned integer */
 guint
-sj_inhibit (const gchar * appname, const gchar * reason)
+sj_inhibit (const gchar * appname, const gchar * reason, guint xid)
 {
   gboolean res;
   guint cookie;
@@ -60,8 +60,10 @@ sj_inhibit (const gchar * appname, const gchar * reason)
 
   res = dbus_g_proxy_call (proxy,
 			    "Inhibit", &error,
-			    G_TYPE_STRING, appname,
+			    G_TYPE_STRING, appname, /* app-id */
+			    G_TYPE_UINT, xid,
 			    G_TYPE_STRING, reason,
+			    G_TYPE_UINT, 4+8, /* flags, inhibit being marked idle and allowing suspend */
 			    G_TYPE_INVALID,
 			    G_TYPE_UINT, &cookie,
                             G_TYPE_INVALID);
diff --git a/src/sj-inhibit.h b/src/sj-inhibit.h
index b93fbf9..3498cfe 100644
--- a/src/sj-inhibit.h
+++ b/src/sj-inhibit.h
@@ -25,7 +25,7 @@
 
 #include <glib.h>
  
-guint sj_inhibit (const gchar * appname, const gchar * reason);
+guint sj_inhibit (const gchar * appname, const gchar * reason, guint xid);
 void sj_uninhibit (guint cookie);
 
 #endif /* SJ_INHIBIT_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]