summaryrefslogtreecommitdiff
path: root/cut-n-paste/totem-screensaver
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-02-09 15:58:39 +0300
committermonsta <[email protected]>2016-02-09 16:24:24 +0300
commitd40ff2ce9b71ad6afa71724514447052b0e1868b (patch)
tree5e34749d5788e188949d48dd311f0bfc7999abe4 /cut-n-paste/totem-screensaver
parentc524a57434e6ffa43e869cb694e00a788b615552 (diff)
downloadeom-d40ff2ce9b71ad6afa71724514447052b0e1868b.tar.bz2
eom-d40ff2ce9b71ad6afa71724514447052b0e1868b.tar.xz
totem-screensaver: use org.gnome.SessionManager to inhibit screensaver
adapted from: https://git.gnome.org/browse/totem/commit/?id=c6fc9c4785904cda4b648dbdbd24958d1010c4a1 https://github.com/linuxmint/xreader/commit/feca69fe519d4c24457d17c0287704aa47688e22 https://github.com/linuxmint/xreader/commit/af897180ec8fb30afb2f96dab23a2f2ae022f087
Diffstat (limited to 'cut-n-paste/totem-screensaver')
-rw-r--r--cut-n-paste/totem-screensaver/totem-scrsaver.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c
index d31fe52..78a81b5 100644
--- a/cut-n-paste/totem-screensaver/totem-scrsaver.c
+++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c
@@ -41,10 +41,11 @@
#include "totem-scrsaver.h"
-#define GS_SERVICE "org.mate.ScreenSaver"
-#define GS_PATH "/org/mate/ScreenSaver"
-#define GS_INTERFACE "org.mate.ScreenSaver"
+#define GS_SERVICE "org.gnome.SessionManager"
+#define GS_PATH "/org/gnome/SessionManager"
+#define GS_INTERFACE "org.gnome.SessionManager"
+#define GSM_INHIBITOR_FLAG_IDLE 1 << 3
#define XSCREENSAVER_MIN_TIMEOUT 60
enum {
@@ -61,7 +62,7 @@ struct TotemScrsaverPrivate {
char *reason;
GDBusProxy *gs_proxy;
- gboolean have_screensaver_dbus;
+ gboolean have_session_dbus;
guint32 cookie;
/* To save the screensaver info */
@@ -81,7 +82,7 @@ G_DEFINE_TYPE(TotemScrsaver, totem_scrsaver, G_TYPE_OBJECT)
static gboolean
screensaver_is_running_dbus (TotemScrsaver *scr)
{
- return scr->priv->have_screensaver_dbus;
+ return scr->priv->have_session_dbus;
}
static void
@@ -144,7 +145,7 @@ screensaver_inhibit_dbus (TotemScrsaver *scr,
{
TotemScrsaverPrivate *priv = scr->priv;
- if (!priv->have_screensaver_dbus)
+ if (!priv->have_session_dbus)
return;
g_object_ref (scr);
@@ -153,17 +154,19 @@ screensaver_inhibit_dbus (TotemScrsaver *scr,
g_return_if_fail (scr->priv->reason != NULL);
g_dbus_proxy_call (priv->gs_proxy,
"Inhibit",
- g_variant_new ("(ss)",
+ g_variant_new ("(susu)",
g_get_application_name (),
- scr->priv->reason),
+ 0,
+ scr->priv->reason,
+ GSM_INHIBITOR_FLAG_IDLE),
G_DBUS_CALL_FLAGS_NO_AUTO_START,
-1,
NULL,
on_inhibit_cb,
scr);
} else {
- g_dbus_proxy_call (priv->gs_proxy,
- "UnInhibit",
+ g_dbus_proxy_call (priv->gs_proxy,
+ "Uninhibit",
g_variant_new ("(u)", priv->cookie),
G_DBUS_CALL_FLAGS_NO_AUTO_START,
-1,
@@ -193,10 +196,10 @@ screensaver_update_dbus_presence (TotemScrsaver *scr)
name_owner = g_dbus_proxy_get_name_owner (priv->gs_proxy);
if (name_owner) {
- priv->have_screensaver_dbus = TRUE;
+ priv->have_session_dbus = TRUE;
g_free (name_owner);
} else {
- priv->have_screensaver_dbus = FALSE;
+ priv->have_session_dbus = FALSE;
}
}