From 939b44030d4d54a3ab7ed7c368821a71622ad7c4 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 1 Nov 2024 03:57:12 +0200 Subject: [PATCH] move defaults to implementation --- .../browser/window/tab/item/page/content/image.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 e9b64bb7..df2bc204 100644 --- a/src/app/browser/window/tab/item/page/content/image.rs +++ b/src/app/browser/window/tab/item/page/content/image.rs @@ -1,23 +1,27 @@ use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture}; -const MARGIN: i32 = 6; - pub struct Image { gobject: Picture, } impl Image { - // Construct + // Defaults + + const DEFAULT_MARGIN: i32 = 6; + + // Constructors + pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self { let gobject = Picture::for_pixbuf(buffer); - gobject.set_margin_end(MARGIN); - gobject.set_margin_start(MARGIN); + gobject.set_margin_end(Self::DEFAULT_MARGIN); + gobject.set_margin_start(Self::DEFAULT_MARGIN); Self { gobject } } // Getters + pub fn gobject(&self) -> &Picture { &self.gobject }