[niepce] Allow setting the rating from the gridview.



commit ce996c379c580e23b31f31772578c4eda92a67e7
Author: Hub Figuiere <hub figuiere net>
Date:   Sat Oct 29 09:35:18 2011 -0700

    Allow setting the rating from the gridview.

 src/fwk/toolkit/widgets/ratinglabel.cpp |   15 ++-
 src/fwk/toolkit/widgets/ratinglabel.hpp |    3 +-
 src/niepce/ui/gridviewmodule.cpp        |   12 +-
 src/niepce/ui/gridviewmodule.hpp        |    7 +-
 src/niepce/ui/librarycellrenderer.cpp   |  272 ++++++++++++++++++-------------
 src/niepce/ui/librarycellrenderer.hpp   |  101 ++++++------
 src/niepce/ui/moduleshell.cpp           |    2 +-
 src/niepce/ui/moduleshell.hpp           |   34 ++--
 8 files changed, 259 insertions(+), 187 deletions(-)
---
diff --git a/src/fwk/toolkit/widgets/ratinglabel.cpp b/src/fwk/toolkit/widgets/ratinglabel.cpp
index a42c965..5662bd5 100644
--- a/src/fwk/toolkit/widgets/ratinglabel.cpp
+++ b/src/fwk/toolkit/widgets/ratinglabel.cpp
@@ -78,10 +78,17 @@ void RatingLabel::draw_rating(const Cairo::RefPtr<Cairo::Context> & cr,
     }
 }
 
-int RatingLabel::rating_value_from_hit_x(const Cairo::RefPtr<Cairo::ImageSurface> & star, double x)
+
+void RatingLabel::get_geometry(double & w, double & h)
+{
+  w = get_star()->get_width() * 5;
+  h = get_star()->get_height();
+}
+
+int RatingLabel::rating_value_from_hit_x(double x)
 {
-    int width = star->get_width();
-    return (x / width) + 1;
+  int width = get_star()->get_width();
+  return (x / width) + 1;
 }
 
 RatingLabel::RatingLabel(int rating)
@@ -128,7 +135,7 @@ void RatingLabel::on_realize()
 bool RatingLabel::on_button_press_event (GdkEventButton* e)
 {
   if(e->button == 1) {
-    int new_rating =  rating_value_from_hit_x(get_star(), e->x);
+    int new_rating =  rating_value_from_hit_x(e->x);
     DBG_OUT("new rating = %d", new_rating);
 
     if(new_rating != m_rating) {
diff --git a/src/fwk/toolkit/widgets/ratinglabel.hpp b/src/fwk/toolkit/widgets/ratinglabel.hpp
index 813964d..2b1b007 100644
--- a/src/fwk/toolkit/widgets/ratinglabel.hpp
+++ b/src/fwk/toolkit/widgets/ratinglabel.hpp
@@ -47,7 +47,8 @@ public:
 			  const Cairo::RefPtr<Cairo::ImageSurface> & star,
 			  const Cairo::RefPtr<Cairo::ImageSurface> & unstar,
 			  double x, double y);
-  static int rating_value_from_hit_x(const Cairo::RefPtr<Cairo::ImageSurface> & star, double x);
+  static void get_geometry(double & w, double & h);
+  static int rating_value_from_hit_x(double x);
 
   // signal emitted when the rating is changed in the UI
   sigc::signal<void, int> signal_changed;
diff --git a/src/niepce/ui/gridviewmodule.cpp b/src/niepce/ui/gridviewmodule.cpp
index 62c5755..d89c656 100644
--- a/src/niepce/ui/gridviewmodule.cpp
+++ b/src/niepce/ui/gridviewmodule.cpp
@@ -27,15 +27,16 @@
 #include "fwk/toolkit/configdatabinder.hpp"
 #include "fwk/toolkit/widgets/dock.hpp"
 #include "gridviewmodule.hpp"
+#include "moduleshell.hpp"
 #include "librarycellrenderer.hpp"
 
 
 namespace ui {
 
 
-GridViewModule::GridViewModule(const sigc::slot<libraryclient::LibraryClient::Ptr> & getclient,
+GridViewModule::GridViewModule(ModuleShell* shell,
                                const Glib::RefPtr<ImageListStore> & store)
-  : m_getclient(getclient)
+  : m_shell(shell)
   , m_model(store)
 {
 }
@@ -58,7 +59,7 @@ GridViewModule::on_lib_notification(const eng::LibNotification &ln)
         std::tr1::array<int, 3> m = boost::any_cast<std::tr1::array<int, 3> >(ln.param);
         if(m[0] == m_metapanecontroller->displayed_file()) {
             // FIXME: actually just update the metadata
-          m_getclient()->requestMetadata(m[0]);
+          m_shell->getLibraryClient()->requestMetadata(m[0]);
         }
         break;
     }
@@ -89,6 +90,7 @@ Gtk::Widget * GridViewModule::buildWidget(const Glib::RefPtr<Gtk::UIManager> & m
 
   // the main cell
   LibraryCellRenderer * libcell = Gtk::manage(new LibraryCellRenderer());
+  libcell->signal_rating_changed.connect(sigc::mem_fun(*this, &GridViewModule::on_rating_changed));
 
   GtkCellLayout *cl = GTK_CELL_LAYOUT(m_librarylistview.gobj());
   DBG_ASSERT(cl, "No cell layout");
@@ -162,6 +164,10 @@ void GridViewModule::select_image(int id)
     }
 }
 
+void GridViewModule::on_rating_changed(int id, int rating)
+{
+    m_shell->get_selection_controller()->set_rating(rating);
+}
 
 }
 /*
diff --git a/src/niepce/ui/gridviewmodule.hpp b/src/niepce/ui/gridviewmodule.hpp
index ea808e3..3be50e7 100644
--- a/src/niepce/ui/gridviewmodule.hpp
+++ b/src/niepce/ui/gridviewmodule.hpp
@@ -39,6 +39,7 @@ class Dock;
 
 namespace ui {
 
+class ModuleShell;
 
 class GridViewModule
     : public ILibraryModule
@@ -47,7 +48,7 @@ class GridViewModule
 public:
   typedef std::tr1::shared_ptr<GridViewModule> Ptr;
 
-  GridViewModule(const sigc::slot<libraryclient::LibraryClient::Ptr> & getclient,
+  GridViewModule(ModuleShell *shell,
                  const Glib::RefPtr<ImageListStore> & store);
 
 
@@ -67,7 +68,9 @@ protected:
 
 
 private:
-  sigc::slot<libraryclient::LibraryClient::Ptr> m_getclient;
+  void on_rating_changed(int id, int rating);
+
+  ModuleShell                 *m_shell;
   Glib::RefPtr<ImageListStore> m_model;
 
   // library split view
diff --git a/src/niepce/ui/librarycellrenderer.cpp b/src/niepce/ui/librarycellrenderer.cpp
index 7ad2ca5..f543a5b 100644
--- a/src/niepce/ui/librarycellrenderer.cpp
+++ b/src/niepce/ui/librarycellrenderer.cpp
@@ -28,19 +28,22 @@
 #error DATADIR is not defined
 #endif
 
+#define CELL_PADDING 4
+
 namespace ui {
 
 LibraryCellRenderer::LibraryCellRenderer()
-	: Glib::ObjectBase(typeid(LibraryCellRenderer)),
-	  Gtk::CellRendererPixbuf(),
-    m_size(160),
-    m_pad(16),
-    m_drawborder(true),
-    m_drawemblem(true),
-    m_drawrating(true),
-	  m_libfileproperty(*this, "libfile")
+    : Glib::ObjectBase(typeid(LibraryCellRenderer)),
+      Gtk::CellRendererPixbuf(),
+      m_size(160),
+      m_pad(16),
+      m_drawborder(true),
+      m_drawemblem(true),
+      m_drawrating(true),
+      m_libfileproperty(*this, "libfile")
 {
-	try {
+    property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
+    try {
         m_raw_format_emblem 
             = Cairo::ImageSurface::create_from_png(
                 std::string(DATADIR"/niepce/pixmaps/niepce-raw-fmt.png"));
@@ -56,18 +59,14 @@ LibraryCellRenderer::LibraryCellRenderer()
         m_unknown_format_emblem 
             = Cairo::ImageSurface::create_from_png(
                 std::string(DATADIR"/niepce/pixmaps/niepce-unknown-fmt.png"));
-        
-	}
-	catch(const std::exception & e)
-	{
-            ERR_OUT("exception while creating emblems: %s", e.what());
-            ERR_OUT("a - check if all the needed pixmaps are present in the filesystem");
-	}
-    catch(...)
-    {
+    }
+    catch(const std::exception & e) {
+        ERR_OUT("exception while creating emblems: %s", e.what());
+        ERR_OUT("a - check if all the needed pixmaps are present in the filesystem");
+    }
+    catch(...) {
         ERR_OUT("uncatched exception");
     }
-        
 }
 
 
@@ -116,8 +115,8 @@ void drawFormatEmblem(const Cairo::RefPtr<Cairo::Context> & cr,
         w = emblem->get_width();
         h = emblem->get_height();
         double x, y;
-        x = r.x + r.width - 4 - w;
-        y = r.y + r.height - 4 - h;
+        x = r.x + r.width - CELL_PADDING - w;
+        y = r.y + r.height - CELL_PADDING - h;
         cr->set_source(emblem, x, y);
         cr->paint();
     }
@@ -128,119 +127,170 @@ void drawFormatEmblem(const Cairo::RefPtr<Cairo::Context> & cr,
 
 
 void 
-LibraryCellRenderer::get_size_vfunc (Gtk::Widget& /*widget*/, 
-									 const Gdk::Rectangle* /*cell_area*/, 
-									 int* x_offset, int* y_offset, 
-									 int* width, int* height) const
+LibraryCellRenderer::get_size_vfunc(Gtk::Widget& /*widget*/, 
+                                    const Gdk::Rectangle* /*cell_area*/, 
+                                    int* x_offset, int* y_offset, 
+                                    int* width, int* height) const
 {
-	if(x_offset)
-		*x_offset = 0;
-	if(y_offset)
-		*y_offset = 0;
-
-	if(width || height) {
-		// TODO this should just be a property
-		//
-		Glib::RefPtr<Gdk::Pixbuf> pixbuf = property_pixbuf();
-		int maxdim = m_size + pad() * 2;
-		
-		if(width) 
-			*width = maxdim;
-		if(height) 
-			*height = maxdim;
-	}
+    if(x_offset) {
+        *x_offset = 0;
+    }
+    if(y_offset) {
+        *y_offset = 0;
+    }
+    
+    if(width || height) {
+        // TODO this should just be a property
+        //
+        Glib::RefPtr<Gdk::Pixbuf> pixbuf = property_pixbuf();
+        int maxdim = m_size + pad() * 2;
+	
+        if(width) {
+            *width = maxdim;
+        }
+        if(height) {
+            *height = maxdim;
+        }
+    }
 }
 
 
 void 
-LibraryCellRenderer::render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, 
-								   Gtk::Widget& widget, 
-								   const Gdk::Rectangle& /*background_area*/, 
-								   const Gdk::Rectangle& cell_area, 
-								   const Gdk::Rectangle& /*expose_area*/, 
-								   Gtk::CellRendererState flags)
+LibraryCellRenderer::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, 
+                                  Gtk::Widget& widget, 
+                                  const Gdk::Rectangle& /*background_area*/, 
+                                  const Gdk::Rectangle& cell_area, 
+                                  const Gdk::Rectangle& /*expose_area*/, 
+                                  Gtk::CellRendererState flags)
 {
-	unsigned int xpad = Gtk::CellRenderer::property_xpad();
-	unsigned int ypad = Gtk::CellRenderer::property_ypad();
-	
-	Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
-	GdkRectangle r = *(cell_area.gobj());
-	r.x += xpad;
-	r.y += ypad;
-
-	eng::LibFile::Ptr file = m_libfileproperty.get_value();
-
-	Gdk::Color color;
-	if(flags & Gtk::CELL_RENDERER_SELECTED) {
-		color = widget.get_style()->get_bg(Gtk::STATE_SELECTED);
-	}
-	else {
-		color = widget.get_style()->get_bg(Gtk::STATE_NORMAL);
-	}
+    unsigned int xpad = Gtk::CellRenderer::property_xpad();
+    unsigned int ypad = Gtk::CellRenderer::property_ypad();
+    
+    Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
+    GdkRectangle r = *(cell_area.gobj());
+    r.x += xpad;
+    r.y += ypad;
+    
+    eng::LibFile::Ptr file = m_libfileproperty.get_value();
+    
+    Gdk::Color color;
+    if(flags & Gtk::CELL_RENDERER_SELECTED) {
+        color = widget.get_style()->get_bg(Gtk::STATE_SELECTED);
+    }
+    else {
+        color = widget.get_style()->get_bg(Gtk::STATE_NORMAL);
+    }
+    
+    Gdk::Cairo::set_source_color(cr, color);
+    cr->rectangle(r.x, r.y, r.width, r.height);
+    cr->fill();
+    
+    if(m_drawborder) {
+        color = widget.get_style()->get_dark(Gtk::STATE_SELECTED);
+        Gdk::Cairo::set_source_color(cr, color);
+        cr->set_line_width(1.0);
+        cr->rectangle(r.x, r.y, r.width, r.height);
+        cr->stroke();
+    }
+    
+    Glib::RefPtr<Gdk::Pixbuf> pixbuf = property_pixbuf();
+    _drawThumbnail(cr, pixbuf, r);
+    if(m_drawrating) {
+        double x, y;
+        x = r.x + CELL_PADDING;
+        y = r.y + r.height - CELL_PADDING;
+        fwk::RatingLabel::draw_rating(cr, file->rating(), 
+                                      fwk::RatingLabel::get_star(), 
+                                      fwk::RatingLabel::get_unstar(), x, y);
+    }
+    
+    if(m_drawemblem) {
+        Cairo::RefPtr<Cairo::ImageSurface> emblem;
+        
+        switch(file->fileType()) {
+        case eng::LibFile::FILE_TYPE_RAW:
+            emblem = m_raw_format_emblem;
+            break;
+        case eng::LibFile::FILE_TYPE_RAW_JPEG:
+            emblem = m_rawjpeg_format_emblem;
+            break;
+        case eng::LibFile::FILE_TYPE_IMAGE:
+            emblem = m_img_format_emblem;
+            break;
+        case eng::LibFile::FILE_TYPE_VIDEO:
+            emblem = m_video_format_emblem;
+            break;
+        default:
+            emblem = m_unknown_format_emblem;
+            break;
+        }
+        
+        drawFormatEmblem(cr, emblem, r);
+    }
+}
 
-	Gdk::Cairo::set_source_color(cr, color);
-	cr->rectangle(r.x, r.y, r.width, r.height);
-	cr->fill();
 
-  if(m_drawborder) {
-      color = widget.get_style()->get_dark(Gtk::STATE_SELECTED);
-      Gdk::Cairo::set_source_color(cr, color);
-      cr->set_line_width(1.0);
-      cr->rectangle(r.x, r.y, r.width, r.height);
-      cr->stroke();
-  }
+bool LibraryCellRenderer::activate_vfunc(GdkEvent *event,
+                                         Gtk::Widget & widget,
+                                         const Glib::ustring &	path,
+                                         const Gdk::Rectangle&	background_area,
+                                         const Gdk::Rectangle&	cell_area,
+                                         Gtk::CellRendererState	flags)
+{
+    DBG_OUT("activated. Event type of %d", event->type);
+    if(event->type == GDK_BUTTON_PRESS) {
+        GdkEventButton *bevt = (GdkEventButton*)event;
 
-  Glib::RefPtr<Gdk::Pixbuf> pixbuf = property_pixbuf();
-  _drawThumbnail(cr, pixbuf, r);
-  if(m_drawrating) {
-      double x, y;
-      x = r.x + 4;
-      y = r.y + r.height - 4;
-      fwk::RatingLabel::draw_rating(cr, file->rating(), 
-                                    fwk::RatingLabel::get_star(), 
-                                    fwk::RatingLabel::get_unstar(), x, y);
-  }
+        // hit test with the rating region
+        unsigned int xpad = Gtk::CellRenderer::property_xpad();
+        unsigned int ypad = Gtk::CellRenderer::property_ypad();
+        GdkRectangle r = *(cell_area.gobj());
+        r.x += xpad;
+        r.y += ypad;
 
-  if(m_drawemblem) {
-    Cairo::RefPtr<Cairo::ImageSurface> emblem;
-    
-//    DBG_OUT("the filetype: %i", file->fileType());
-    
-    switch(file->fileType()) {
-    case eng::LibFile::FILE_TYPE_RAW:
-        emblem = m_raw_format_emblem;
-        break;
-    case eng::LibFile::FILE_TYPE_RAW_JPEG:
-        emblem = m_rawjpeg_format_emblem;
-        break;
-    case eng::LibFile::FILE_TYPE_IMAGE:
-        emblem = m_img_format_emblem;
-        break;
-    case eng::LibFile::FILE_TYPE_VIDEO:
-        emblem = m_video_format_emblem;
-        break;
-    default:
-        emblem = m_unknown_format_emblem;
-        break;
+        double x, y;
+        double rw, rh;
+        fwk::RatingLabel::get_geometry(rw, rh);
+        GdkRectangle rect;
+        rect.x = r.x + CELL_PADDING;
+        rect.y = r.y + r.height - rh - CELL_PADDING;
+        rect.width = rw;
+        rect.height = rh;
+        x = bevt->x;
+        y = bevt->y;
+        DBG_OUT("r(%d, %d, %d, %d) p(%f, %f)", rect.x, rect.y,
+                rect.width, rect.height, x, y);
+        bool hit = (rect.x <= x) && (rect.x + rect.width >= x) 
+            && (rect.y <= y) && (rect.y + rect.height >= y);
+        if(!hit) {
+            DBG_OUT("not a hit");
+            return false;
+        }
+        // hit test for the rating value
+        int new_rating = fwk::RatingLabel::rating_value_from_hit_x(x - rect.x);
+        DBG_OUT("new_rating %d", new_rating);
+        eng::LibFile::Ptr file = m_libfileproperty.get_value();
+        if(file->rating() != new_rating) {
+            // emit if changed
+            signal_rating_changed.emit(file->id(), new_rating);
+        }
+        return true;
     }
-
-    drawFormatEmblem(cr, emblem, r);
-  }
+    return false;
 }
 
 
-
 Glib::PropertyProxy_ReadOnly<eng::LibFile::Ptr> 	
 LibraryCellRenderer::property_libfile() const
 {
-	return Glib::PropertyProxy_ReadOnly<eng::LibFile::Ptr>(this, "libfile");
+    return Glib::PropertyProxy_ReadOnly<eng::LibFile::Ptr>(this, "libfile");
 }
 
 
 Glib::PropertyProxy<eng::LibFile::Ptr> 	
 LibraryCellRenderer::property_libfile()
 {
-	return Glib::PropertyProxy<eng::LibFile::Ptr>(this, "libfile");
+    return Glib::PropertyProxy<eng::LibFile::Ptr>(this, "libfile");
 }
 
 
diff --git a/src/niepce/ui/librarycellrenderer.hpp b/src/niepce/ui/librarycellrenderer.hpp
index 6f1e414..cc37954 100644
--- a/src/niepce/ui/librarycellrenderer.hpp
+++ b/src/niepce/ui/librarycellrenderer.hpp
@@ -33,57 +33,62 @@ class LibraryCellRenderer
 	: public Gtk::CellRendererPixbuf
 {
 public:
-	LibraryCellRenderer();
-
-	virtual void 	get_size_vfunc (Gtk::Widget& widget, 
-									const Gdk::Rectangle* cell_area, 
-									int* x_offset, int* y_offset, 
-									int* width, int* height) const;
-	virtual void 	render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, 
-								  Gtk::Widget& widget, 
-								  const Gdk::Rectangle& background_area, 
-								  const Gdk::Rectangle& cell_area, 
-								  const Gdk::Rectangle& expose_area, 
-								  Gtk::CellRendererState flags);
-
-  void set_size(int _size)
-    { m_size = _size; }
-  int size() const
-    { return m_size; }
-
-  void set_pad(int _pad)
-    { m_pad = _pad; }
-  int pad() const 
-    { return m_pad; }
-  void set_drawborder(bool val)
-    { m_drawborder = val; }
-  void set_drawemblem(bool val)
-    { m_drawemblem = val; }
-  void set_drawrating(bool val)
-    { m_drawrating = val; }
-
-	Glib::PropertyProxy_ReadOnly<eng::LibFile::Ptr> 	property_libfile() const;
-	Glib::PropertyProxy<eng::LibFile::Ptr> 	property_libfile();
-
+    LibraryCellRenderer();
+    
+    virtual void get_size_vfunc(Gtk::Widget& widget, 
+                                const Gdk::Rectangle* cell_area, 
+                                int* x_offset, int* y_offset, 
+                                int* width, int* height) const;
+    virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
+                               Gtk::Widget& widget, 
+                               const Gdk::Rectangle& background_area, 
+                               const Gdk::Rectangle& cell_area, 
+                               const Gdk::Rectangle& expose_area, 
+                               Gtk::CellRendererState flags);
+    virtual bool activate_vfunc(GdkEvent *event,
+                                Gtk::Widget & widget,
+                                const Glib::ustring &	path,
+                                const Gdk::Rectangle&	background_area,
+                                const Gdk::Rectangle&	cell_area,
+                                Gtk::CellRendererState	flags);
+    void set_size(int _size)
+        { m_size = _size; }
+    int size() const
+        { return m_size; }
+    
+    void set_pad(int _pad)
+        { m_pad = _pad; }
+    int pad() const 
+        { return m_pad; }
+    void set_drawborder(bool val)
+        { m_drawborder = val; }
+    void set_drawemblem(bool val)
+        { m_drawemblem = val; }
+    void set_drawrating(bool val)
+        { m_drawrating = val; }
+
+    Glib::PropertyProxy_ReadOnly<eng::LibFile::Ptr> property_libfile() const;
+    Glib::PropertyProxy<eng::LibFile::Ptr>          property_libfile();
+    sigc::signal<void, int, int> signal_rating_changed;
 protected:
-  /* drawing implementations */
-  void _drawThumbnail(const Cairo::RefPtr<Cairo::Context> & cr, 
-                      Glib::RefPtr<Gdk::Pixbuf> & pixbuf,
-                      const GdkRectangle & r);
+    /* drawing implementations */
+    void _drawThumbnail(const Cairo::RefPtr<Cairo::Context> & cr, 
+                        Glib::RefPtr<Gdk::Pixbuf> & pixbuf,
+                        const GdkRectangle & r);
 
 private:
-  int                                 m_size;
-  int                                 m_pad;
-  bool                                m_drawborder;
-  bool                                m_drawemblem;
-  bool                                m_drawrating;
-	Glib::Property<eng::LibFile::Ptr>   m_libfileproperty;
-
-	Cairo::RefPtr<Cairo::ImageSurface>  m_raw_format_emblem;
-	Cairo::RefPtr<Cairo::ImageSurface>  m_rawjpeg_format_emblem;
-	Cairo::RefPtr<Cairo::ImageSurface>  m_img_format_emblem;
-	Cairo::RefPtr<Cairo::ImageSurface>  m_video_format_emblem;
-	Cairo::RefPtr<Cairo::ImageSurface>  m_unknown_format_emblem;
+    int                                 m_size;
+    int                                 m_pad;
+    bool                                m_drawborder;
+    bool                                m_drawemblem;
+    bool                                m_drawrating;
+    Glib::Property<eng::LibFile::Ptr>   m_libfileproperty;
+    
+    Cairo::RefPtr<Cairo::ImageSurface>  m_raw_format_emblem;
+    Cairo::RefPtr<Cairo::ImageSurface>  m_rawjpeg_format_emblem;
+    Cairo::RefPtr<Cairo::ImageSurface>  m_img_format_emblem;
+    Cairo::RefPtr<Cairo::ImageSurface>  m_video_format_emblem;
+    Cairo::RefPtr<Cairo::ImageSurface>  m_unknown_format_emblem;
 };
 
 
diff --git a/src/niepce/ui/moduleshell.cpp b/src/niepce/ui/moduleshell.cpp
index 90c19fc..dea1e5c 100644
--- a/src/niepce/ui/moduleshell.cpp
+++ b/src/niepce/ui/moduleshell.cpp
@@ -168,7 +168,7 @@ Gtk::Widget * ModuleShell::buildWidget(const Glib::RefPtr<Gtk::UIManager> & mana
     DBG_ASSERT(m_ui_merge_id, "merge failed");
 
     m_gridview = GridViewModule::Ptr(
-        new GridViewModule(m_getclient, 
+        new GridViewModule(this,
                            m_selection_controller->get_list_store()));
     add_library_module(m_gridview, _("Library"));
 
diff --git a/src/niepce/ui/moduleshell.hpp b/src/niepce/ui/moduleshell.hpp
index d65770e..ded9f76 100644
--- a/src/niepce/ui/moduleshell.hpp
+++ b/src/niepce/ui/moduleshell.hpp
@@ -38,13 +38,13 @@ namespace Gtk {
 namespace ui {
 
 class ModuleShell
-		: public fwk::UiController
+    : public fwk::UiController
 {
 public:
-		typedef std::tr1::shared_ptr<ModuleShell> Ptr;
-		typedef std::tr1::weak_ptr<ModuleShell> WeakPtr;
-
-		ModuleShell(const sigc::slot<libraryclient::LibraryClient::Ptr> get_client)
+    typedef std::tr1::shared_ptr<ModuleShell> Ptr;
+    typedef std::tr1::weak_ptr<ModuleShell> WeakPtr;
+    
+    ModuleShell(const sigc::slot<libraryclient::LibraryClient::Ptr> get_client)
         : m_getclient(get_client)
         , m_actionGroup(Gtk::ActionGroup::create("ModuleShell"))
         {
@@ -68,23 +68,23 @@ public:
             return m_getclient();
         }
 
-		/** called when somehing is selected by the shared selection */
-		void on_selected(int id);
-		void on_image_activated(int id);
-
-		virtual Gtk::Widget * buildWidget(const Glib::RefPtr<Gtk::UIManager> & manager);
+    /** called when somehing is selected by the shared selection */
+    void on_selected(int id);
+    void on_image_activated(int id);
+    
+    virtual Gtk::Widget * buildWidget(const Glib::RefPtr<Gtk::UIManager> & manager);
 protected:
     virtual void add_library_module(const ILibraryModule::Ptr & module,
                                     const std::string & label);
-		virtual void on_ready();
+    virtual void on_ready();
 private:
-		sigc::slot<libraryclient::LibraryClient::Ptr> m_getclient;
-		Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
-
-		// managed widgets...
-		ModuleShellWidget             m_shell;
+    sigc::slot<libraryclient::LibraryClient::Ptr> m_getclient;
+    Glib::RefPtr<Gtk::ActionGroup> m_actionGroup;
+    
+    // managed widgets...
+    ModuleShellWidget             m_shell;
     Glib::RefPtr<Gtk::UIManager>  m_ui_manager;
-
+    
     ui::SelectionController::Ptr  m_selection_controller;
     GridViewModule::Ptr           m_gridview;
     darkroom::DarkroomModule::Ptr m_darkroom;



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