From 1497896f6d9b157c343a6e3d5f2e0212601eec50 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 12 Dec 2024 12:46:55 +0200 Subject: [PATCH] remove extra getters --- .../browser/window/tab/item/page/content.rs | 12 ++++++------ .../window/tab/item/page/content/image.rs | 18 ++++++------------ .../window/tab/item/page/content/status.rs | 6 ------ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content.rs b/src/app/browser/window/tab/item/page/content.rs index 5dfb6ed8..3eb56ee0 100644 --- a/src/app/browser/window/tab/item/page/content.rs +++ b/src/app/browser/window/tab/item/page/content.rs @@ -42,7 +42,7 @@ impl Content { pub fn to_image(&self, paintable: &impl IsA) -> Image { self.clean(); let image = Image::new_from_paintable(paintable); - self.gobject.append(image.gobject()); + self.gobject.append(&image.picture); image } @@ -57,7 +57,7 @@ impl Content { ) -> Status { self.clean(); let status = Status::new_download(initial_filename, cancellable, on_choose); - self.gobject.append(status.gobject()); + self.gobject.append(&status.gobject); status } @@ -67,7 +67,7 @@ impl Content { pub fn to_status_failure(&self) -> Status { self.clean(); let status = Status::new_failure(); - self.gobject.append(status.gobject()); + self.gobject.append(&status.gobject); status } @@ -77,7 +77,7 @@ impl Content { pub fn to_status_mime(&self, mime: &str, download: Option<(Rc, GString)>) -> Status { self.clean(); let status = Status::new_mime(mime, download); - self.gobject.append(status.gobject()); + self.gobject.append(&status.gobject); status } @@ -87,7 +87,7 @@ impl Content { pub fn to_status_identity(&self) -> Status { self.clean(); let status = Status::new_identity(self.tab_action.clone()); - self.gobject.append(status.gobject()); + self.gobject.append(&status.gobject); status } @@ -97,7 +97,7 @@ impl Content { pub fn to_status_loading(&self, show_with_delay: Option) -> Status { self.clean(); let status = Status::new_loading(show_with_delay); - self.gobject.append(status.gobject()); + self.gobject.append(&status.gobject); status } diff --git a/src/app/browser/window/tab/item/page/content/image.rs b/src/app/browser/window/tab/item/page/content/image.rs index 44c86eed..6786bede 100644 --- a/src/app/browser/window/tab/item/page/content/image.rs +++ b/src/app/browser/window/tab/item/page/content/image.rs @@ -5,7 +5,7 @@ use gtk::{ }; pub struct Image { - gobject: Picture, + pub picture: Picture, } impl Image { @@ -17,18 +17,12 @@ impl Image { // Constructors pub fn new_from_paintable(paintable: &impl IsA) -> Self { - let gobject = Picture::for_paintable(paintable); + let picture = Picture::for_paintable(paintable); - gobject.set_content_fit(Self::DEFAULT_CONTENT_FIT); - gobject.set_margin_end(Self::DEFAULT_MARGIN); - gobject.set_margin_start(Self::DEFAULT_MARGIN); + picture.set_content_fit(Self::DEFAULT_CONTENT_FIT); + picture.set_margin_end(Self::DEFAULT_MARGIN); + picture.set_margin_start(Self::DEFAULT_MARGIN); - Self { gobject } - } - - // Getters - - pub fn gobject(&self) -> &Picture { - &self.gobject + Self { picture } } } diff --git a/src/app/browser/window/tab/item/page/content/status.rs b/src/app/browser/window/tab/item/page/content/status.rs index 898bb4c7..f1fcc0c6 100644 --- a/src/app/browser/window/tab/item/page/content/status.rs +++ b/src/app/browser/window/tab/item/page/content/status.rs @@ -86,10 +86,4 @@ impl Status { self.gobject.set_description(value); self } - - // Getters - - pub fn gobject(&self) -> &StatusPage { - &self.gobject - } }