Release v0.2.10
This commit is contained in:
parent
ae1f0c7c4a
commit
f7c67c1a79
9 changed files with 87 additions and 15 deletions
|
|
@ -223,6 +223,11 @@ pub struct ViewModeControl {
|
|||
pub change: Rc<dyn Fn(u32)>,
|
||||
}
|
||||
|
||||
pub struct TwoPageDirectionControl {
|
||||
pub selected: u32,
|
||||
pub change: Rc<dyn Fn(u32) -> bool>,
|
||||
}
|
||||
|
||||
pub struct FileViewerControls {
|
||||
pub sibling_navigator: Option<SiblingNavigator>,
|
||||
pub favorite_control: FavoriteControl,
|
||||
|
|
@ -230,6 +235,7 @@ pub struct FileViewerControls {
|
|||
pub file_drop_control: FileDropControl,
|
||||
pub reuse_window: Option<gtk::ApplicationWindow>,
|
||||
pub view_mode_control: Option<ViewModeControl>,
|
||||
pub two_page_direction_control: Option<TwoPageDirectionControl>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
@ -274,7 +280,10 @@ impl ViewerWindow {
|
|||
file_drop_control,
|
||||
reuse_window,
|
||||
view_mode_control: _,
|
||||
two_page_direction_control,
|
||||
} = controls;
|
||||
let direction_control = two_page_direction_control
|
||||
.expect("archive viewer requires a two-page direction control");
|
||||
let title = source.display_name.clone();
|
||||
let file_list_query = reuse_window
|
||||
.as_ref()
|
||||
|
|
@ -326,7 +335,8 @@ impl ViewerWindow {
|
|||
let page_label = gtk::Label::new(Some("- / -"));
|
||||
page_label.set_hexpand(true);
|
||||
let direction_dropdown = gtk::DropDown::from_strings(&["좌→우", "우→좌"]);
|
||||
direction_dropdown.set_selected(1);
|
||||
let direction_selected = direction_control.selected.min(1);
|
||||
direction_dropdown.set_selected(direction_selected);
|
||||
let mode_dropdown = gtk::DropDown::from_strings(&[
|
||||
"100%",
|
||||
"폭 맞춤",
|
||||
|
|
@ -451,6 +461,8 @@ impl ViewerWindow {
|
|||
download_button,
|
||||
file_download: download_control.download,
|
||||
view_mode_change: view_mode_control.change,
|
||||
direction_change: direction_control.change,
|
||||
direction_selected: Cell::new(direction_selected),
|
||||
seek_hide_timer: RefCell::new(None),
|
||||
seek_interacting: Cell::new(false),
|
||||
last_pointer_position: Cell::new(None),
|
||||
|
|
@ -620,6 +632,8 @@ struct ViewerController {
|
|||
download_button: gtk::Button,
|
||||
file_download: Rc<dyn Fn(gtk::Window, gtk::Label)>,
|
||||
view_mode_change: Rc<dyn Fn(u32)>,
|
||||
direction_change: Rc<dyn Fn(u32) -> bool>,
|
||||
direction_selected: Cell<u32>,
|
||||
seek_hide_timer: RefCell<Option<glib::SourceId>>,
|
||||
seek_interacting: Cell<bool>,
|
||||
last_pointer_position: Cell<Option<(f64, f64)>>,
|
||||
|
|
@ -677,11 +691,18 @@ impl ViewerController {
|
|||
}
|
||||
});
|
||||
let controller = Rc::downgrade(self);
|
||||
self.direction_dropdown.connect_selected_notify(move |_| {
|
||||
if let Some(controller) = controller.upgrade() {
|
||||
controller.render();
|
||||
}
|
||||
});
|
||||
self.direction_dropdown
|
||||
.connect_selected_notify(move |dropdown| {
|
||||
if let Some(controller) = controller.upgrade() {
|
||||
let selected = dropdown.selected().min(1);
|
||||
if (controller.direction_change)(selected) {
|
||||
controller.direction_selected.set(selected);
|
||||
controller.render();
|
||||
} else {
|
||||
dropdown.set_selected(controller.direction_selected.get());
|
||||
}
|
||||
}
|
||||
});
|
||||
let controller = Rc::downgrade(self);
|
||||
self.favorite_button.connect_clicked(move |_| {
|
||||
if let Some(controller) = controller.upgrade() {
|
||||
|
|
@ -2184,6 +2205,7 @@ impl MediaViewerWindow {
|
|||
file_drop_control,
|
||||
reuse_window,
|
||||
view_mode_control,
|
||||
two_page_direction_control: _,
|
||||
} = controls;
|
||||
let title = source.display_name.clone();
|
||||
let file_list_query = reuse_window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue