- char *application;
- char *reason;
- guint32 cookie;
-
- application = g_strdup ("Evince");
- reason = g_strdup (_("Running in presentation mode"));
-
- res = dbus_g_proxy_call (scr->priv->gs_proxy,
- "Inhibit",
- &error,
- G_TYPE_STRING, application,
- G_TYPE_STRING, reason,
- G_TYPE_INVALID,
- G_TYPE_UINT, &cookie,
- G_TYPE_INVALID);
-
- if (res) {
+ value = g_dbus_connection_invoke_method_sync (scr->priv->connection,
+ GS_SERVICE,
+ GS_PATH,
+ GS_INTERFACE,
+ "Inhibit",
+ g_variant_new ("(ss)",
+ "Evince",
+ _("Running in presentation mode")),
+ G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START,
+ -1,
+ NULL,
+ &error);
+ if (error && g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
+ /* try the old API */
+ g_clear_error (&error);
+ value = g_dbus_connection_invoke_method_sync (scr->priv->connection,
+ GS_SERVICE,
+ GS_PATH,
+ GS_INTERFACE,
+ "InhibitActivation",
+ g_variant_new ("(s)",
+ _("Running in presentation mode")),
+ G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START,
+ -1,
+ NULL,
+ &error);
+ }
+ if (value != NULL) {