[niepce: 6/14] Pass the TreeModel at construction time.
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce: 6/14] Pass the TreeModel at construction time.
- Date: Mon, 10 Jun 2013 03:07:14 +0000 (UTC)
commit ada49c4a5867c6d768034163ee8e332b58105944
Author: Hubert Figuière <hub figuiere net>
Date: Fri Jun 7 23:01:40 2013 -0400
Pass the TreeModel at construction time.
src/fwk/toolkit/widgets/imagegridview.cpp | 7 ++++++-
src/fwk/toolkit/widgets/imagegridview.hpp | 3 ++-
src/niepce/ui/gridviewmodule.cpp | 19 +++++++++----------
src/niepce/ui/thumbstripview.cpp | 5 ++---
4 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/src/fwk/toolkit/widgets/imagegridview.cpp b/src/fwk/toolkit/widgets/imagegridview.cpp
index 1edd487..ee1ab53 100644
--- a/src/fwk/toolkit/widgets/imagegridview.cpp
+++ b/src/fwk/toolkit/widgets/imagegridview.cpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/widgets/imagegridview.cpp
*
- * Copyright (C) 2011 Hubert Figuiere
+ * Copyright (C) 2011-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +29,11 @@ void ClickableCellRenderer::hit(int x, int y)
m_hit = true;
}
+ImageGridView::ImageGridView(const Glib::RefPtr<Gtk::TreeModel> & model)
+ : Gtk::IconView(model)
+{
+}
+
ImageGridView::ImageGridView()
: Gtk::IconView()
{
diff --git a/src/fwk/toolkit/widgets/imagegridview.hpp b/src/fwk/toolkit/widgets/imagegridview.hpp
index fea5024..5c0e919 100644
--- a/src/fwk/toolkit/widgets/imagegridview.hpp
+++ b/src/fwk/toolkit/widgets/imagegridview.hpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/widgets/imagegridview.hpp
*
- * Copyright (C) 2011 Hubert Figuiere
+ * Copyright (C) 2011-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,6 +68,7 @@ class ImageGridView
{
public:
ImageGridView();
+ ImageGridView(const Glib::RefPtr<Gtk::TreeModel> & model);
/**
* Used to work around the activate that don't pass an event.
diff --git a/src/niepce/ui/gridviewmodule.cpp b/src/niepce/ui/gridviewmodule.cpp
index 25feabd..c714568 100644
--- a/src/niepce/ui/gridviewmodule.cpp
+++ b/src/niepce/ui/gridviewmodule.cpp
@@ -1,7 +1,7 @@
/*
- * niepce - ui/gridviewmodule.hpp
+ * niepce - ui/gridviewmodule.cpp
*
- * Copyright (C) 2009 Hubert Figuiere
+ * Copyright (C) 2009-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ GridViewModule::GridViewModule(const IModuleShell & shell,
DBG_ASSERT(m_uidataprovider, "provider is NULL");
}
-void
+void
GridViewModule::on_lib_notification(const eng::LibNotification &ln)
{
switch(ln.type) {
@@ -79,7 +79,7 @@ GridViewModule::on_lib_notification(const eng::LibNotification &ln)
DBG_ASSERT(ln.param.type() == typeid(std::pair<eng::library_id_t,eng::library_id_t>),
"incorrect data type for the notification");
std::pair<eng::library_id_t,eng::library_id_t>
moved(boost::any_cast<std::pair<eng::library_id_t,eng::library_id_t> >(ln.param));
-
+
// check that the file that was moved still match the content
break;
@@ -102,8 +102,7 @@ Gtk::Widget * GridViewModule::buildWidget(const Glib::RefPtr<Gtk::UIManager> & m
return m_widget;
}
m_widget = &m_lib_splitview;
- m_librarylistview = Gtk::manage(new fwk::ImageGridView());
- m_librarylistview->set_model(m_model);
+ m_librarylistview = Gtk::manage(new fwk::ImageGridView(m_model));
m_librarylistview->set_selection_mode(Gtk::SELECTION_SINGLE);
m_librarylistview->property_row_spacing() = 0;
m_librarylistview->property_column_spacing() = 0;
@@ -119,9 +118,9 @@ Gtk::Widget * GridViewModule::buildWidget(const Glib::RefPtr<Gtk::UIManager> & m
Glib::RefPtr<Gtk::CellArea> cell_area = m_librarylistview->property_cell_area();
cell_area->pack_start(*libcell, FALSE);
- cell_area->add_attribute(*libcell, "pixbuf",
+ cell_area->add_attribute(*libcell, "pixbuf",
m_model->columns().m_pix.index());
- cell_area->add_attribute(*libcell, "libfile",
+ cell_area->add_attribute(*libcell, "libfile",
m_model->columns().m_libfile.index());
m_scrollview.add(*m_librarylistview);
@@ -153,8 +152,8 @@ void GridViewModule::set_active(bool /*active*/)
Gtk::IconView * GridViewModule::image_list()
-{
- return m_librarylistview;
+{
+ return m_librarylistview;
}
eng::library_id_t GridViewModule::get_selected()
diff --git a/src/niepce/ui/thumbstripview.cpp b/src/niepce/ui/thumbstripview.cpp
index c9e4240..52377cb 100644
--- a/src/niepce/ui/thumbstripview.cpp
+++ b/src/niepce/ui/thumbstripview.cpp
@@ -79,12 +79,11 @@ ThumbStripCell::ThumbStripCell()
ThumbStripView::ThumbStripView(const Glib::RefPtr<ui::ImageListStore> & store)
- : m_start_thumb(0)
+ : IconView(Glib::RefPtr<Gtk::TreeModel>::cast_dynamic(store))
+ , m_start_thumb(0)
, m_end_thumb(0)
, m_store(store)
{
- IconView::set_model(store);
-
m_renderer = new ThumbStripCell();
pack_start(*m_renderer, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]