<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk" version="4.0" />
  <requires lib="libadwaita" version="1.0" />

  <object class="GSettings" id="settings">
    <property name="schema-id">org.gnome.Papers</property>
  </object>

  <object class="GSettings" id="default_settings">
    <property name="schema-id">org.gnome.Papers.Default</property>
  </object>

  <template class="PpsWindow" parent="AdwApplicationWindow">
    <property name="default-width">600</property>
    <property name="default-height">600</property>
    <property name="width-request">360</property>
    <property name="height-request">360</property>

    <property name="content">
      <object class="AdwToastOverlay" id="toast_overlay">
        <property name="child">
          <object class="AdwViewStack" id="stack">
            <property name="hhomogeneous">False</property>
            <property name="vhomogeneous">False</property>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">start</property>
                <property name="child">
                  <object class="AdwToolbarView">
                    <child type="top">
                      <object class="AdwHeaderBar">
                        <child type="end">
                          <object class="GtkMenuButton">
                            <property name="icon-name">open-menu-symbolic</property>
                            <property name="tooltip-text" translatable="yes">Main Menu</property>
                            <property name="menu-model">app_menu</property>
                            <property name="primary">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                    <property name="content">
                      <object class="AdwStatusPage">
                        <property name="icon-name">x-office-document-symbolic</property>
                        <property name="title" translatable="yes">Open a Document</property>
                        <property name="description" translatable="yes">Drag and drop documents here</property>
                        <property name="child">
                          <object class="GtkButton" id="open_button">
                            <property name="halign">center</property>
                            <property name="action-name">win.open</property>
                            <property name="label" translatable="yes">_Open…</property>
                            <property name="use-underline">True</property>
                            <property name="tooltip-text" translatable="yes">Open a Document</property>
                            <style>
                              <class name="suggested-action" />
                              <class name="pill" />
                            </style>
                          </object>
                        </property>
                      </object>
                    </property>
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">error</property>
                <property name="child">
                  <object class="AdwToolbarView">
                    <child type="top">
                      <object class="AdwHeaderBar" />
                    </child>
                    <property name="content">
                      <object class="AdwStatusPage" id="error_page">
                        <property name="icon-name">dialog-error-symbolic</property>
                        <property name="title" translatable="yes">Unable to Open Document</property>
                        <property name="child">
                          <object class="GtkButton">
                            <property name="halign">center</property>
                            <property name="action-name">win.open</property>
                            <property name="label" translatable="yes">_Open Other File…</property>
                            <property name="use-underline">True</property>
                            <style>
                              <class name="suggested-action" />
                              <class name="pill" />
                            </style>
                          </object>
                        </property>
                      </object>
                    </property>
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">password</property>
                <property name="child">
                  <object class="PpsPasswordView" id="password_view">
                    <signal name="unlock" handler="password_view_unlock" swapped="yes" />
                    <signal name="cancelled" handler="password_view_cancelled" swapped="yes" />
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">loader</property>
                <property name="child">
                  <object class="PpsLoaderView" id="loader_view">
                    <signal name="cancel" handler="loader_view_cancelled" swapped="yes" />
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">document</property>
                <property name="child">
                  <object class="PpsDocumentView" id="document_view">
                  </object>
                </property>
              </object>
            </child>
            <child>
              <object class="AdwViewStackPage">
                <property name="name">presentation</property>
                <property name="child">
                  <object class="PpsViewPresentation" id="presentation">
                    <signal name="finished" handler="presentation_finished" swapped="yes" />
                    <signal name="external-link" handler="external_link_clicked" swapped="yes" />
                    <child>
                      <object class="GtkShortcutController">
                        <child>
                          <object class='GtkShortcut'>
                            <property name='trigger'>Escape</property>
                            <property name='action'>action(win.escape)</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </property>
              </object>
            </child>
          </object>
        </property>
      </object>
    </property>
    <child>
      <object class="GtkDropTarget">
        <property name="formats">GdkFileList</property>
        <property name="actions">copy</property>
        <signal name="drop" handler="drag_data_received" swapped="yes" />
      </object>
    </child>
  </template>

  <object class="AdwAlertDialog" id="error_alert">
    <responses>
      <response id="close" translatable="yes">_Close</response>
    </responses>
  </object>

  <menu id="app_menu">
    <section>
      <item>
        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
        <attribute name="action">win.show-help-overlay</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_Help</attribute>
        <attribute name="action">app.help</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_About Papers</attribute>
        <attribute name="action">app.about</attribute>
      </item>
    </section>
  </menu>

</interface>
