<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <menu id="menu">
    <section>
      <item>
        <attribute name="label" translatable="yes">_Preferences</attribute>
        <attribute name="action">app.show-preferences</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
        <attribute name="action">win.show-help-overlay</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_About Mousai</attribute>
        <attribute name="action">app.show-about</attribute>
      </item>
    </section>
  </menu>
  <menu id="selection_menu">
    <section>
      <item>
        <attribute name="label" translatable="yes">Select _All</attribute>
        <attribute name="action">history-view.select-all</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_Unselect All</attribute>
        <attribute name="action">history-view.select-none</attribute>
      </item>
    </section>
  </menu>
  <template class="MousaiHistoryView">
    <property name="layout-manager">
      <object class="GtkBinLayout"/>
    </property>
    <style>
      <class name="view"/>
    </style>
    <child>
      <object class="AdwNavigationView" id="navigation_view">
        <child>
          <object class="AdwNavigationPage" id="navigation_main_page">
            <property name="title" translatable="yes">Home</property>
            <property name="child">
              <object class="AdwToolbarView">
                <child type="top">
                  <object class="GtkStack" id="header_bar_stack">
                    <property name="transition-type">crossfade</property>
                    <child>
                      <object class="AdwHeaderBar" id="main_header_bar">
                        <child>
                          <object class="GtkButton">
                            <property name="tooltip-text" translatable="yes">Recognize Song</property>
                            <property name="label" translatable="yes">Listen</property>
                            <property name="action-name">win.toggle-recognize</property>
                            <style>
                              <class name="suggested-action"/>
                            </style>
                          </object>
                        </child>
                        <child>
                          <object class="MousaiRecognizerStatus" id="recognizer_status"/>
                        </child>
                        <child type="end">
                          <object class="GtkMenuButton">
                            <property name="tooltip-text" translatable="yes">Main Menu</property>
                            <property name="icon-name">open-menu-symbolic</property>
                            <property name="menu-model">menu</property>
                            <property name="primary">True</property>
                          </object>
                        </child>
                        <child type="end">
                          <object class="GtkButton">
                            <property name="tooltip-text" translatable="yes">Select</property>
                            <property name="icon-name">selection-mode-symbolic</property>
                            <property name="action-name">history-view.toggle-selection-mode</property>
                          </object>
                        </child>
                        <child type="end">
                          <object class="GtkToggleButton">
                            <property name="tooltip-text" translatable="yes">Search Songs</property>
                            <property name="icon-name">system-search-symbolic</property>
                            <property name="active" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="sync-create | bidirectional"/>
                          </object>
                        </child>
                      </object>
                    </child>
                    <child>
                      <object class="AdwHeaderBar" id="selection_mode_header_bar">
                        <property name="title-widget">
                          <object class="GtkMenuButton" id="selection_mode_menu_button">
                            <property name="menu-model">selection_menu</property>
                          </object>
                        </property>
                        <child type="end">
                          <object class="GtkButton">
                            <property name="tooltip-text" translatable="yes">Cancel Selection</property>
                            <property name="label" translatable="yes">Cancel</property>
                            <property name="action-name">history-view.toggle-selection-mode</property>
                          </object>
                        </child>
                        <child type="end">
                          <object class="GtkToggleButton">
                            <property name="tooltip-text" translatable="yes">Search Songs</property>
                            <property name="icon-name">system-search-symbolic</property>
                            <property name="active" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="sync-create | bidirectional"/>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child type="top">
                  <!-- TODO Maybe inline this in the headerbar -->
                  <object class="GtkSearchBar" id="search_bar">
                    <property name="child">
                      <object class="GtkSearchEntry" id="search_entry">
                        <property name="placeholder-text" translatable="yes">Search songs</property>
                      </object>
                    </property>
                  </object>
                </child>
                <property name="content">
                  <object class="GtkStack" id="content_stack">
                    <property name="transition-type">crossfade</property>
                    <child>
                      <object class="GtkScrolledWindow" id="content_main_page">
                        <property name="hscrollbar-policy">never</property>
                        <property name="child">
                          <object class="GtkGridView" id="grid">
                            <property name="min-columns">2</property>
                            <style>
                              <class name="history-view"/>
                            </style>
                          </object>
                        </property>
                      </object>
                    </child>
                    <child>
                      <object class="AdwStatusPage" id="content_empty_page">
                        <property name="title" translatable="yes">Start Recognizing Songs!</property>
                        <property name="description" translatable="yes">Click the listen button to start</property>
                        <style>
                          <class name="icon-dropshadow"/>
                        </style>
                      </object>
                    </child>
                    <child>
                      <object class="AdwStatusPage" id="content_empty_search_result_page">
                        <property name="icon-name">system-search-symbolic</property>
                        <property name="title" translatable="yes">No Results</property>
                      </object>
                    </child>
                  </object>
                </property>
                <child type="bottom">
                  <object class="GtkActionBar" id="selection_mode_bar">
                    <child>
                      <object class="GtkButton" id="copy_selected_songs_button">
                        <property name="icon-name">edit-copy-symbolic</property>
                        <property name="action-name">history-view.copy-selected-song</property>
                      </object>
                    </child>
                    <child>
                      <object class="GtkButton" id="remove_selected_songs_button">
                        <property name="icon-name">user-trash-symbolic</property>
                        <property name="action-name">history-view.remove-selected-songs</property>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </property>
          </object>
        </child>
      </object>
    </child>
  </template>
</interface>
