remove extra getters

This commit is contained in:
yggverse 2024-12-12 12:46:55 +02:00
parent 3e3f74dff6
commit 1497896f6d
3 changed files with 12 additions and 24 deletions

View File

@ -42,7 +42,7 @@ impl Content {
pub fn to_image(&self, paintable: &impl IsA<Paintable>) -> Image { pub fn to_image(&self, paintable: &impl IsA<Paintable>) -> Image {
self.clean(); self.clean();
let image = Image::new_from_paintable(paintable); let image = Image::new_from_paintable(paintable);
self.gobject.append(image.gobject()); self.gobject.append(&image.picture);
image image
} }
@ -57,7 +57,7 @@ impl Content {
) -> Status { ) -> Status {
self.clean(); self.clean();
let status = Status::new_download(initial_filename, cancellable, on_choose); let status = Status::new_download(initial_filename, cancellable, on_choose);
self.gobject.append(status.gobject()); self.gobject.append(&status.gobject);
status status
} }
@ -67,7 +67,7 @@ impl Content {
pub fn to_status_failure(&self) -> Status { pub fn to_status_failure(&self) -> Status {
self.clean(); self.clean();
let status = Status::new_failure(); let status = Status::new_failure();
self.gobject.append(status.gobject()); self.gobject.append(&status.gobject);
status status
} }
@ -77,7 +77,7 @@ impl Content {
pub fn to_status_mime(&self, mime: &str, download: Option<(Rc<TabAction>, GString)>) -> Status { pub fn to_status_mime(&self, mime: &str, download: Option<(Rc<TabAction>, GString)>) -> Status {
self.clean(); self.clean();
let status = Status::new_mime(mime, download); let status = Status::new_mime(mime, download);
self.gobject.append(status.gobject()); self.gobject.append(&status.gobject);
status status
} }
@ -87,7 +87,7 @@ impl Content {
pub fn to_status_identity(&self) -> Status { pub fn to_status_identity(&self) -> Status {
self.clean(); self.clean();
let status = Status::new_identity(self.tab_action.clone()); let status = Status::new_identity(self.tab_action.clone());
self.gobject.append(status.gobject()); self.gobject.append(&status.gobject);
status status
} }
@ -97,7 +97,7 @@ impl Content {
pub fn to_status_loading(&self, show_with_delay: Option<Duration>) -> Status { pub fn to_status_loading(&self, show_with_delay: Option<Duration>) -> Status {
self.clean(); self.clean();
let status = Status::new_loading(show_with_delay); let status = Status::new_loading(show_with_delay);
self.gobject.append(status.gobject()); self.gobject.append(&status.gobject);
status status
} }

View File

@ -5,7 +5,7 @@ use gtk::{
}; };
pub struct Image { pub struct Image {
gobject: Picture, pub picture: Picture,
} }
impl Image { impl Image {
@ -17,18 +17,12 @@ impl Image {
// Constructors // Constructors
pub fn new_from_paintable(paintable: &impl IsA<Paintable>) -> Self { pub fn new_from_paintable(paintable: &impl IsA<Paintable>) -> Self {
let gobject = Picture::for_paintable(paintable); let picture = Picture::for_paintable(paintable);
gobject.set_content_fit(Self::DEFAULT_CONTENT_FIT); picture.set_content_fit(Self::DEFAULT_CONTENT_FIT);
gobject.set_margin_end(Self::DEFAULT_MARGIN); picture.set_margin_end(Self::DEFAULT_MARGIN);
gobject.set_margin_start(Self::DEFAULT_MARGIN); picture.set_margin_start(Self::DEFAULT_MARGIN);
Self { gobject } Self { picture }
}
// Getters
pub fn gobject(&self) -> &Picture {
&self.gobject
} }
} }

View File

@ -86,10 +86,4 @@ impl Status {
self.gobject.set_description(value); self.gobject.set_description(value);
self self
} }
// Getters
pub fn gobject(&self) -> &StatusPage {
&self.gobject
}
} }