[niepce] * Remove boost::signal



commit a85b5b01332576531e358ecc8ce5b86ad5d63e5e
Author: Hubert Figuiere <hub figuiere net>
Date:   Sun Apr 12 02:57:52 2009 -0400

    	* Remove boost::signal
---
 ChangeLog                                   |    2 +
 README                                      |    8 +-
 configure.ac                                |    3 +-
 src/fwk/toolkit/controller.hpp              |    5 +-
 src/fwk/toolkit/undo.cpp                    |   14 ++--
 src/fwk/toolkit/undo.hpp                    |    5 +-
 src/niepce/Makefile.am                      |    4 +-
 src/niepce/ui/Makefile.am                   |    6 +-
 src/niepce/ui/filmstripcontroller.cpp       |    2 +-
 src/niepce/ui/filmstripcontroller.h         |   63 --------------
 src/niepce/ui/filmstripcontroller.hpp       |   63 ++++++++++++++
 src/niepce/ui/librarymainviewcontroller.cpp |    2 +-
 src/niepce/ui/librarymainviewcontroller.h   |  107 -----------------------
 src/niepce/ui/librarymainviewcontroller.hpp |  107 +++++++++++++++++++++++
 src/niepce/ui/niepcewindow.cpp              |   37 ++++-----
 src/niepce/ui/niepcewindow.hpp              |   16 ++--
 src/niepce/ui/selectioncontroller.cpp       |    2 +-
 src/niepce/ui/selectioncontroller.h         |  122 ---------------------------
 src/niepce/ui/selectioncontroller.hpp       |  122 +++++++++++++++++++++++++++
 19 files changed, 345 insertions(+), 345 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 427a0cc..e0092b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-04-11  Hubert Figuiere  <hub figuiere net>
 
+	* Remove boost::signal
+
 	* Implement labels, at least partially.
 
 2009-04-09  Hubert Figuiere  <hub figuiere net>
diff --git a/README b/README
index 0175659..1194c31 100644
--- a/README
+++ b/README
@@ -30,14 +30,14 @@ cairomm
 gnome-vfs >= 2.14
 sqlite3
 libxml > 2.5.0
-boost 1.33
+boost 1.34
  -boost thread
  -boost filesystem
  -boost test (for the unit test)
 exempi >= 2.0.0
-libopenraw >= 0.0.4
-geglmm >= 0.0.17
-gegl >= 0.0.20
+libopenraw >= 0.0.5
+geglmm >= 0.0.22
+gegl >= 0.0.22
 babl
 goocanvasmm 0.10.0
 
diff --git a/configure.ac b/configure.ac
index 391d967..bda62af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ GEGLMM_VERSION=0.0.22
 LIBOPENRAW_VERSION=0.0.5
 dnl need at least 2.5.0 because of xmlTextReader
 LIBXML2_VERSION=2.5.0
-BOOST_VERSION=1.33.1
+BOOST_VERSION=1.34
 
 AC_PROG_CXX
 AC_GNU_SOURCE
@@ -112,7 +112,6 @@ BOOST_FUNCTION
 BOOST_SMART_PTR
 BOOST_TEST([s])
 BOOST_THREADS
-BOOST_SIGNALS
 
 AC_LANG_PUSH(C++)
 if test "$GCC" = "yes"; then
diff --git a/src/fwk/toolkit/controller.hpp b/src/fwk/toolkit/controller.hpp
index 93e912d..dcc6f3f 100644
--- a/src/fwk/toolkit/controller.hpp
+++ b/src/fwk/toolkit/controller.hpp
@@ -28,6 +28,8 @@
 #include <boost/weak_ptr.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
+#include "sigc++/trackable.h"
+
 #include "fwk/utils/databinder.h"
 
 namespace Gtk {
@@ -39,7 +41,8 @@ namespace fwk {
 	/** Generic controller class
 	 */
 	class Controller
-		: public boost::enable_shared_from_this<Controller>
+      : public boost::enable_shared_from_this<Controller>
+      , public sigc::trackable
 	{
 	public:
 		typedef boost::shared_ptr<Controller> Ptr;
diff --git a/src/fwk/toolkit/undo.cpp b/src/fwk/toolkit/undo.cpp
index b24cec9..8277d36 100644
--- a/src/fwk/toolkit/undo.cpp
+++ b/src/fwk/toolkit/undo.cpp
@@ -71,7 +71,9 @@ void UndoTransaction::redo()
 
 UndoHistory::~UndoHistory()
 {
-    clear();
+    // DO NOT CALL UndoHistory::clear() !!!
+    clear(m_undos);
+    clear(m_redos);
 }
 
 void UndoHistory::add(UndoTransaction* t)
@@ -79,7 +81,7 @@ void UndoHistory::add(UndoTransaction* t)
     m_undos.push_front(t);
     clear(m_redos);
 
-    changed();
+    signal_changed();
 }
 
 void UndoHistory::undo()
@@ -91,7 +93,7 @@ void UndoHistory::undo()
             t->undo();
             m_undos.pop_front();
             m_redos.push_front(t);
-            changed();
+            signal_changed();
         }
     }
 }
@@ -105,7 +107,7 @@ void UndoHistory::redo()
             t->redo();
             m_redos.pop_front();
             m_undos.push_front(t);
-            changed();
+            signal_changed();
         }
     }
 }
@@ -113,10 +115,8 @@ void UndoHistory::redo()
 
 void UndoHistory::clear()
 {
-    clear(m_undos);
-    clear(m_redos);
 
-    changed();
+    signal_changed();
 }
 
 std::string UndoHistory::next_undo() const
diff --git a/src/fwk/toolkit/undo.hpp b/src/fwk/toolkit/undo.hpp
index 45b5ae1..ab55cbb 100644
--- a/src/fwk/toolkit/undo.hpp
+++ b/src/fwk/toolkit/undo.hpp
@@ -24,9 +24,10 @@
 #include <list>
 #include <stack>
 #include <string>
-#include <boost/signal.hpp>
 #include <boost/noncopyable.hpp>
 
+#include <sigc++/signal.h>
+
 namespace fwk {
 
 class Command;
@@ -65,7 +66,7 @@ public:
     std::string next_redo() const;
 
     // called when the undo history change.
-    boost::signal<void (void)> changed;
+    sigc::signal<void> signal_changed;
 private:
     void clear(std::list<UndoTransaction*> & l);
 
diff --git a/src/niepce/Makefile.am b/src/niepce/Makefile.am
index b7877cd..f9e06bc 100644
--- a/src/niepce/Makefile.am
+++ b/src/niepce/Makefile.am
@@ -9,7 +9,7 @@ bin_PROGRAMS = niepce
 
 niepce_CPPFLAGS = @LIBGTKMM_CFLAGS@ @GCONF_CFLAGS@
 niepce_LDFLAGS = -Wl,--as-needed @BOOST_FILESYSTEM_LDFLAGS@ \
-	@BOOST_THREAD_LDFLAGS@ @BOOST_SIGNALS_LDFLAGS@
+	@BOOST_THREAD_LDFLAGS@
 niepce_LDADD = \
 	$(top_builddir)/src/engine/db/libniepcedb.a \
 	$(top_builddir)/src/niepce/ui/libniepceui.a \
@@ -25,7 +25,7 @@ niepce_LDADD = \
 	@LIBGLIBMM_LIBS@ \
 	@LIBGTKMM_LIBS@ @SQLITE3_LIBS@ \
 	@GNOMEVFS_LIBS@ @GCONF_LIBS@ @BOOST_THREAD_LIBS@ \
-	@BOOST_FILESYSTEM_LIBS@  @BOOST_SIGNALS_LIBS@ \
+	@BOOST_FILESYSTEM_LIBS@  \
 	@GOOCANVASMM_LIBS@ @BABL_LIBS@ \
 	@GEGLMM_LIBS@ @OPENRAW_LIBS@ @EXEMPI_LIBS@
 
diff --git a/src/niepce/ui/Makefile.am b/src/niepce/ui/Makefile.am
index 886a0ff..0e5a050 100644
--- a/src/niepce/ui/Makefile.am
+++ b/src/niepce/ui/Makefile.am
@@ -29,15 +29,15 @@ libniepceui_a_SOURCES = niepcewindow.hpp niepcewindow.cpp \
 	niepceapplication.hpp niepceapplication.cpp \
 	librarymainview.h librarymainview.cpp \
 	librarycellrenderer.h librarycellrenderer.cpp \
-	librarymainviewcontroller.h librarymainviewcontroller.cpp \
+	librarymainviewcontroller.hpp librarymainviewcontroller.cpp \
 	imageliststore.h imageliststore.cpp\
 	workspacecontroller.h workspacecontroller.cpp \
 	metadatapanecontroller.hpp metadatapanecontroller.cpp \
 	dialogs/editlabels.hpp dialogs/editlabels.cpp \
 	dialogs/importdialog.hpp dialogs/importdialog.cpp \
 	dialogs/preferencesdialog.hpp dialogs/preferencesdialog.cpp \
-	selectioncontroller.h selectioncontroller.cpp \
-	filmstripcontroller.h filmstripcontroller.cpp \
+	selectioncontroller.hpp selectioncontroller.cpp \
+	filmstripcontroller.hpp filmstripcontroller.cpp \
 	dialogs/importdialog.hpp dialogs/importdialog.cpp \
 	thumb-view/eog-thumb-nav.cpp thumb-view/eog-thumb-nav.h \
 	thumb-view/eog-thumb-view.cpp thumb-view/eog-thumb-view.h
diff --git a/src/niepce/ui/filmstripcontroller.cpp b/src/niepce/ui/filmstripcontroller.cpp
index 024cc10..a37b292 100644
--- a/src/niepce/ui/filmstripcontroller.cpp
+++ b/src/niepce/ui/filmstripcontroller.cpp
@@ -27,7 +27,7 @@
 
 #include "eog-thumb-nav.h"
 #include "eog-thumb-view.h"
-#include "filmstripcontroller.h"
+#include "filmstripcontroller.hpp"
 
 namespace ui {
 
diff --git a/src/niepce/ui/filmstripcontroller.h b/src/niepce/ui/filmstripcontroller.h
deleted file mode 100644
index a179670..0000000
--- a/src/niepce/ui/filmstripcontroller.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * niepce - ui/filmstripcontroller.h
- *
- * Copyright (C) 2008 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-
-#ifndef __UI_FILMSTRIPCONTROLLER_H_
-#define __UI_FILMSTRIPCONTROLLER_H_
-
-#include "fwk/toolkit/controller.hpp"
-#include "fwk/toolkit/notificationcenter.hpp"
-#include "ui/selectioncontroller.h"
-
-namespace Gtk {
-	class IconView;
-}
-
-namespace ui {
-
-
-class FilmStripController
-	: public fwk::Controller,
-	  public IImageSelectable
-{
-public:
-	typedef boost::shared_ptr<FilmStripController> Ptr;
-	typedef boost::weak_ptr<FilmStripController> WeakPtr;
-
-	FilmStripController(const Glib::RefPtr<ImageListStore> & store);
-
-	virtual Gtk::IconView * image_list();
-	virtual int get_selected();
-	virtual void select_image(int id);
-
-//	void on_tnail_notification(const framework::Notification::Ptr &);
-//	void on_lib_notification(const framework::Notification::Ptr &);
-	
-protected:
-	virtual Gtk::Widget * buildWidget();
-private:
-	Gtk::IconView * m_thumbview;
-	Glib::RefPtr<ImageListStore> m_store;
-};
-
-
-}
-
-#endif
diff --git a/src/niepce/ui/filmstripcontroller.hpp b/src/niepce/ui/filmstripcontroller.hpp
new file mode 100644
index 0000000..93f295f
--- /dev/null
+++ b/src/niepce/ui/filmstripcontroller.hpp
@@ -0,0 +1,63 @@
+/*
+ * niepce - ui/filmstripcontroller.h
+ *
+ * Copyright (C) 2008 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#ifndef __UI_FILMSTRIPCONTROLLER_H_
+#define __UI_FILMSTRIPCONTROLLER_H_
+
+#include "fwk/toolkit/controller.hpp"
+#include "fwk/toolkit/notificationcenter.hpp"
+#include "ui/selectioncontroller.hpp"
+
+namespace Gtk {
+	class IconView;
+}
+
+namespace ui {
+
+
+class FilmStripController
+	: public fwk::Controller,
+	  public IImageSelectable
+{
+public:
+	typedef boost::shared_ptr<FilmStripController> Ptr;
+	typedef boost::weak_ptr<FilmStripController> WeakPtr;
+
+	FilmStripController(const Glib::RefPtr<ImageListStore> & store);
+
+	virtual Gtk::IconView * image_list();
+	virtual int get_selected();
+	virtual void select_image(int id);
+
+//	void on_tnail_notification(const framework::Notification::Ptr &);
+//	void on_lib_notification(const framework::Notification::Ptr &);
+	
+protected:
+	virtual Gtk::Widget * buildWidget();
+private:
+	Gtk::IconView * m_thumbview;
+	Glib::RefPtr<ImageListStore> m_store;
+};
+
+
+}
+
+#endif
diff --git a/src/niepce/ui/librarymainviewcontroller.cpp b/src/niepce/ui/librarymainviewcontroller.cpp
index 7309ff7..1af9fd3 100644
--- a/src/niepce/ui/librarymainviewcontroller.cpp
+++ b/src/niepce/ui/librarymainviewcontroller.cpp
@@ -31,7 +31,7 @@
 #include "engine/db/library.h"
 #include "fwk/toolkit/application.hpp"
 #include "fwk/toolkit/widgets/dock.hpp"
-#include "librarymainviewcontroller.h"
+#include "librarymainviewcontroller.hpp"
 #include "niepcewindow.hpp"
 #include "metadatapanecontroller.hpp"
 #include "librarycellrenderer.h"
diff --git a/src/niepce/ui/librarymainviewcontroller.h b/src/niepce/ui/librarymainviewcontroller.h
deleted file mode 100644
index 3047335..0000000
--- a/src/niepce/ui/librarymainviewcontroller.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * niepce - ui/librarymainviewcontroller.h
- *
- * Copyright (C) 2007-2008 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef __UI_LIBRARYMAINVIEWCONTROLLER_H__
-#define __UI_LIBRARYMAINVIEWCONTROLLER_H__
-
-
-#include <gtkmm/iconview.h>
-#include <gtkmm/liststore.h>
-#include <gtkmm/treestore.h>
-#include <gtkmm/scrolledwindow.h>
-#include <gtkmm/paned.h>
-
-#include "librarymainview.h"
-#include "engine/db/libfile.h"
-#include "libraryclient/libraryclient.h"
-#include "fwk/toolkit/controller.hpp"
-#include "fwk/toolkit/notification.hpp"
-#include "metadatapanecontroller.hpp"
-#include "selectioncontroller.h"
-#include "modules/darkroom/darkroommodule.h"
-#include "imageliststore.h"
-
-namespace Gtk {
-	class Widget;
-}
-namespace fwk {
-class Dock;
-}
-
-namespace ui {
-
-class LibraryMainViewController
-		: public fwk::Controller,
-		  public IImageSelectable
-{
-public:
-		typedef boost::shared_ptr<LibraryMainViewController> Ptr;
-		typedef boost::weak_ptr<LibraryMainViewController> WeakPtr;
-
-		LibraryMainViewController(const Glib::RefPtr<Gtk::ActionGroup> & actions,
-                              const Glib::RefPtr<ImageListStore> & store)
-        : m_actionGroup(actions),
-          m_model(store)
-        {
-        }
-
-		void on_lib_notification(const fwk::Notification::Ptr &);
-
-		/** called when somehing is selected by the shared selection */
-		void on_selected(int id);
-		void on_image_activated(int id);
-
-		virtual Gtk::IconView * image_list();
-		virtual int get_selected();
-		virtual void select_image(int id);
-protected:
-		virtual Gtk::Widget * buildWidget();
-		virtual void on_ready();
-private:
-		libraryclient::LibraryClient::Ptr getLibraryClient();
-		Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
-
-		// managed widgets...
-		LibraryMainView              m_mainview;
-		Gtk::IconView                m_librarylistview;
-		Gtk::ScrolledWindow          m_scrollview;
-		// library split view
-		Gtk::HPaned                  m_lib_splitview;
-    fwk::Dock                   *m_dock;
-		MetaDataPaneController::Ptr  m_metapanecontroller;
-
-    darkroom::DarkroomModule::Ptr m_darkroom;
-
-		Glib::RefPtr<ImageListStore> m_model;
-};
-
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0))
-  indent-tabs-mode:nil
-  fill-column:80
-  End:
-*/
-
-#endif
diff --git a/src/niepce/ui/librarymainviewcontroller.hpp b/src/niepce/ui/librarymainviewcontroller.hpp
new file mode 100644
index 0000000..ea9e347
--- /dev/null
+++ b/src/niepce/ui/librarymainviewcontroller.hpp
@@ -0,0 +1,107 @@
+/*
+ * niepce - ui/librarymainviewcontroller.h
+ *
+ * Copyright (C) 2007-2008 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __UI_LIBRARYMAINVIEWCONTROLLER_H__
+#define __UI_LIBRARYMAINVIEWCONTROLLER_H__
+
+
+#include <gtkmm/iconview.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/treestore.h>
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/paned.h>
+
+#include "librarymainview.h"
+#include "engine/db/libfile.h"
+#include "libraryclient/libraryclient.h"
+#include "fwk/toolkit/controller.hpp"
+#include "fwk/toolkit/notification.hpp"
+#include "metadatapanecontroller.hpp"
+#include "selectioncontroller.hpp"
+#include "modules/darkroom/darkroommodule.h"
+#include "imageliststore.h"
+
+namespace Gtk {
+	class Widget;
+}
+namespace fwk {
+class Dock;
+}
+
+namespace ui {
+
+class LibraryMainViewController
+		: public fwk::Controller,
+		  public IImageSelectable
+{
+public:
+		typedef boost::shared_ptr<LibraryMainViewController> Ptr;
+		typedef boost::weak_ptr<LibraryMainViewController> WeakPtr;
+
+		LibraryMainViewController(const Glib::RefPtr<Gtk::ActionGroup> & actions,
+                              const Glib::RefPtr<ImageListStore> & store)
+        : m_actionGroup(actions),
+          m_model(store)
+        {
+        }
+
+		void on_lib_notification(const fwk::Notification::Ptr &);
+
+		/** called when somehing is selected by the shared selection */
+		void on_selected(int id);
+		void on_image_activated(int id);
+
+		virtual Gtk::IconView * image_list();
+		virtual int get_selected();
+		virtual void select_image(int id);
+protected:
+		virtual Gtk::Widget * buildWidget();
+		virtual void on_ready();
+private:
+		libraryclient::LibraryClient::Ptr getLibraryClient();
+		Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
+
+		// managed widgets...
+		LibraryMainView              m_mainview;
+		Gtk::IconView                m_librarylistview;
+		Gtk::ScrolledWindow          m_scrollview;
+		// library split view
+		Gtk::HPaned                  m_lib_splitview;
+    fwk::Dock                   *m_dock;
+		MetaDataPaneController::Ptr  m_metapanecontroller;
+
+    darkroom::DarkroomModule::Ptr m_darkroom;
+
+		Glib::RefPtr<ImageListStore> m_model;
+};
+
+}
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0))
+  indent-tabs-mode:nil
+  fill-column:80
+  End:
+*/
+
+#endif
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index d420c87..e63ddc3 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -44,11 +44,10 @@
 
 #include "eog-thumb-view.h"
 #include "niepcewindow.hpp"
-#include "librarymainviewcontroller.h"
 #include "dialogs/importdialog.hpp"
 #include "dialogs/preferencesdialog.hpp"
 #include "dialogs/editlabels.hpp"
-#include "selectioncontroller.h"
+#include "selectioncontroller.hpp"
 
 using libraryclient::LibraryClient;
 using fwk::Application;
@@ -256,22 +255,20 @@ void NiepceWindow::init_actions()
                                         &Application::quit));	
 
     m_refActionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
-    Glib::RefPtr<Gtk::Action> undo_action
-        = Gtk::Action::create("Undo", Gtk::Stock::UNDO);
-    m_refActionGroup->add(undo_action, Gtk::AccelKey("<control>Z"),
+    m_undo_action = Gtk::Action::create("Undo", Gtk::Stock::UNDO);
+    m_refActionGroup->add(m_undo_action, Gtk::AccelKey("<control>Z"),
                           boost::bind(&UndoHistory::undo,
                                       boost::ref(Application::app()->undo_history())));
-    m_undostate_conn = Application::app()->undo_history().changed.connect(
-        boost::bind(&NiepceWindow::undo_state, this, undo_action));
-    undo_state(undo_action);
-    Glib::RefPtr<Gtk::Action> redo_action
-        = Gtk::Action::create("Redo", Gtk::Stock::REDO);
-    m_refActionGroup->add(redo_action, Gtk::AccelKey("<control><shift>Z"),
+    Application::app()->undo_history().signal_changed.connect(
+        sigc::mem_fun(*this, &NiepceWindow::undo_state));
+    undo_state();
+    m_redo_action = Gtk::Action::create("Redo", Gtk::Stock::REDO);
+    m_refActionGroup->add(m_redo_action, Gtk::AccelKey("<control><shift>Z"),
                           boost::bind(&UndoHistory::redo,
                                       boost::ref(Application::app()->undo_history())));
-    m_redostate_conn = Application::app()->undo_history().changed.connect(
-        boost::bind(&NiepceWindow::redo_state, this, redo_action));
-    redo_state(redo_action);
+    Application::app()->undo_history().signal_changed.connect(
+        sigc::mem_fun(*this, &NiepceWindow::redo_state));
+    redo_state();
 
     // FIXME: bind
     m_refActionGroup->add(Gtk::Action::create("Cut", Gtk::Stock::CUT));
@@ -374,21 +371,21 @@ void NiepceWindow::init_actions()
                                 ->uiManager()->get_accel_group());
 }
 
-void NiepceWindow::undo_state(const Glib::RefPtr<Gtk::Action> & action)
+void NiepceWindow::undo_state()
 {
     fwk::UndoHistory & history(Application::app()->undo_history());
-    action->set_sensitive(history.has_undo());
+    m_undo_action->set_sensitive(history.has_undo());
     std::string s = history.next_undo();
-    action->property_label() = Glib::ustring(_("Undo ")) + s;
+    m_undo_action->property_label() = Glib::ustring(_("Undo ")) + s;
 }
 
 
-void NiepceWindow::redo_state(const Glib::RefPtr<Gtk::Action> & action)
+void NiepceWindow::redo_state()
 {
     fwk::UndoHistory & history(Application::app()->undo_history());
-    action->set_sensitive(history.has_redo());
+    m_redo_action->set_sensitive(history.has_redo());
     std::string s = history.next_redo();
-    action->property_label() = Glib::ustring(_("Redo ")) + s;
+    m_redo_action->property_label() = Glib::ustring(_("Redo ")) + s;
 }
 
 void NiepceWindow::on_action_file_import()
diff --git a/src/niepce/ui/niepcewindow.hpp b/src/niepce/ui/niepcewindow.hpp
index 86ea4fa..a76652c 100644
--- a/src/niepce/ui/niepcewindow.hpp
+++ b/src/niepce/ui/niepcewindow.hpp
@@ -22,7 +22,6 @@
 #define _UI_NIEPCEWINDOW_H_
 
 #include <boost/scoped_ptr.hpp>
-#include <boost/signals.hpp>
 
 #include <gtkmm/treemodel.h>
 #include <gtkmm/box.h>
@@ -35,10 +34,10 @@
 #include "fwk/toolkit/configdatabinder.hpp"
 #include "engine/db/label.hpp"
 #include "libraryclient/libraryclient.h"
-#include "ui/librarymainviewcontroller.h"
+#include "ui/librarymainviewcontroller.hpp"
 #include "ui/workspacecontroller.h"
-#include "ui/selectioncontroller.h"
-#include "ui/filmstripcontroller.h"
+#include "ui/selectioncontroller.hpp"
+#include "ui/filmstripcontroller.hpp"
 
 namespace fwk {
 	class NotificatioCenter;
@@ -62,8 +61,8 @@ protected:
     virtual Gtk::Widget * buildWidget();
 
 private:
-    void undo_state(const Glib::RefPtr<Gtk::Action> & action);
-    void redo_state(const Glib::RefPtr<Gtk::Action> & action);
+    void undo_state();
+    void redo_state();
 
     void on_action_file_import();
 
@@ -93,11 +92,10 @@ private:
     ui::SelectionController::Ptr   m_selection_controller;
     Gtk::Statusbar                 m_statusBar;
     Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
+    Glib::RefPtr<Gtk::Action>      m_undo_action;
+    Glib::RefPtr<Gtk::Action>      m_redo_action;
     libraryclient::LibraryClient::Ptr m_libClient;
     eng::Label::List               m_labels;
-    // connections
-    boost::signals::scoped_connection m_undostate_conn;
-    boost::signals::scoped_connection m_redostate_conn;
 };
 
 }
diff --git a/src/niepce/ui/selectioncontroller.cpp b/src/niepce/ui/selectioncontroller.cpp
index bb3b91c..8f6f5b9 100644
--- a/src/niepce/ui/selectioncontroller.cpp
+++ b/src/niepce/ui/selectioncontroller.cpp
@@ -30,7 +30,7 @@
 #include "engine/db/metadata.h"
 #include "libraryclient/libraryclient.h"
 #include "niepcewindow.hpp"
-#include "selectioncontroller.h"
+#include "selectioncontroller.hpp"
 
 namespace ui {
 
diff --git a/src/niepce/ui/selectioncontroller.h b/src/niepce/ui/selectioncontroller.h
deleted file mode 100644
index e80eb88..0000000
--- a/src/niepce/ui/selectioncontroller.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * niepce - ui/selectioncontroller.h
- *
- * Copyright (C) 2008 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _UI_SELECTIONCONTROLLER_H__
-#define _UI_SELECTIONCONTROLLER_H__
-
-#include <gtk/gtkiconview.h>
-
-#include <boost/signal.hpp>
-
-#include "fwk/toolkit/controller.hpp"
-#include "ui/imageliststore.h"
-
-namespace Gtk {
-	class IconView;
-	class Widget;
-}
-
-namespace ui {
-
-/** interface for selectable image. Make the controller
- *  inherit/implement it.
- */
-class IImageSelectable 
-{
-public:
-	virtual ~IImageSelectable() {}
-	virtual Gtk::IconView * image_list() = 0;
-    /** Return the id of the selection. <= 0 is none. */
-	virtual int get_selected() = 0;
-    /** select the image a specific id 
-     *  might emit the signals.
-     */
-	virtual void select_image(int id) = 0;
-};
-
-
-class SelectionController
-	: public fwk::Controller
-{
-public:
-	typedef boost::shared_ptr<SelectionController> Ptr;
-	SelectionController();
-
-	void add_selectable(IImageSelectable *);
-
-	void activated(const Gtk::TreeModel::Path & /*path*/,
-				   IImageSelectable * selectable);
-	void selected(IImageSelectable *);
-
-
-	const Glib::RefPtr<ImageListStore> & list_store() const
-		{ return m_imageliststore; }
-
-	// the signal to call when selection is changed.
-	boost::signal<void (int)> signal_selected;
-
-	// signal for when the item is activated (ie double-click)
-	boost::signal<void (int)> signal_activated;
-
-    /////////
-    /** select the previous image. Emit the signal */
-    void select_previous();
-    /** select the next image. Emit the signal */
-    void select_next();
-    /** rotate the image in selection by %angle (trigonometric) */
-    void rotate(int angle);
-    /** set the rating of selection to %rating. */
-    void set_rating(int rating);
-    /** set the label of selection to the label with index %label. */
-    void set_label(int label);
-protected:
-	virtual void _added();
-	virtual Gtk::Widget * buildWidget()
-		{ return NULL; }
-private:
-    int get_selection();
-    libraryclient::LibraryClient::Ptr getLibraryClient();
-
-    bool _set_metadata(const std::string & undo_label, 
-                       const db::LibFile::Ptr & file,
-                       int meta, int old_value, int new_value);
-    /** move the selection and emit the signal 
-     * @param backwards true if the move is backwards.
-     */
-    void _selection_move(bool backwards);
-
-	Glib::RefPtr<ImageListStore>  m_imageliststore;
-	bool m_in_handler;
-	std::vector<IImageSelectable *> m_selectables;
-};
-
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0))
-  indent-tabs-mode:nil
-  fill-column:80
-  End:
-*/
-
-#endif
diff --git a/src/niepce/ui/selectioncontroller.hpp b/src/niepce/ui/selectioncontroller.hpp
new file mode 100644
index 0000000..5efe902
--- /dev/null
+++ b/src/niepce/ui/selectioncontroller.hpp
@@ -0,0 +1,122 @@
+/*
+ * niepce - ui/selectioncontroller.h
+ *
+ * Copyright (C) 2008 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _UI_SELECTIONCONTROLLER_H__
+#define _UI_SELECTIONCONTROLLER_H__
+
+#include <gtk/gtkiconview.h>
+
+#include <sigc++/signal.h>
+
+#include "fwk/toolkit/controller.hpp"
+#include "ui/imageliststore.h"
+
+namespace Gtk {
+	class IconView;
+	class Widget;
+}
+
+namespace ui {
+
+/** interface for selectable image. Make the controller
+ *  inherit/implement it.
+ */
+class IImageSelectable 
+{
+public:
+	virtual ~IImageSelectable() {}
+	virtual Gtk::IconView * image_list() = 0;
+    /** Return the id of the selection. <= 0 is none. */
+	virtual int get_selected() = 0;
+    /** select the image a specific id 
+     *  might emit the signals.
+     */
+	virtual void select_image(int id) = 0;
+};
+
+
+class SelectionController
+	: public fwk::Controller
+{
+public:
+	typedef boost::shared_ptr<SelectionController> Ptr;
+	SelectionController();
+
+	void add_selectable(IImageSelectable *);
+
+	void activated(const Gtk::TreeModel::Path & /*path*/,
+				   IImageSelectable * selectable);
+	void selected(IImageSelectable *);
+
+
+	const Glib::RefPtr<ImageListStore> & list_store() const
+		{ return m_imageliststore; }
+
+	// the signal to call when selection is changed.
+    sigc::signal<void, int> signal_selected;
+
+	// signal for when the item is activated (ie double-click)
+    sigc::signal<void, int> signal_activated;
+
+    /////////
+    /** select the previous image. Emit the signal */
+    void select_previous();
+    /** select the next image. Emit the signal */
+    void select_next();
+    /** rotate the image in selection by %angle (trigonometric) */
+    void rotate(int angle);
+    /** set the rating of selection to %rating. */
+    void set_rating(int rating);
+    /** set the label of selection to the label with index %label. */
+    void set_label(int label);
+protected:
+	virtual void _added();
+	virtual Gtk::Widget * buildWidget()
+		{ return NULL; }
+private:
+    int get_selection();
+    libraryclient::LibraryClient::Ptr getLibraryClient();
+
+    bool _set_metadata(const std::string & undo_label, 
+                       const db::LibFile::Ptr & file,
+                       int meta, int old_value, int new_value);
+    /** move the selection and emit the signal 
+     * @param backwards true if the move is backwards.
+     */
+    void _selection_move(bool backwards);
+
+	Glib::RefPtr<ImageListStore>  m_imageliststore;
+	bool m_in_handler;
+	std::vector<IImageSelectable *> m_selectables;
+};
+
+}
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0))
+  indent-tabs-mode:nil
+  fill-column:80
+  End:
+*/
+
+#endif



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