cargo: Update dependencies
This commit is contained in:
parent
8a46ef32c6
commit
004ebd5615
14 changed files with 521 additions and 366 deletions
|
|
@ -172,7 +172,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
match pspec.name() {
|
||||
"file" => obj.file().to_value(),
|
||||
"path" => obj.path().to_variant().to_value(),
|
||||
|
|
@ -194,7 +194,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
match pspec.name() {
|
||||
"rotation" => obj.set_rotation(value.get().unwrap()),
|
||||
"mirrored" => obj.set_mirrored(value.get().unwrap()),
|
||||
|
|
@ -210,7 +210,7 @@ mod imp {
|
|||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
obj.set_hexpand(true);
|
||||
obj.set_vexpand(true);
|
||||
obj.set_overflow(gtk::Overflow::Hidden);
|
||||
|
|
@ -224,7 +224,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn dispose(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
// remove target fron zoom animation because it's property of this object
|
||||
obj.rotation_animation()
|
||||
|
|
@ -240,7 +240,7 @@ mod imp {
|
|||
|
||||
impl LpImage {
|
||||
fn connect_controllers(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
// Needed vor having the current cursor position available
|
||||
let motion_controller = gtk::EventControllerMotion::new();
|
||||
|
|
@ -253,7 +253,7 @@ mod imp {
|
|||
motion_controller.connect_leave(glib::clone!(@weak obj => move |_| {
|
||||
obj.imp().pointer_position.set(None);
|
||||
}));
|
||||
obj.add_controller(&motion_controller);
|
||||
obj.add_controller(motion_controller);
|
||||
|
||||
// Zoom via scroll wheels etc
|
||||
let scroll_controller =
|
||||
|
|
@ -312,15 +312,15 @@ mod imp {
|
|||
gtk::Inhibit(true)
|
||||
}));
|
||||
|
||||
obj.add_controller(&scroll_controller);
|
||||
obj.add_controller(scroll_controller);
|
||||
}
|
||||
|
||||
fn connect_gestures(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
// Double click for fullscreen (mouse/touchpad) or zoom (touch screen)
|
||||
let left_click_gesture = gtk::GestureClick::builder().button(1).build();
|
||||
obj.add_controller(&left_click_gesture);
|
||||
obj.add_controller(left_click_gesture.clone());
|
||||
left_click_gesture.connect_pressed(
|
||||
glib::clone!(@weak obj => move |gesture, n_press, x, y| {
|
||||
// only handle double clicks
|
||||
|
|
@ -347,7 +347,7 @@ mod imp {
|
|||
|
||||
// Drag for moving image around
|
||||
let drag_gesture = gtk::GestureDrag::new();
|
||||
obj.add_controller(&drag_gesture);
|
||||
obj.add_controller(drag_gesture.clone());
|
||||
|
||||
drag_gesture.connect_drag_begin(glib::clone!(@weak obj => move |gesture, _, _| {
|
||||
if obj.is_hscrollable() || obj.is_vscrollable() {
|
||||
|
|
@ -378,7 +378,7 @@ mod imp {
|
|||
|
||||
// Rotate
|
||||
let rotation_gesture = gtk::GestureRotate::new();
|
||||
obj.add_controller(&rotation_gesture);
|
||||
obj.add_controller(rotation_gesture.clone());
|
||||
|
||||
rotation_gesture.connect_angle_changed(
|
||||
glib::clone!(@weak obj => move |gesture, _, _| {
|
||||
|
|
@ -399,7 +399,7 @@ mod imp {
|
|||
|
||||
// Zoom
|
||||
let zoom_gesture = gtk::GestureZoom::new();
|
||||
obj.add_controller(&zoom_gesture);
|
||||
obj.add_controller(zoom_gesture.clone());
|
||||
|
||||
zoom_gesture.connect_begin(glib::clone!(@weak obj => move |gesture, _| {
|
||||
obj.imp()
|
||||
|
|
@ -448,7 +448,7 @@ mod imp {
|
|||
impl WidgetImpl for LpImage {
|
||||
// called when the widget size might have changed
|
||||
fn size_allocate(&self, width: i32, height: i32, _baseline: i32) {
|
||||
let widget = self.instance();
|
||||
let widget = self.obj();
|
||||
|
||||
// ensure there is an actual size change
|
||||
if self.widget_dimensions.get() != (width, height) {
|
||||
|
|
@ -458,7 +458,7 @@ mod imp {
|
|||
let best_fit_level = widget.zoom_level_best_fit();
|
||||
self.zoom.set(best_fit_level);
|
||||
self.zoom_target.set(best_fit_level);
|
||||
self.instance().zoom_animation().pause();
|
||||
self.obj().zoom_animation().pause();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ mod imp {
|
|||
// called when the widget content should be re-rendered
|
||||
fn snapshot(&self, snapshot: >k::Snapshot) {
|
||||
if let Some(texture) = self.texture.borrow().as_ref() {
|
||||
let widget = self.instance();
|
||||
let widget = self.obj();
|
||||
let widget_width = widget.width() as f64;
|
||||
let widget_height = widget.height() as f64;
|
||||
|
||||
|
|
@ -531,15 +531,16 @@ mod imp {
|
|||
}
|
||||
|
||||
fn measure(&self, orientation: gtk::Orientation, _for_size: i32) -> (i32, i32, i32, i32) {
|
||||
let (image_width, image_height) = self.instance().image_size();
|
||||
let (image_width, image_height) = self.obj().image_size();
|
||||
|
||||
if image_width > 0 && image_height > 0 {
|
||||
if let Some(display) = gdk::Display::default() {
|
||||
if let Some(native) = self.instance().native() {
|
||||
let hidpi_scale = self.instance().scale_factor() as f64;
|
||||
if let Some(native) = self.obj().native() {
|
||||
let hidpi_scale = self.obj().scale_factor() as f64;
|
||||
|
||||
// get monitor information
|
||||
let monitor = display.monitor_at_surface(&native.surface());
|
||||
// TODO: Get rid of unwrap
|
||||
let monitor = display.monitor_at_surface(&native.surface()).unwrap();
|
||||
let monitor_geometry = monitor.geometry();
|
||||
// TODO: Per documentation those dimensions should not be physical pixels.
|
||||
// But on Wayland they are physiscal pixels and on X11 not.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
match pspec.name() {
|
||||
"image" => obj.image().to_value(),
|
||||
"error" => obj.error().to_value(),
|
||||
|
|
@ -96,7 +96,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn constructed(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
self.parent_constructed();
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ glib::wrapper! {
|
|||
|
||||
impl LpImagePage {
|
||||
pub fn from_path(path: &Path) -> Self {
|
||||
let obj = glib::Object::new::<Self>(&[]);
|
||||
let obj = glib::Object::new::<Self>();
|
||||
let path = path.to_path_buf();
|
||||
let file = gio::File::for_path(&path);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn property(&self, _id: usize, psec: &glib::ParamSpec) -> glib::Value {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
match psec.name() {
|
||||
"current-page" => obj.current_page().to_value(),
|
||||
"is-previous-available" => obj.is_previous_available().to_value(),
|
||||
|
|
@ -111,12 +111,12 @@ mod imp {
|
|||
}
|
||||
|
||||
fn constructed(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
self.parent_constructed();
|
||||
|
||||
// Manually mange widget layout, see `WidgetImpl` for details
|
||||
obj.set_layout_manager(gtk::LayoutManager::NONE);
|
||||
obj.set_layout_manager(None::<gtk::LayoutManager>);
|
||||
|
||||
obj.property_expression("current-page")
|
||||
.chain_property::<LpImagePage>("image")
|
||||
|
|
@ -164,7 +164,7 @@ mod imp {
|
|||
};
|
||||
}));
|
||||
|
||||
obj.add_controller(&source);
|
||||
obj.add_controller(source);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ mod imp {
|
|||
// take as minimum whatever is larger
|
||||
let min = i32::max(child_min, overlay1_min + overlay2_min);
|
||||
|
||||
if let Some(page) = self.instance().current_page() {
|
||||
if let Some(page) = self.obj().current_page() {
|
||||
// measure `LpImage`
|
||||
let (_, image_natural, _, _) = page.image().measure(orientation, for_size);
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ impl LpImageView {
|
|||
let pb = gdk_pixbuf::Pixbuf::from_file(path)?;
|
||||
|
||||
let setup = gtk::PageSetup::default();
|
||||
let page_size = gtk::PaperSize::new(Some(>k::PAPER_NAME_A4));
|
||||
let page_size = gtk::PaperSize::new(Some(gtk::PAPER_NAME_A4));
|
||||
setup.set_paper_size(&page_size);
|
||||
operation.set_default_page_setup(Some(&setup));
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
let prop_name = pspec.name();
|
||||
|
||||
match prop_name {
|
||||
|
|
@ -126,7 +126,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
let prop_name = pspec.name();
|
||||
|
||||
match prop_name {
|
||||
|
|
@ -136,7 +136,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn constructed(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
self.parent_constructed();
|
||||
obj.action_set_enabled("properties.open-folder", false);
|
||||
|
|
@ -254,10 +254,10 @@ impl LpPropertiesView {
|
|||
if let Ok(info) = util::query_attributes_future(
|
||||
&file,
|
||||
vec![
|
||||
&gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
|
||||
&gio::FILE_ATTRIBUTE_STANDARD_SIZE,
|
||||
&gio::FILE_ATTRIBUTE_TIME_CREATED,
|
||||
&gio::FILE_ATTRIBUTE_TIME_MODIFIED,
|
||||
gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
|
||||
gio::FILE_ATTRIBUTE_STANDARD_SIZE,
|
||||
gio::FILE_ATTRIBUTE_TIME_CREATED,
|
||||
gio::FILE_ATTRIBUTE_TIME_MODIFIED,
|
||||
],
|
||||
)
|
||||
.await {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
match pspec.name() {
|
||||
"current-page" => obj.current_page().to_value(),
|
||||
name => unimplemented!("property {name}"),
|
||||
|
|
@ -83,13 +83,13 @@ mod imp {
|
|||
}
|
||||
|
||||
fn constructed(&self) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
self.parent_constructed();
|
||||
|
||||
self.instance().set_overflow(gtk::Overflow::Hidden);
|
||||
self.obj().set_overflow(gtk::Overflow::Hidden);
|
||||
|
||||
let swipe_tracker = adw::SwipeTracker::builder()
|
||||
.swipeable(&*self.instance())
|
||||
.swipeable(&*self.obj())
|
||||
.reversed(self.is_rtl())
|
||||
.build();
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ mod imp {
|
|||
}),
|
||||
);
|
||||
|
||||
obj.add_controller(&scroll_controller);
|
||||
obj.add_controller(scroll_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,12 +155,12 @@ mod imp {
|
|||
* (width as f32 + self.page_spacing(width));
|
||||
|
||||
let transform = gsk::Transform::new().translate(&graphene::Point::new(x, 0.));
|
||||
page.allocate(width, height, 0, Some(&transform));
|
||||
page.allocate(width, height, 0, Some(transform));
|
||||
}
|
||||
}
|
||||
|
||||
fn measure(&self, orientation: gtk::Orientation, for_size: i32) -> (i32, i32, i32, i32) {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
for page in self.pages.borrow().iter() {
|
||||
if Some(page) != obj.current_page().as_ref() {
|
||||
|
|
@ -185,18 +185,18 @@ mod imp {
|
|||
|
||||
impl SwipeableImpl for LpSlidingView {
|
||||
fn progress(&self) -> f64 {
|
||||
self.instance().position()
|
||||
self.obj().position()
|
||||
}
|
||||
|
||||
fn distance(&self) -> f64 {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
let width = obj.allocation().width();
|
||||
|
||||
width as f64 + self.page_spacing(width) as f64
|
||||
}
|
||||
|
||||
fn snap_points(&self) -> Vec<f64> {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
|
||||
(0..obj.n_pages())
|
||||
.map(|i| i as f64 - obj.position_shift())
|
||||
|
|
@ -204,7 +204,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn cancel_progress(&self) -> f64 {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
let snap_points = self.snap_points();
|
||||
|
||||
if let (Some(min), Some(max)) = (snap_points.first(), snap_points.last()) {
|
||||
|
|
@ -221,7 +221,7 @@ mod imp {
|
|||
}
|
||||
|
||||
fn is_rtl(&self) -> bool {
|
||||
let obj = self.instance();
|
||||
let obj = self.obj();
|
||||
obj.direction() == gtk::TextDirection::Rtl
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue