[solang] Disabled the EditorRenderer



commit 3d1ff3496ac84393b5118cb9c2b89fc43d4a4b62
Author: Debarshi Ray <rishi gnu org>
Date:   Wed Jan 6 18:44:47 2010 +0200

    Disabled the EditorRenderer
    
    We will try to use the EnlargedRenderer for editing purposes.
    
    Since the BrowserRenderer will be the only one presented when the
    application starts, it will not be placed in a Gtk::Notebook by
    GDL. This breaks the current mechanism for finding the
    BrowserRenderer::pageNum_ and EnlargedRenderer::pageNum_. Now we do
    it cleanly by listening to the "parent-set" signal of the
    GdlDockItems.

 data/solang-browser-renderer-thumbnail.ui |    1 -
 data/solang-browser-renderer.ui           |    4 --
 src/application/application.cpp           |    4 --
 src/renderer/browser-renderer.cpp         |   60 +++++++++-------------
 src/renderer/browser-renderer.h           |    7 ++-
 src/renderer/enlarged-renderer.cpp        |   76 +++++++++++++++++------------
 src/renderer/enlarged-renderer.h          |    4 ++
 7 files changed, 78 insertions(+), 78 deletions(-)
---
diff --git a/data/solang-browser-renderer-thumbnail.ui b/data/solang-browser-renderer-thumbnail.ui
index 4a7c04d..b481daa 100644
--- a/data/solang-browser-renderer-thumbnail.ui
+++ b/data/solang-browser-renderer-thumbnail.ui
@@ -3,7 +3,6 @@
 	<popup name="ThumbnailPopup">
 		<placeholder name="PlaceholderEditPopup">
 		<menuitem action="ActionEditAddToExportQueue"/>
-		<menuitem action="ActionViewEdit"/>
 		</placeholder>
 		<placeholder name="PlaceholderFullScreenPopup">
 		<menuitem action="ActionViewBrowserSlideshow"/>
diff --git a/data/solang-browser-renderer.ui b/data/solang-browser-renderer.ui
index d21bd3d..67824da 100644
--- a/data/solang-browser-renderer.ui
+++ b/data/solang-browser-renderer.ui
@@ -8,7 +8,6 @@
 			<placeholder name="PlaceholderZoomMenus">
 			<menuitem action="ActionViewZoomIn"/>
 			<menuitem action="ActionViewZoomOut"/>
-			<menuitem action="ActionViewEdit"/>
 			</placeholder>
 		</menu>
 		<placeholder name="PlaceholderGoMenus">
@@ -22,9 +21,6 @@
 		</placeholder>
 	</menubar>
 	<toolbar name="ToolBar">
-		<placeholder name="PlaceholderGoToolBar">
-		<toolitem action="ActionViewEdit"/>
-		</placeholder>
 		<placeholder name="PlaceholderFullScreenToolBar">
 		<toolitem action="ActionViewBrowserSlideshow"/>
 		</placeholder>
diff --git a/src/application/application.cpp b/src/application/application.cpp
index baf8b55..6780428 100644
--- a/src/application/application.cpp
+++ b/src/application/application.cpp
@@ -36,7 +36,6 @@
 //#include "date-manager.h"
 #include "directory-destination.h"
 //#include "directory-source.h"
-#include "editor-renderer.h"
 #include "enlarged-renderer.h"
 #include "exporter.h"
 //#include "flickr-source.h"
@@ -327,9 +326,6 @@ Application::init() throw()
     IRendererPtr enlarged_renderer(new EnlargedRenderer());
     rendererRegistry_.add(enlarged_renderer);
 
-    IRendererPtr editor_renderer(new EditorRenderer());
-    rendererRegistry_.add(editor_renderer);
-
     IRendererPtr slideshow_renderer(new SlideshowRenderer());
     rendererRegistry_.add(slideshow_renderer);
 
diff --git a/src/renderer/browser-renderer.cpp b/src/renderer/browser-renderer.cpp
index a2bf331..84e2512 100644
--- a/src/renderer/browser-renderer.cpp
+++ b/src/renderer/browser-renderer.cpp
@@ -193,11 +193,6 @@ BrowserRenderer::BrowserRenderer() throw() :
                 scale_action));
     }
 
-    actionGroup_->add(Gtk::Action::create(
-        "ActionViewEdit", Gtk::Stock::EDIT, _("_Edit"),
-        _("Edit picture")), Gtk::AccelKey("<control>e"),
-        sigc::mem_fun(*this, &BrowserRenderer::on_item_edit));
-
     actionGroup_->add(
         Gtk::Action::create(
             "ActionMenuGo", _("_Go")));
@@ -236,6 +231,11 @@ BrowserRenderer::BrowserRenderer() throw() :
     gtk_container_add(GTK_CONTAINER(dockItem_),
                       GTK_WIDGET(vBox_.gobj()));
 
+    Gtk::Widget * const dock_item = Glib::wrap(dockItem_, false);
+    dock_item->signal_parent_changed().connect(
+        sigc::mem_fun(*this,
+                      &BrowserRenderer::on_dock_item_parent_changed));
+
     paginationBar_.limits_changed().connect(
         sigc::mem_fun(*this,
                       &BrowserRenderer::on_limits_changed));
@@ -455,12 +455,29 @@ BrowserRenderer::on_action_view_slideshow() throw()
 void
 BrowserRenderer::on_init_end(Application & application) throw()
 {
-    MainWindow & main_window = application.get_main_window();
-    Gtk::Notebook * notebook = main_window.get_notebook_center();
+    signalInitEnd_.disconnect();
+}
+
+void
+BrowserRenderer::on_selection_changed() throw()
+{
+    application_->get_engine().selection_changed().emit();
+}
+
+void
+BrowserRenderer::on_dock_item_parent_changed(
+                     Gtk::Widget * previous_parent) throw()
+{
+    signalSwitchPage_.disconnect();
+
+    Gtk::Widget * const parent = Glib::wrap(gtk_widget_get_parent(
+                                                dockItem_), false);
+    Gtk::Notebook * const notebook = dynamic_cast<Gtk::Notebook *>(
+                                         parent);
 
     if (0 == notebook)
     {
-        g_warning("0 == notebook");
+        pageNum_ = 0;
         return;
     }
 
@@ -470,14 +487,6 @@ BrowserRenderer::on_init_end(Application & application) throw()
         = notebook->signal_switch_page().connect(
               sigc::mem_fun(*this,
                             &BrowserRenderer::on_switch_page));
-
-    signalInitEnd_.disconnect();
-}
-
-void
-BrowserRenderer::on_selection_changed() throw()
-{
-    application_->get_engine().selection_changed().emit();
 }
 
 void
@@ -510,25 +519,6 @@ BrowserRenderer::on_item_activated(const Gtk::TreeModel::Path & path)
 }
 
 void
-BrowserRenderer::on_item_edit() throw()
-{
-    RendererRegistry & renderer_registry
-        = application_->get_renderer_registry();
-    const IRendererPtr editor_renderer
-        = renderer_registry.select<EditorRenderer>();
-
-    if (0 == editor_renderer)
-    {
-        return;
-    }
-
-    const PhotoList photos = thumbnailView_.get_selected_photos();
-
-    editor_renderer->render(photos);
-    editor_renderer->present();
-}
-
-void
 BrowserRenderer::on_limits_changed() throw()
 {
     set_thumbnail_size();
diff --git a/src/renderer/browser-renderer.h b/src/renderer/browser-renderer.h
index e185e3b..264112c 100644
--- a/src/renderer/browser-renderer.h
+++ b/src/renderer/browser-renderer.h
@@ -99,6 +99,10 @@ class BrowserRenderer :
                                 throw();
 
         void
+        on_dock_item_parent_changed(Gtk::Widget * previous_parent)
+                                    throw();
+
+        void
         on_item_activated(const Gtk::TreeModel::Path & path) throw();
 
         void
@@ -119,9 +123,6 @@ class BrowserRenderer :
                    throw();
 
         void
-        on_item_edit() throw();
-
-        void
         reload() throw();
 
         void
diff --git a/src/renderer/enlarged-renderer.cpp b/src/renderer/enlarged-renderer.cpp
index 9ec35ee..32c6eb4 100644
--- a/src/renderer/enlarged-renderer.cpp
+++ b/src/renderer/enlarged-renderer.cpp
@@ -738,6 +738,31 @@ EnlargedRenderer::on_action_view_zoom_out() throw()
 }
 
 void
+EnlargedRenderer::on_dock_item_parent_changed(
+                      Gtk::Widget * previous_parent) throw()
+{
+    signalSwitchPage_.disconnect();
+
+    Gtk::Widget * const parent = Glib::wrap(gtk_widget_get_parent(
+                                                dockItem_), false);
+    Gtk::Notebook * const notebook = dynamic_cast<Gtk::Notebook *>(
+                                         parent);
+
+    if (0 == notebook)
+    {
+        pageNum_ = 0;
+        return;
+    }
+
+    pageNum_ = notebook->page_num(*Glib::wrap(dockItem_, false));
+
+    signalSwitchPage_
+        = notebook->signal_switch_page().connect(
+              sigc::mem_fun(*this,
+                            &EnlargedRenderer::on_switch_page));
+}
+
+void
 EnlargedRenderer::on_list_store_change_end(Application & application)
                                            throw()
 {
@@ -838,25 +863,33 @@ EnlargedRenderer::prepare_for_first_use() throw()
         return;
     }
 
+    MainWindow & main_window = application_->get_main_window();
+    const UIManagerPtr & ui_manager = main_window.get_ui_manager();
+
+    uiID_ = ui_manager->add_ui_from_file(uiFile);
+    if (0 == uiID_)
+    {
+        // FIXME: error condition.
+    }
+
+    create_action_group();
+    if (true == actionGroup_)
+    {
+        ui_manager->insert_action_group(actionGroup_);
+    }
+
     dockItem_ = gdl_dock_item_new_with_stock(
                     dockItemName_.c_str(),
                     dockItemTitle_.c_str(),
                     PACKAGE_TARNAME"-mode-image-edit",
                     dockItemBehaviour_);
 
-    MainWindow & main_window = application_->get_main_window();
-    main_window.dock_object_center(GDL_DOCK_OBJECT(dockItem_));
-
-    Gtk::Notebook * const notebook
-                              = main_window.get_notebook_center();
-
-    if (0 == notebook)
-    {
-        g_warning("0 == notebook");
-        return;
-    }
+    Gtk::Widget * const dock_item = Glib::wrap(dockItem_, false);
+    dock_item->signal_parent_changed().connect(
+        sigc::mem_fun(*this,
+                      &EnlargedRenderer::on_dock_item_parent_changed));
 
-    pageNum_ = notebook->page_num(*Glib::wrap(dockItem_, false));
+    main_window.dock_object_center(GDL_DOCK_OBJECT(dockItem_));
 
     signalMainWindowStateEvent_
         = main_window.signal_window_state_event().connect(
@@ -864,30 +897,11 @@ EnlargedRenderer::prepare_for_first_use() throw()
                   *this,
                   &EnlargedRenderer::on_main_window_state_event));
 
-    signalSwitchPage_
-        = notebook->signal_switch_page().connect(
-              sigc::mem_fun(*this,
-                            &EnlargedRenderer::on_switch_page));
-
     signalListStoreChangeEnd_
         = application_->list_store_change_end().connect(
               sigc::mem_fun(*this,
                             &EnlargedRenderer::on_list_store_change_end));
 
-    const UIManagerPtr & ui_manager = main_window.get_ui_manager();
-
-    uiID_ = ui_manager->add_ui_from_file(uiFile);
-    if (0 == uiID_)
-    {
-        // FIXME: error condition.
-    }
-
-    create_action_group();
-    if (true == actionGroup_)
-    {
-        ui_manager->insert_action_group(actionGroup_);
-    }
-
     RendererRegistry & renderer_registry
         = application_->get_renderer_registry();
     const IRendererPtr enlarged_renderer
diff --git a/src/renderer/enlarged-renderer.h b/src/renderer/enlarged-renderer.h
index e53af0d..69fe98c 100644
--- a/src/renderer/enlarged-renderer.h
+++ b/src/renderer/enlarged-renderer.h
@@ -103,6 +103,10 @@ class EnlargedRenderer :
         on_action_view_zoom_out() throw();
 
         void
+        on_dock_item_parent_changed(Gtk::Widget * previous_parent)
+                                    throw();
+
+        void
         on_list_store_change_end(Application & application) throw();
 
         bool



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