gboolean dnd_is_screensaver_active () { GError *error = NULL; gboolean active = FALSE;; if (! get_screensaver_proxy ()) return FALSE; dbus_g_proxy_call_with_timeout ( gscrsvr, "GetActive", 2000, &error, G_TYPE_INVALID, G_TYPE_BOOLEAN, &active, G_TYPE_INVALID); if (error) { g_warning ("dnd_is_screensaver_active(): Got error \"%s\"\n", error->message); g_error_free (error); error = NULL; } if (active) g_debug ("Gnome screensaver is active"); return active; }
static void break_window_lock_cb (GtkWidget *window, DrWright *dr) { GDBusProxy *proxy; proxy = get_screensaver_proxy (dr); if (proxy == NULL) return; /* ungrab the keyboard so the screensaver can start */ gdk_keyboard_ungrab (GDK_CURRENT_TIME); g_dbus_proxy_call (proxy, "Lock", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) screensaver_locked_cb, dr); }
gboolean drwright_can_lock_screen (DrWright *dr) { return get_screensaver_proxy (dr) != NULL; }