From 30136f90503e3767ca948015a7a636d05552356e Mon Sep 17 00:00:00 2001 From: Lubosz Sarnecki Date: Mon, 20 Feb 2023 23:44:17 +0100 Subject: [PATCH] code: Fix some typos. Fix some typos, mainly in comments with the power of Builder's spell correction. --- src/image_metadata/gps.rs | 8 ++++---- src/widgets/image.rs | 30 +++++++++++++++--------------- src/widgets/image_page.rs | 2 +- src/widgets/image_view.rs | 4 ++-- src/widgets/properties_view.rs | 4 ++-- src/widgets/sliding_view.rs | 4 ++-- src/window.rs | 4 ++-- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/image_metadata/gps.rs b/src/image_metadata/gps.rs index 4757533..cee130d 100644 --- a/src/image_metadata/gps.rs +++ b/src/image_metadata/gps.rs @@ -132,10 +132,10 @@ impl GPSLocation { pub fn latitude_display(&self) -> String { let coord = self.latitude; let reference = if coord.sing { - // Translators: short for "north" in GPS coordiante + // Translators: short for "north" in GPS coordinate i18n("N") } else { - // Translators: short for "south" in GPS coordiante + // Translators: short for "south" in GPS coordinate i18n("S") }; @@ -145,10 +145,10 @@ impl GPSLocation { pub fn longitude_display(&self) -> String { let coord = self.longitude; let reference = if coord.sing { - // Translators: short for "east" in GPS coordiante + // Translators: short for "east" in GPS coordinate i18n("E") } else { - // Translators: short for "west" in GPS coordiante + // Translators: short for "west" in GPS coordinate i18n("W") }; diff --git a/src/widgets/image.rs b/src/widgets/image.rs index def7393..493928f 100644 --- a/src/widgets/image.rs +++ b/src/widgets/image.rs @@ -84,7 +84,7 @@ mod imp { /// Current animation is transitioning from having horizontal scrollbars /// to not having them or vice versa. pub zoom_hscrollbar_transition: Cell, - /// Same but vor vertical + /// Same but for vertical pub zoom_vscrollbar_transition: Cell, /// Always fit image into window, causes `zoom` to change automatically @@ -185,7 +185,7 @@ mod imp { "best-fit" => obj.is_best_fit().to_value(), "is-max-zoom" => obj.is_max_zoom().to_value(), "image-size" => obj.image_size().to_variant().to_value(), - // don't use getter functions here sicne they can return a fake adjustment + // don't use getter functions here since they can return a fake adjustment "hadjustment" => self.hadjustment.borrow().to_value(), "vadjustment" => self.vadjustment.borrow().to_value(), "hscroll-policy" | "vscroll-policy" => gtk::ScrollablePolicy::Minimum.to_value(), @@ -226,7 +226,7 @@ mod imp { fn dispose(&self) { let obj = self.obj(); - // remove target fron zoom animation because it's property of this object + // remove target from zoom animation because it's property of this object obj.rotation_animation() .set_target(&adw::CallbackAnimationTarget::new(|_| {})); obj.zoom_animation() @@ -242,7 +242,7 @@ mod imp { fn connect_controllers(&self) { let obj = self.obj(); - // Needed vor having the current cursor position available + // Needed for having the current cursor position available let motion_controller = gtk::EventControllerMotion::new(); motion_controller.connect_enter(glib::clone!(@weak obj => move |_, x, y| { obj.imp().pointer_position.set(Some((x, y))); @@ -499,7 +499,7 @@ mod imp { let x = f64::max((widget_width - widget.image_displayed_width()) / 2.0, 0.); let y = f64::max((widget_height - widget.image_displayed_height()) / 2.0, 0.); // round to pixel values to not have a half pixel offset to physical pixels - // the offset would leading to a blury output + // the offset would leading to a blurry output snapshot.translate(&graphene::Point::new( widget.round(x) as f32, widget.round(y) as f32, @@ -543,7 +543,7 @@ mod imp { 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. + // But on Wayland they are physical pixels and on X11 not. // Taking the version that works on Wayland for now. // let monitor_width = monitor_geometry.width() as f64 - 40.; @@ -553,7 +553,7 @@ mod imp { let monitor_area = monitor_width * monitor_height; let image_area = image_width as f64 * image_height as f64; - let ocuppy_area_factor = if monitor_area < 1024. * 768. { + let occupy_area_factor = if monitor_area < 1024. * 768. { // for small monitors occupy 80% of the area 0.8 } else { @@ -561,11 +561,11 @@ mod imp { 0.3 }; - // factor for width and height that will achive the desired area occupation + // factor for width and height that will achieve the desired area occupation // derived from: - // monitor_area * ocuppy_area_factor == + // monitor_area * occupy_area_factor == // (image_width * size_scale) * (image_height * size_scale) - let size_scale = f64::sqrt(monitor_area / image_area * ocuppy_area_factor); + let size_scale = f64::sqrt(monitor_area / image_area * occupy_area_factor); // ensure that we never increase image size let target_scale = f64::min(1.0, size_scale); let mut nat_width = image_width as f64 * target_scale; @@ -883,7 +883,7 @@ impl LpImage { /// Set zoom level aiming for given position or center if not available fn set_zoom_aiming(&self, mut zoom: f64, aiming: Option<(f64, f64)>) { - // allow some deviantion from max value for rubberbanding + // allow some deviation from max value for rubberbanding if zoom > MAX_ZOOM_LEVEL { let max_deviation = MAX_ZOOM_LEVEL * ZOOM_FACTOR_MAX_RUBBERBAND; let deviation = zoom / MAX_ZOOM_LEVEL; @@ -973,7 +973,7 @@ impl LpImage { /// /// When zooming by a ratio of `zoom_delta` and wanting to keep position `x` /// in the image at the same place in the widget, the returned value is - /// the correct value for hadjustment to achive that. + /// the correct value for hadjustment to achieve that. pub fn hadjustment_corrected_for_zoom(&self, zoom_delta: f64, x: f64) -> f64 { let adj = self.hadjustment(); // Width of bars to the left and right of the image @@ -1035,7 +1035,7 @@ impl LpImage { // If image is only 1/4 of a zoom step away from best-fit, also // activate best-fit. This avoids bugs with floating point precision - // and removes akward minimal zoom steps. + // and removes awkward minimal zoom steps. let extended_best_fit_threshold = self.zoom_level_best_fit() * (1. + (ZOOM_FACTOR_BUTTON - 1.) / 4.); @@ -1125,7 +1125,7 @@ impl LpImage { gtk::PanDirection::Left | gtk::PanDirection::Up => -1., gtk::PanDirection::Right | gtk::PanDirection::Down => 1., _ => { - log::error!("Unkown pan direction {direction:?}"); + log::error!("Unknown pan direction {direction:?}"); return; } }; @@ -1138,7 +1138,7 @@ impl LpImage { (self.vadjustment(), self.max_vadjustment_value()) } _ => { - log::error!("Unkown pan direction {direction:?}"); + log::error!("Unknown pan direction {direction:?}"); return; } }; diff --git a/src/widgets/image_page.rs b/src/widgets/image_page.rs index 822cf70..41a6428 100644 --- a/src/widgets/image_page.rs +++ b/src/widgets/image_page.rs @@ -53,7 +53,7 @@ mod imp { #[template_child] pub(super) press_gesture: TemplateChild, - /// set if an error has occured and is shown on error_page + /// set if an error has occurred and is shown on error_page pub(super) error: RefCell>, } diff --git a/src/widgets/image_view.rs b/src/widgets/image_view.rs index 8e1821c..2840160 100644 --- a/src/widgets/image_view.rs +++ b/src/widgets/image_view.rs @@ -169,7 +169,7 @@ mod imp { } impl WidgetImpl for LpImageView { - /// The main target of this manual implemtation is to provide a good + /// The main target of this manual implementation is to provide a good /// natural width that allows to have a neat size for newly opened `LpWindow`s. /// The actual calculation of the image natural width happens in /// the measure function of `LpImage`. @@ -365,7 +365,7 @@ impl LpImageView { fn scroll_sliding_view(&self, path: &Path) { let Some(current_page) = self.sliding_view().pages().remove(path) else { - log::error!("Current path not availabel in sliding_view for scrolling: {path:?}"); + log::error!("Current path not available in sliding_view for scrolling: {path:?}"); return; }; diff --git a/src/widgets/properties_view.rs b/src/widgets/properties_view.rs index 3255712..91eccef 100644 --- a/src/widgets/properties_view.rs +++ b/src/widgets/properties_view.rs @@ -286,8 +286,8 @@ impl LpPropertiesView { self.notify("file-info"); } - // Determines the dimensions of the file asyncronously. We do this - // asycnhronously to avoid blocking the UI as we parse the file info. + // Determines the dimensions of the file asynchronously. We do this + // asynchronously to avoid blocking the UI as we parse the file info. // In addition, we're loading the image metadata separately from the file // here so that the properties sidebar's information can load separately // from the current file. diff --git a/src/widgets/sliding_view.rs b/src/widgets/sliding_view.rs index 5b12f64..845e8ac 100644 --- a/src/widgets/sliding_view.rs +++ b/src/widgets/sliding_view.rs @@ -109,7 +109,7 @@ mod imp { self.swipe_tracker.set(swipe_tracker).unwrap(); - // Avoid propagating scoll events to AdwFlap if at beginning or end + // Avoid propagating scroll events to AdwFlap if at beginning or end let scroll_controller = gtk::EventControllerScroll::new(gtk::EventControllerScrollFlags::HORIZONTAL); @@ -356,7 +356,7 @@ impl LpSlidingView { /// Animates removal of current page /// - /// Moves to next page if possible, or to previous, or emmediately removes + /// Moves to next page if possible, or to previous, or immediately removes /// the current page if last remaining. pub fn scroll_to_neighbor(&self) { if let Some(next_page) = self.next_page() { diff --git a/src/window.rs b/src/window.rs index e7443dd..2b582fa 100644 --- a/src/window.rs +++ b/src/window.rs @@ -594,7 +594,7 @@ impl LpWindow { self.action_set_enabled("win.toggle-properties", enabled); } - /// Handles change in availablilty of images + /// Handles change in availability of images fn images_available(&self) { let imp = self.imp(); @@ -641,7 +641,7 @@ impl LpWindow { if let Some(page) = current_page { if page.error().is_some() { - log::debug!("Showin window because loading image failed"); + log::debug!("Showing window because loading image failed"); self.disconnect_present_watches(); self.present(); }