Loupe/data/gtk/window.ui
Christopher Davis ba4661031f Implement Properties
Implement a properties sidebar. In order to prevent
the UI from freezing, we use futures to load and cancel
loading file information. We also make use of
`gdk_pixbuf` and `svg_metadata` in order to get the file's
metadata before the file fully loads, meaning there's
little to no delay between changing files and seeing
the metadata for large images.

The properties widget uses expressions and
properties to avoid glue code for setting each label,
allowing us to have a clean separation between UI
and data.
2022-08-02 19:31:44 -04:00

152 lines
6.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="LpWindow" parent="AdwApplicationWindow">
<property name="default-width">600</property>
<property name="default-height">498</property>
<property name="width-request">360</property>
<property name="title" translatable="yes">Image Viewer</property>
<binding name="title">
<closure type="gchararray" function="window_title">
<lookup type="LpImageView" name="active-file">image_view</lookup>
</closure>
</binding>
<property name="content">
<object class="AdwFlap" id="flap">
<property name="orientation">vertical</property>
<property name="fold-policy">never</property>
<property name="swipe-to-open">False</property>
<property name="swipe-to-close">False</property>
<property name="locked">true</property>
<property name="modal">false</property>
<binding name="fold-policy">
<closure type="AdwFlapFoldPolicy" function="fold_policy">
<lookup name="fullscreened">LpWindow</lookup>
<lookup type="AdwFlap" name="reveal-flap">properties_flap</lookup>
</closure>
</binding>
<property name="flap">
<object class="GtkHeaderBar" id="headerbar">
<property name="show_title_buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
<child type="start">
<object class="GtkButton">
<property name="icon-name">edit-copy-symbolic</property>
<property name="action-name">win.copy</property>
<property name="tooltip-text">Copy to Clipboard</property>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">primary_menu</property>
<property name="tooltip-text" translatable="yes">Primary Menu</property>
</object>
</child>
<child type="end">
<object class="GtkToggleButton" id="properties_button">
<property name="icon-name">help-about-symbolic</property>
</object>
</child>
</object>
</property>
<property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<property name="child">
<object class="AdwFlap" id="properties_flap">
<property name="flap-position">end</property>
<property name="fold-policy">never</property>
<property name="locked">True</property>
<property name="reveal-flap" bind-source="properties_button" bind-property="active" bind-flags="bidirectional|sync-create"/>
<property name="content">
<object class="GtkStack" id="stack">
<property name="visible-child">status_page</property>
<property name="vexpand">True</property>
<child>
<object class="AdwStatusPage" id="status_page">
<property name="title" translatable="yes">Image Viewer</property>
<property name="description" translatable="yes">Click "Open File…" or drag an image here.</property>
<child>
<object class="GtkButton">
<property name="halign">center</property>
<property name="label" translatable="yes">Open File…</property>
<property name="action-name">win.open</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="LpImageView" id="image_view"/>
</child>
<child>
<object class="GtkDropTarget" id="drop_target">
<property name="actions">copy</property>
</object>
</child>
</object>
</property>
<property name="separator">
<object class="GtkSeparator"/>
</property>
<property name="flap">
<object class="LpPropertiesView" id="properties_view">
<property name="file" bind-source="image_view" bind-property="active-file" bind-flags="sync-create"/>
</object>
</property>
</object>
</property>
</object>
</property>
<style>
<class name="fullscreen-widget"/>
</style>
</object>
</property>
</template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new-window</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Open With…</attribute>
<attribute name="action">win.open-with</attribute>
</item>
<!--<item>
<attribute name="label" translatable="yes">_Display On…</attribute>
<attribute name="action">win.display-on</attribute>
</item>-->
<item>
<attribute name="label" translatable="yes">_Print…</attribute>
<attribute name="action">win.print</attribute>
</item>
<!--<item>
<attribute name="label" translatable="yes">_Rotate</attribute>
<attribute name="action">win.rotate-image</attribute>
</item>-->
<item>
<attribute name="label" translatable="yes">_Set as Wallpaper</attribute>
<attribute name="action">win.set-wallpaper</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</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 Image Viewer</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
</interface>