<?xml version="1.0"?>
<!--
 Copyright (C) 2016 Red Hat, Inc.

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library. If not, see <http://www.gnu.org/licenses/>.

 Author: Matthias Clasen <mclasen@redhat.com>
-->

<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
  <!--
      org.freedesktop.impl.portal.Inhibit:
      @short_description: Inhibit portal backend interface

      The inhibit portal lets sandboxed applications inhibit the user
      session from ending, suspending, idling or getting switched away.
  -->
  <interface name="org.freedesktop.impl.portal.Inhibit">
    <!--
        Inhibit:
        @handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
        @app_id: Application id
        @window: Identifier for the window
        @flags: Flags identifying what is inhibited
        @options: Vardict with optional further information

        Inhibits session status changes. As a side-effect of this call,
        a #org.freedesktop.impl.portal.Request object is exported on the
        object path @handle. To end the inhibition, call
        org.freedesktop.impl.portal.Request.Close() on that object.

        The flags determine what changes are inhibited:
        <simplelist>
          <member>1: Logout</member>
          <member>2: User Switch</member>
          <member>4: Suspend</member>
          <member>8: Idle</member>
        </simplelist>

        Supported keys in the @options vardict include:
        <variablelist>
          <varlistentry>
            <term>reason s</term>
            <listitem><para>User-visible reason for the inhibition.</para></listitem>
          </varlistentry>
        </variablelist>
    -->
    <method name="Inhibit">
      <arg type="o" name="handle" direction="in"/>
      <arg type="s" name="app_id" direction="in"/>
      <arg type="s" name="window" direction="in"/>
      <arg type="u" name="flags" direction="in"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/>
      <arg type="a{sv}" name="options" direction="in"/>
    </method>

    <!--
        CreateMonitor:
        @handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
        @session_handle: Object path for the created #org.freedesktop.impl.portal.Session object
        @app_id: App id of the application
        @window: the parent window
        @response: the result of the operation (0 == success)

        Creates a monitoring session. While this session is
        active, the caller will receive StateChanged signals
        with updates on the session state.
    -->
    <method name="CreateMonitor">
      <arg type="o" name="handle" direction="in"/>
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="s" name="app_id" direction="in"/>
      <arg type="s" name="window" direction="in"/>
      <arg type="u" name="response" direction="out"/>
    </method>

    <!--
        StateChanged:
        @session_handle: Object path for the #org.freedesktop.portal.Session object
        @state: Vardict with information about the session state

        The StateChanged signal is sent to active monitoring sessions when
        the session state changes.

        When the session state changes to 'Query End', clients with active monitoring
        sessions are expected to respond by calling
        org.freedesktop.impl.portal.Inhibit.QueryEndResponse() within a second
        of receiving the StateChanged signal.

        The following information may get returned in the @state vardict:
        <variablelist>
           <varlistentry>
            <term>screensaver-active b</term>
            <listitem><para>
              Whether the screensaver is active.
            </para></listitem>
          </varlistentry>
           <varlistentry>
            <term>session-state u</term>
            <listitem><para>
              The state of the session.
            </para>
            <simplelist>
              <member>1: Running</member>
              <member>2: Query End</member>
              <member>3: Ending</member>
            </simplelist>
            </listitem>
          </varlistentry>
        </variablelist>
    -->
    <signal name="StateChanged">
      <arg type="o" name="session_handle" direction="out"/>
      <arg type="a{sv}" name="state" direction="out"/>
    </signal>

    <!--
      QueryEndResponse:
      @session_handle: Object path for the #org.freedesktop.impl.portal.Session object

      Acknowledges that the caller received the #org.freedesktop.impl.portal.Inhibit::StateChanged
      signal. This method should be called within one second or receiving a StateChanged
      signal with the 'Query End' state.
    -->
    <method name="QueryEndResponse">
      <arg type="o" name="session_handle" direction="in"/>
    </method>

  </interface>
</node>
