diff -u notify-osd-0.9.35+15.04.20150126/debian/changelog notify-osd-0.9.35+15.04.20150126/debian/changelog --- notify-osd-0.9.35+15.04.20150126/debian/changelog +++ notify-osd-0.9.35+15.04.20150126/debian/changelog @@ -1,3 +1,10 @@ +notify-osd (0.9.35+15.04.20150126-0ubuntu1ppa1) vivid; urgency=medium + + * dnd_is_screensaver_inhibited no longer works due to deprecated dbus + method. replace it by new dnd_is_idle_inhibited (LP: #1440825) + + -- Nobuto Murata Tue, 07 Apr 2015 17:47:18 +0900 + notify-osd (0.9.35+15.04.20150126-0ubuntu1) vivid; urgency=low [ Alberts Muktupāvels ] only in patch2: unchanged: --- notify-osd-0.9.35+15.04.20150126.orig/src/dnd.c +++ notify-osd-0.9.35+15.04.20150126/src/dnd.c @@ -45,6 +45,7 @@ #include "dbus.h" static DBusGProxy *gsmgr = NULL; +static DBusGProxy *gscrsvr = NULL; gboolean dnd_is_xscreensaver_active () @@ -98,57 +99,67 @@ } static DBusGProxy* -get_screensaver_proxy (void) +get_gnomesession_proxy (void) { if (gsmgr == NULL) { DBusGConnection *connection = dbus_get_connection (); gsmgr = dbus_g_proxy_new_for_name (connection, - "org.gnome.ScreenSaver", - "/org/gnome/ScreenSaver", - "org.gnome.ScreenSaver"); + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager"); } return gsmgr; -} +} gboolean -dnd_is_screensaver_inhibited () +dnd_is_idle_inhibited () { GError *error = NULL; gboolean inhibited = FALSE; - char **list; + guint idle = 8; // 8: Inhibit the session being marked as idle - if (! get_screensaver_proxy ()) + if (! get_gnomesession_proxy ()) return FALSE; - if (dbus_g_proxy_call_with_timeout ( - gsmgr, "GetInhibitors", 2000, &error, - G_TYPE_INVALID, - G_TYPE_STRV, &list, - G_TYPE_INVALID)) - { - if (error) - { - g_warning ("dnd_is_screensaver_inhibited(): " - "got error \"%s\"\n", - error->message); - g_error_free (error); - error = NULL; - } - - /* if the list is not empty, the screensaver is inhibited */ - if (*list) - { - inhibited = TRUE; - g_debug ("Screensaver has been inhibited"); - } - g_strfreev (list); + dbus_g_proxy_call_with_timeout ( + gsmgr, "IsInhibited", 2000, &error, + G_TYPE_UINT, idle, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &inhibited, + G_TYPE_INVALID); + + if (error) + { + g_warning ("dnd_is_idle_inhibited(): " + "got error \"%s\"\n", + error->message); + g_error_free (error); + error = NULL; } + if (inhibited) + g_debug ("Session idleness has been inhibited"); + return inhibited; } +static DBusGProxy* +get_screensaver_proxy (void) +{ + if (gscrsvr == NULL) + { + DBusGConnection *connection = dbus_get_connection (); + gscrsvr = dbus_g_proxy_new_for_name (connection, + "org.gnome.ScreenSaver", + "/org/gnome/ScreenSaver", + "org.gnome.ScreenSaver"); + } + + return gscrsvr; +} + gboolean dnd_is_screensaver_active () { @@ -159,7 +170,7 @@ return FALSE; dbus_g_proxy_call_with_timeout ( - gsmgr, "GetActive", 2000, &error, + gscrsvr, "GetActive", 2000, &error, G_TYPE_INVALID, G_TYPE_BOOLEAN, &active, G_TYPE_INVALID); @@ -222,7 +233,7 @@ return (dnd_is_online_presence_dnd() || dnd_is_xscreensaver_active() || dnd_is_screensaver_active() - || dnd_is_screensaver_inhibited() + || dnd_is_idle_inhibited() || dnd_has_one_fullscreen_window() ); } only in patch2: unchanged: --- notify-osd-0.9.35+15.04.20150126.orig/src/dnd.h +++ notify-osd-0.9.35+15.04.20150126/src/dnd.h @@ -39,7 +39,7 @@ dnd_is_xscreensaver_active (void); gboolean -dnd_is_screensaver_inhibited (void); +dnd_is_idle_inhibited (void); gboolean dnd_is_screensaver_active (void); only in patch2: unchanged: --- notify-osd-0.9.35+15.04.20150126.orig/tests/test-dnd.c +++ notify-osd-0.9.35+15.04.20150126/tests/test-dnd.c @@ -41,10 +41,10 @@ void test_dnd_screensaver (gpointer fixture, gconstpointer user_data) { - gboolean test = dnd_is_screensaver_inhibited(); + gboolean test = dnd_is_idle_inhibited(); if (test) - g_debug ("screensaver is inhibited"); + g_debug ("idleness is inhibited"); test = dnd_is_screensaver_active();