diff options
author | monsta <[email protected]> | 2016-02-09 15:58:39 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-02-09 16:54:51 +0300 |
commit | 28189711b615ff79bc359759b8f4278d74ee9bf5 (patch) | |
tree | 93d51de048a2f9ba8170e9dd7e897b1129fb082c /cut-n-paste/totem-screensaver/totem-scrsaver.c | |
parent | 7c3a52425cad15ed67816164f0f58c8d406edb33 (diff) | |
download | atril-28189711b615ff79bc359759b8f4278d74ee9bf5.tar.bz2 atril-28189711b615ff79bc359759b8f4278d74ee9bf5.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/totem-scrsaver.c')
-rw-r--r-- | cut-n-paste/totem-screensaver/totem-scrsaver.c | 27 |
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 d31fe52e..78a81b5f 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; } } |