window: Add reload button and F5 shortcut
Reloading makes sense for out of memory situations or filesystems that don't support inotify.
This commit is contained in:
parent
c3547f82fc
commit
053aa5da7e
6 changed files with 56 additions and 7 deletions
|
|
@ -56,13 +56,19 @@
|
|||
</property>
|
||||
<child type="bottom">
|
||||
<object class="GtkButton" id="report">
|
||||
<property name="label" translatable="yes">Report Issue…</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-bottom">24</property>
|
||||
<style>
|
||||
<class name="suggested-action" />
|
||||
<class name="pill" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="AdwButtonContent">
|
||||
<property name="icon-name">external-link-symbolic</property>
|
||||
<property name="label" translatable="yes">Report _Issue</property>
|
||||
<property name="use-underline">true</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -290,6 +290,15 @@ impl LpImage {
|
|||
self.imp().file.replace(Some(file.clone()));
|
||||
}
|
||||
|
||||
pub async fn reload(&self) {
|
||||
dbg!("reloadking");
|
||||
if let Some(file) = self.file() {
|
||||
self.load(&file).await;
|
||||
} else {
|
||||
log::error!("Trying to reload image without file");
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn load(&self, file: &gio::File) {
|
||||
let imp = self.imp();
|
||||
log::debug!("Loading file {}", file.uri());
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<property name="hexpand">true</property>
|
||||
<property name="vexpand">true</property>
|
||||
<child>
|
||||
<object class="AdwSpinner" id="spinner"/>
|
||||
<object class="AdwSpinner" id="spinner" />
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
@ -56,12 +56,30 @@
|
|||
<property name="icon-name">image-missing-symbolic</property>
|
||||
<property name="title" translatable="yes">Could not Load Image</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="error_more_info">
|
||||
<property name="label" translatable="true">More Information…</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="pill" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="error_more_info">
|
||||
<property name="label" translatable="true">More _Information</property>
|
||||
<property name="use-underline">true</property>
|
||||
<style>
|
||||
<class name="suggested-action" />
|
||||
<class name="pill" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="true">_Reload</property>
|
||||
<property name="use-underline">true</property>
|
||||
<property name="action-name">win.reload</property>
|
||||
<style>
|
||||
<class name="pill" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue