[fractal/bilelmoussaoui/cleanup: 3/4] components: Use Default where possible




commit 9039633c241f741e1a282b037ec0e8dde8cfb8e5
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Thu Mar 31 11:26:18 2022 +0200

    components: Use Default where possible

 src/components/label_with_widgets.rs | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
---
diff --git a/src/components/label_with_widgets.rs b/src/components/label_with_widgets.rs
index 8c50f280f..737de3cd1 100644
--- a/src/components/label_with_widgets.rs
+++ b/src/components/label_with_widgets.rs
@@ -14,7 +14,7 @@ mod imp {
 
     use super::*;
 
-    #[derive(Debug)]
+    #[derive(Debug, Default)]
     pub struct LabelWithWidgets {
         pub widgets: RefCell<Vec<gtk::Widget>>,
         pub widgets_sizes: RefCell<Vec<(i32, i32)>>,
@@ -23,18 +23,6 @@ mod imp {
         pub text: RefCell<Option<String>>,
     }
 
-    impl Default for LabelWithWidgets {
-        fn default() -> Self {
-            Self {
-                label: gtk::Label::builder().wrap(true).build(),
-                widgets: Default::default(),
-                widgets_sizes: Default::default(),
-                placeholder: Default::default(),
-                text: Default::default(),
-            }
-        }
-    }
-
     #[glib::object_subclass]
     impl ObjectSubclass for LabelWithWidgets {
         const NAME: &'static str = "LabelWithWidgets";
@@ -93,6 +81,7 @@ mod imp {
         fn constructed(&self, obj: &Self::Type) {
             self.parent_constructed(obj);
             self.label.set_parent(obj);
+            self.label.set_wrap(true);
             self.label.connect_notify_local(
                 Some("label"),
                 clone!(@weak obj => move |_, _| {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]