widgets: Rename Window* to *Window

This commit is contained in:
Sophie Herold 2024-09-14 21:39:53 +02:00
parent 4b0d5f7b6d
commit f5660ba83e
9 changed files with 41 additions and 41 deletions

View file

@ -28,8 +28,8 @@ mod properties_view;
mod shy_bin;
mod sliding_view;
mod window_content;
mod window_edit;
mod window_image;
mod edit_window;
mod image_window;
pub use drag_overlay::LpDragOverlay;
pub use error_details::LpErrorDetails;
@ -42,5 +42,5 @@ pub use properties_view::LpPropertiesView;
pub use shy_bin::LpShyBin;
pub use sliding_view::LpSlidingView;
pub use window_content::LpWindowContent;
pub use window_edit::LpWindowEdit;
pub use window_image::LpWindowImage;
pub use edit_window::LpImageEdit;
pub use image_window::LpImageWindow;

View file

@ -22,17 +22,17 @@ use adw::{glib, gtk};
mod imp {
use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate, glib::Properties)]
#[properties(wrapper_type = super::LpWindowEdit)]
#[template(file = "window_edit.ui")]
pub struct LpWindowEdit {
#[properties(wrapper_type = super::LpImageEdit)]
#[template(file = "edit_window.ui")]
pub struct LpImageEdit {
#[property(get)]
example: u64,
}
#[glib::object_subclass]
impl ObjectSubclass for LpWindowEdit {
const NAME: &'static str = "LpWindowEdit";
type Type = super::LpWindowEdit;
impl ObjectSubclass for LpImageEdit {
const NAME: &'static str = "LpImageEdit";
type Type = super::LpImageEdit;
type ParentType = adw::Bin;
fn class_init(klass: &mut Self::Class) {
@ -45,22 +45,22 @@ mod imp {
}
#[glib::derived_properties]
impl ObjectImpl for LpWindowEdit {
impl ObjectImpl for LpImageEdit {
fn constructed(&self) {
self.parent_constructed();
}
}
impl WidgetImpl for LpWindowEdit {}
impl BinImpl for LpWindowEdit {}
impl WidgetImpl for LpImageEdit {}
impl BinImpl for LpImageEdit {}
}
glib::wrapper! {
pub struct LpWindowEdit(ObjectSubclass<imp::LpWindowEdit>)
pub struct LpImageEdit(ObjectSubclass<imp::LpImageEdit>)
@extends gtk::Widget, adw::Bin;
}
impl LpWindowEdit {
impl LpImageEdit {
pub fn new() -> Self {
glib::Object::new()
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="LpWindowEdit" parent="AdwBin">
<template class="LpImageEdit" parent="AdwBin">
<property name="child">
<object class="AdwToolbarView" id="toolbar_view">
<child type="top">

View file

@ -57,9 +57,9 @@ mod imp {
use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate, glib::Properties)]
#[properties(wrapper_type = super::LpWindowImage)]
#[template(file = "window_image.ui")]
pub struct LpWindowImage {
#[properties(wrapper_type = super::LpImageWindow)]
#[template(file = "image_window.ui")]
pub struct LpImageWindow {
#[property(get, construct_only)]
window: OnceCell<LpWindow>,
@ -114,9 +114,9 @@ mod imp {
}
#[glib::object_subclass]
impl ObjectSubclass for LpWindowImage {
const NAME: &'static str = "LpWindowImage";
type Type = super::LpWindowImage;
impl ObjectSubclass for LpImageWindow {
const NAME: &'static str = "LpImageWindow";
type Type = super::LpImageWindow;
type ParentType = adw::Bin;
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
@ -152,7 +152,7 @@ mod imp {
}
#[glib::derived_properties]
impl ObjectImpl for LpWindowImage {
impl ObjectImpl for LpImageWindow {
fn constructed(&self) {
self.parent_constructed();
@ -419,10 +419,10 @@ mod imp {
}
}
impl WidgetImpl for LpWindowImage {}
impl BinImpl for LpWindowImage {}
impl WidgetImpl for LpImageWindow {}
impl BinImpl for LpImageWindow {}
impl LpWindowImage {
impl LpImageWindow {
fn is_showing_image(&self) -> bool {
self.image_view.try_get().map_or(false, |image_view| {
image_view
@ -434,11 +434,11 @@ mod imp {
}
glib::wrapper! {
pub struct LpWindowImage(ObjectSubclass<imp::LpWindowImage>)
pub struct LpImageWindow(ObjectSubclass<imp::LpImageWindow>)
@extends gtk::Widget, adw::Bin;
}
impl LpWindowImage {
impl LpImageWindow {
fn zoom_out_cursor(&self) {
if let Some(image) = self.imp().image_view.current_image() {
image.zoom_out_cursor();

View file

@ -56,7 +56,7 @@
</item>
</section>
</menu>
<template class="LpWindowImage" parent="AdwBin">
<template class="LpImageWindow" parent="AdwBin">
<property name="child">
<object class="AdwMultiLayoutView" id="multi_layout_view">
<child>

View file

@ -79,7 +79,7 @@ impl ActionPartGlobal {
}
pub fn init_actions_and_bindings(
klass: &mut <super::imp::LpWindowImage as ObjectSubclass>::Class,
klass: &mut <super::imp::LpImageWindow as ObjectSubclass>::Class,
) {
for action in Self::iter() {
match action {
@ -206,7 +206,7 @@ pub enum Action {
impl Action {
pub fn init_actions_and_bindings(
klass: &mut <super::imp::LpWindowImage as ObjectSubclass>::Class,
klass: &mut <super::imp::LpImageWindow as ObjectSubclass>::Class,
) {
for action in Self::iter() {
match action {

View file

@ -20,7 +20,7 @@
use super::*;
/// Manage visibility of overlay controls
impl LpWindowImage {
impl LpImageWindow {
/// Set control opacity
///
/// Also changes headerbar transparency if it flat and hides/shows cursor on

View file

@ -22,7 +22,7 @@ use gtk::CompositeTemplate;
use crate::config;
use crate::deps::*;
use crate::widgets::{LpImageView, LpWindowEdit, LpWindowImage};
use crate::widgets::{LpImageView, LpImageEdit, LpImageWindow};
/// Show window after X milliseconds even if image dimensions are not known yet
const SHOW_WINDOW_AFTER: u64 = 2000;
@ -53,9 +53,9 @@ mod imp {
pub(super) stack: TemplateChild<adw::ViewStack>,
#[template_child]
pub(super) window_image: TemplateChild<LpWindowImage>,
pub(super) image_window: TemplateChild<LpImageWindow>,
#[template_child]
pub(super) window_edit: TemplateChild<LpWindowEdit>,
pub(super) edit_window: TemplateChild<LpImageEdit>,
}
#[glib::object_subclass]
@ -145,12 +145,12 @@ impl LpWindow {
let imp = self.imp();
if imp
.window_image
.image_window
.image_view()
.current_image()
.is_some_and(|img| img.image_size_available())
{
let shows_properties = imp.window_image.properties_button().is_active();
let shows_properties = imp.image_window.properties_button().is_active();
let (_, window_natural_width, _, _) = self.measure(gtk::Orientation::Horizontal, -1);
let (_, window_natural_height, _, _) = self.measure(gtk::Orientation::Vertical, -1);
@ -191,10 +191,10 @@ impl LpWindow {
}
pub fn show_edit(&self) {
self.imp().stack.set_visible_child(&*self.imp().window_edit);
self.imp().stack.set_visible_child(&*self.imp().edit_window);
}
pub fn image_view(&self) -> LpImageView {
self.imp().window_image.image_view()
self.imp().image_window.image_view()
}
}

View file

@ -24,12 +24,12 @@
<property name="child">
<object class="AdwViewStack" id="stack">
<child>
<object class="LpWindowImage" id="window_image">
<object class="LpImageWindow" id="image_window">
<property name="window">LpWindow</property>
</object>
</child>
<child>
<object class="LpWindowEdit" id="window_edit"></object>
<object class="LpImageEdit" id="edit_window"></object>
</child>
</object>
</property>