[niepce] ui: ThumbStripview item-height is now a Glib property



commit d5612a89486cf25009885e29502e13d439698109
Author: Hubert Figuière <hub figuiere net>
Date:   Thu Dec 26 12:52:29 2019 -0500

    ui: ThumbStripview item-height is now a Glib property

 src/niepce/ui/thumbstripview.cpp | 7 ++++++-
 src/niepce/ui/thumbstripview.hpp | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/niepce/ui/thumbstripview.cpp b/src/niepce/ui/thumbstripview.cpp
index ca2fa56..4daa4fc 100644
--- a/src/niepce/ui/thumbstripview.cpp
+++ b/src/niepce/ui/thumbstripview.cpp
@@ -79,6 +79,7 @@ ThumbStripView::ThumbStripView(const Glib::RefPtr<ui::ImageListStore> & store,
                                const IModuleShell& shell)
     : Glib::ObjectBase(typeid(ThumbStripView))
     , Gtk::IconView(Glib::RefPtr<Gtk::TreeModel>::cast_dynamic(store))
+    , property_item_height(*this, "item-height", 100)
     , m_start_thumb(0)
     , m_end_thumb(0)
     , m_store(store)
@@ -87,6 +88,10 @@ ThumbStripView::ThumbStripView(const Glib::RefPtr<ui::ImageListStore> & store,
     m_renderer = manage(new ThumbStripCell(shell));
 
     pack_start(*m_renderer, FALSE);
+    connect_property_changed("item-height",
+                             [this] () {
+                                 m_renderer->property_height() = this->property_item_height;
+                             });
     m_renderer->property_height() = 100;
     m_renderer->property_yalign() = 0.5;
     m_renderer->property_xalign() = 0.5;
@@ -323,7 +328,7 @@ void ThumbStripView::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
 void
 ThumbStripView::set_item_height (int height)
 {
-    m_renderer->property_height() = height;
+    property_item_height = height;
 }
 
 
diff --git a/src/niepce/ui/thumbstripview.hpp b/src/niepce/ui/thumbstripview.hpp
index 8b4c581..fc1a904 100644
--- a/src/niepce/ui/thumbstripview.hpp
+++ b/src/niepce/ui/thumbstripview.hpp
@@ -42,6 +42,7 @@ public:
     const Glib::RefPtr<ui::ImageListStore> & get_model() const;
     void set_item_height(int height);
 
+    Glib::Property<gint> property_item_height;
 private:
     void on_parent_set(Gtk::Widget* previous_parent);
     void on_visible_range_changed();


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