summaryrefslogtreecommitdiff
path: root/cut-n-paste
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-02-09 15:48:29 +0300
committermonsta <[email protected]>2016-02-09 16:54:49 +0300
commit7c3a52425cad15ed67816164f0f58c8d406edb33 (patch)
treeb5f8236986014e45d90aec3cb28989287466f3dc /cut-n-paste
parent38218ebe8252b144316aa140492a7c3353a6eaed (diff)
downloadatril-7c3a52425cad15ed67816164f0f58c8d406edb33.tar.bz2
atril-7c3a52425cad15ed67816164f0f58c8d406edb33.tar.xz
totem-screensaver: don't use old API and add ref to TotemScrsaver
taken from: https://git.gnome.org/browse/totem/commit/?id=07e11de11a9f84209b31ebffdeec4983f91b9dae https://git.gnome.org/browse/totem/commit/?id=f4eed1f68d3b4ca37c2e7440be37aeaef882a0d5
Diffstat (limited to 'cut-n-paste')
-rw-r--r--cut-n-paste/totem-screensaver/totem-scrsaver.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c
index 25cdece0..d31fe52e 100644
--- a/cut-n-paste/totem-screensaver/totem-scrsaver.c
+++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c
@@ -63,7 +63,6 @@ struct TotemScrsaverPrivate {
GDBusProxy *gs_proxy;
gboolean have_screensaver_dbus;
guint32 cookie;
- gboolean old_dbus_api;
/* To save the screensaver info */
int timeout;
@@ -97,23 +96,8 @@ on_inhibit_cb (GObject *source_object,
value = g_dbus_proxy_call_finish (proxy, res, &error);
if (!value) {
- if (!scr->priv->old_dbus_api &&
- g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
- g_return_if_fail (scr->priv->reason != NULL);
- /* try the old API */
- scr->priv->old_dbus_api = TRUE;
- g_dbus_proxy_call (proxy,
- "InhibitActivation",
- g_variant_new ("(s)",
- scr->priv->reason),
- G_DBUS_CALL_FLAGS_NO_AUTO_START,
- -1,
- NULL,
- on_inhibit_cb,
- scr);
- } else {
- g_warning ("Problem inhibiting the screensaver: %s", error->message);
- }
+ g_warning ("Problem inhibiting the screensaver: %s", error->message);
+ g_object_unref (scr);
g_error_free (error);
return;
@@ -125,6 +109,7 @@ on_inhibit_cb (GObject *source_object,
else
scr->priv->cookie = 0;
g_variant_unref (value);
+ g_object_unref (scr);
}
static void
@@ -139,21 +124,8 @@ on_uninhibit_cb (GObject *source_object,
value = g_dbus_proxy_call_finish (proxy, res, &error);
if (!value) {
- if (!scr->priv->old_dbus_api &&
- g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
- /* try the old API */
- scr->priv->old_dbus_api = TRUE;
- g_dbus_proxy_call (proxy,
- "AllowActivation",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NO_AUTO_START,
- -1,
- NULL,
- on_uninhibit_cb,
- scr);
- } else {
- g_warning ("Problem uninhibiting the screensaver: %s", error->message);
- }
+ g_warning ("Problem uninhibiting the screensaver: %s", error->message);
+ g_object_unref (scr);
g_error_free (error);
return;
@@ -162,6 +134,8 @@ on_uninhibit_cb (GObject *source_object,
/* clear the cookie */
scr->priv->cookie = 0;
g_variant_unref (value);
+
+ g_object_unref (scr);
}
static void
@@ -173,7 +147,7 @@ screensaver_inhibit_dbus (TotemScrsaver *scr,
if (!priv->have_screensaver_dbus)
return;
- scr->priv->old_dbus_api = FALSE;
+ g_object_ref (scr);
if (inhibit) {
g_return_if_fail (scr->priv->reason != NULL);