window: Disable more actions if error is shown
Many operations don't make sense while an image is loading or can't be shown like zoom or print. In these cases the actions should now be disabled. Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/440>
This commit is contained in:
parent
ff869412c3
commit
f75e64f73b
3 changed files with 83 additions and 71 deletions
|
|
@ -148,17 +148,7 @@ mod imp {
|
|||
move || obj.target_page_reached()
|
||||
));
|
||||
|
||||
let signal_group = glib::SignalGroup::new::<LpImage>();
|
||||
obj.connect_notify_local(
|
||||
Some("current-page"),
|
||||
clone!(
|
||||
#[weak]
|
||||
signal_group,
|
||||
move |obj, _| {
|
||||
signal_group.set_target(obj.current_image().as_ref());
|
||||
}
|
||||
),
|
||||
);
|
||||
let signal_group = obj.current_image_signals();
|
||||
|
||||
let view = &*obj;
|
||||
signal_group.connect_closure(
|
||||
|
|
@ -185,8 +175,6 @@ mod imp {
|
|||
),
|
||||
);
|
||||
|
||||
self.current_image_signals.set(signal_group).unwrap();
|
||||
|
||||
self.drag_source.set_exclusive(true);
|
||||
|
||||
self.drag_source.connect_prepare(glib::clone!(
|
||||
|
|
@ -488,8 +476,8 @@ impl LpImageView {
|
|||
}
|
||||
}
|
||||
|
||||
self.notify("is-previous-available");
|
||||
self.notify("is-next-available");
|
||||
self.notify_is_previous_available();
|
||||
self.notify_is_next_available();
|
||||
}
|
||||
|
||||
fn scroll_sliding_view(&self, file: &gio::File, animated: bool) {
|
||||
|
|
@ -619,10 +607,17 @@ impl LpImageView {
|
|||
}
|
||||
|
||||
pub fn current_image_signals(&self) -> &glib::SignalGroup {
|
||||
self.imp()
|
||||
.current_image_signals
|
||||
.get()
|
||||
.expect("Signal group should be set up during construction")
|
||||
self.imp().current_image_signals.get_or_init(move || {
|
||||
let signal_group = glib::SignalGroup::new::<LpImage>();
|
||||
self.connect_current_page_notify(clone!(
|
||||
#[weak]
|
||||
signal_group,
|
||||
move |obj| {
|
||||
signal_group.set_target(obj.current_image().as_ref());
|
||||
}
|
||||
));
|
||||
signal_group
|
||||
})
|
||||
}
|
||||
|
||||
pub fn current_uri(&self) -> Option<glib::GString> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue