[niepce] ui: remove unused code in ThumbStripview
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] ui: remove unused code in ThumbStripview
- Date: Sat, 18 Jan 2020 05:25:39 +0000 (UTC)
commit 6e37fda7e6cc8a133a4b69d4f39114faf41a2012
Author: Hubert Figuière <hub figuiere net>
Date: Sat Jan 4 11:43:38 2020 -0500
ui: remove unused code in ThumbStripview
src/niepce/ui/thumbstripview.cpp | 131 ---------------------------------------
src/niepce/ui/thumbstripview.hpp | 7 ---
2 files changed, 138 deletions(-)
---
diff --git a/src/niepce/ui/thumbstripview.cpp b/src/niepce/ui/thumbstripview.cpp
index 4daa4fc..f936840 100644
--- a/src/niepce/ui/thumbstripview.cpp
+++ b/src/niepce/ui/thumbstripview.cpp
@@ -80,8 +80,6 @@ ThumbStripView::ThumbStripView(const Glib::RefPtr<ui::ImageListStore> & store,
: 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)
, m_model_item_count(0)
{
@@ -108,9 +106,6 @@ ThumbStripView::ThumbStripView(const Glib::RefPtr<ui::ImageListStore> & store,
set_row_spacing (THUMB_STRIP_VIEW_SPACING);
set_margin (0);
- signal_parent_changed().connect(
- sigc::mem_fun(*this, &ThumbStripView::on_parent_set));
-
// enable_model_drag_source (target_table, Gdk::MODIFIER_MASK, Gdk::ACTION_COPY);
// signal_drag_data_get().connect(
@@ -165,132 +160,6 @@ void ThumbStripView::update_item_count()
set_columns(m_model_item_count);
}
-void
-ThumbStripView::clear_range (int start_thumb, int end_thumb)
-{
-// Gtk::TreeIter iter;
-// int thumb = start_thumb;
-
- g_assert (start_thumb <= end_thumb);
-
-// for (iter = m_store->children().begin() + start_thumb;
-// iter && thumb <= end_thumb;
-// ++iter, thumb++) {
-// eog_list_store_thumbnail_unset (get_pointer(store), &iter);
-// }
-}
-
-void
-ThumbStripView::add_range (int start_thumb, int end_thumb)
-{
-// Gtk::TreeIter iter;
-// gint thumb = start_thumb;
-
- g_assert (start_thumb <= end_thumb);
-
-// for (iter = m_store->children().begin() + start_thumb;
-// iter && thumb <= end_thumb;
-// ++iter, thumb++) {
-// eog_list_store_thumbnail_set (get_pointer(store), &iter);
-// }
-}
-
-void
-ThumbStripView::update_visible_range (int start_thumb, int end_thumb)
-{
- int old_start_thumb, old_end_thumb;
-
- old_start_thumb = m_start_thumb;
- old_end_thumb = m_end_thumb;
-
- if (start_thumb == old_start_thumb &&
- end_thumb == old_end_thumb) {
- return;
- }
-
- if (old_start_thumb < start_thumb)
- clear_range (old_start_thumb, MIN (start_thumb - 1, old_end_thumb));
-
- if (old_end_thumb > end_thumb)
- clear_range (MAX (end_thumb + 1, old_start_thumb), old_end_thumb);
-
- add_range (start_thumb, end_thumb);
-
- m_start_thumb = start_thumb;
- m_end_thumb = end_thumb;
-}
-
-void
-ThumbStripView::on_visible_range_changed()
-{
- Gtk::TreePath path1, path2;
-
- if (!get_visible_range (path1, path2)) {
- return;
- }
-
- update_visible_range (path1[0], path2[0]);
-}
-
-void
-ThumbStripView::on_adjustment_changed ()
-{
- Gtk::TreePath path1, path2;
- int start_thumb, end_thumb;
-
- if (!get_visible_range (path1, path2)) {
- return;
- }
-
- start_thumb = path1 [0];
- end_thumb = path2 [0];
-
- add_range (start_thumb, end_thumb);
-
- /* case we added an image, we need to make sure that the shifted thumbnail is cleared */
- clear_range (end_thumb + 1, end_thumb + 1);
-
- m_start_thumb = start_thumb;
- m_end_thumb = end_thumb;
-}
-
-void
-ThumbStripView::on_parent_set (Gtk::Widget */*old_parent*/)
-{
- Gtk::Widget *parent = get_parent ();
- Gtk::ScrolledWindow *sw = dynamic_cast<Gtk::ScrolledWindow*>(parent);
- if (!sw) {
- // TODO shouldn't we disconnect all of that?
- return;
- }
-
- Glib::RefPtr<Gtk::Adjustment> hadjustment;
- Glib::RefPtr<Gtk::Adjustment> vadjustment;
-
- /* if we have been set to a ScrolledWindow, we connect to the callback
- to set and unset thumbnails. */
- hadjustment = sw->get_hadjustment ();
- vadjustment = sw->get_vadjustment ();
-
- /* when scrolling */
- hadjustment->signal_value_changed().connect(
- sigc::mem_fun(*this, &ThumbStripView::on_visible_range_changed));
- vadjustment->signal_value_changed().connect(
- sigc::mem_fun(*this, &ThumbStripView::on_visible_range_changed));
-
- /* when the adjustment is changed, ie. probably we have new images added. */
- hadjustment->signal_changed().connect(
- sigc::mem_fun(*this, &ThumbStripView::on_adjustment_changed));
- vadjustment->signal_changed().connect(
- sigc::mem_fun(*this, &ThumbStripView::on_adjustment_changed));
-
- /* when resizing the scrolled window */
- sw->signal_size_allocate().connect(
- sigc::hide<0>(sigc::mem_fun(*this,
- &ThumbStripView::on_visible_range_changed)));
-}
-
-
void ThumbStripView::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
Gtk::SelectionData& /*data*/,guint,guint)
{
diff --git a/src/niepce/ui/thumbstripview.hpp b/src/niepce/ui/thumbstripview.hpp
index fc1a904..30e8b27 100644
--- a/src/niepce/ui/thumbstripview.hpp
+++ b/src/niepce/ui/thumbstripview.hpp
@@ -44,14 +44,9 @@ public:
Glib::Property<gint> property_item_height;
private:
- void on_parent_set(Gtk::Widget* previous_parent);
- void on_visible_range_changed();
- void on_adjustment_changed();
void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
Gtk::SelectionData&,guint,guint) override;
void update_visible_range(int, int);
- void add_range(int, int);
- void clear_range (int start_thumb, int end_thumb);
void setup_model(const Glib::RefPtr<ui::ImageListStore> & store);
void row_added(const Gtk::TreeModel::Path&,
@@ -59,8 +54,6 @@ private:
void row_deleted(const Gtk::TreeModel::Path&);
void update_item_count();
- gint m_start_thumb; /* the first visible thumbnail */
- gint m_end_thumb; /* the last visible thumbnail */
Glib::RefPtr<ui::ImageListStore> m_store;
Gtk::CellRendererPixbuf *m_renderer;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]