[fractal/fractal-next] sidebar: Use GtkExpression for CategoryRow



commit 9de599ed64de4d7b40994d222677c2efd82eb142
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Thu Jan 6 15:05:24 2022 +0100

    sidebar: Use GtkExpression for CategoryRow

 data/resources/ui/sidebar-category-row.ui |  6 +++++-
 src/session/sidebar/category_row.rs       | 17 -----------------
 2 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/data/resources/ui/sidebar-category-row.ui b/data/resources/ui/sidebar-category-row.ui
index 0b9cdc13..4b7d6341 100644
--- a/data/resources/ui/sidebar-category-row.ui
+++ b/data/resources/ui/sidebar-category-row.ui
@@ -12,6 +12,11 @@
             <property name="halign">start</property>
             <property name="hexpand">True</property>
             <property name="ellipsize">end</property>
+            <binding name="label">
+              <lookup name="display-name">
+                <lookup name="category">SidebarCategoryRow</lookup>
+              </lookup>
+            </binding>
             <style>
               <class name="dim-label"/>
             </style>
@@ -30,4 +35,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/src/session/sidebar/category_row.rs b/src/session/sidebar/category_row.rs
index 07da94a2..fd102c71 100644
--- a/src/session/sidebar/category_row.rs
+++ b/src/session/sidebar/category_row.rs
@@ -15,9 +15,6 @@ mod imp {
     pub struct CategoryRow {
         pub category: RefCell<Option<Category>>,
         pub expanded: Cell<bool>,
-        pub binding: RefCell<Option<glib::Binding>>,
-        #[template_child]
-        pub display_name: TemplateChild<gtk::Label>,
     }
 
     #[glib::object_subclass]
@@ -115,20 +112,6 @@ impl CategoryRow {
             return;
         }
 
-        if let Some(binding) = priv_.binding.take() {
-            binding.unbind();
-        }
-
-        if let Some(ref category) = category {
-            let binding = category
-                .bind_property("display-name", &priv_.display_name.get(), "label")
-                .flags(glib::BindingFlags::SYNC_CREATE)
-                .build()
-                .unwrap();
-
-            priv_.binding.replace(Some(binding));
-        }
-
         priv_.category.replace(category);
         self.notify("category");
     }


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