[nemiver] 672409 - activate correct views in static layouts



commit e1683034407681032ed38b1649124c5915248858
Author: Fabien Parent <parent f gmail com>
Date:   Mon Mar 19 19:34:43 2012 +0100

    672409 - activate correct views in static layouts
    
    	* src/uicommon/nmv-layout.h (Layout::append_view): Renamed
    	add_view into this.  Updated comment.
    	* src/persp/dbgperspective/nmv-dbg-perspective-default-layout.h
    	(DBGPerspectiveDefaultLayout::append_view): Renamed add_view into
    	this.
    	* src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
    	(DBGPerspectiveDefaultLayout::activate_view): Set the current page
    	of the notebook to the page number of the widget to activate
    	instead of its ID
    	(DBGPerspectiveDefaultLayout::append_view): Renamed add_view into
    	this.  Append the widget instead of trying to put it at specific
    	position in the notebook
    	* src/persp/dbgperspective/nmv-dbg-perspective-dynamic-layout.h
    	(DBGPerspectiveDynamicLayout::append_view): Renamed add_view into
    	this.
    	* src/persp/dbgperspective/nmv-dbg-perspective-dynamic-layout.cc
    	(DBGPerspectiveDynamicLayout::append_view): Likewise.
    	* src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.h
    	(DBGPerspectiveTwoPaneLayout::activate_view): Renamed add_view
    	into this.
    	* src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
    	(DBGPerspectiveTwoPaneLayout::activate_view): Fix wrong assertion
    	(DBGPerspectiveTwoPaneLayout::append_view): Renamed add_view into
    	this.  Append the widget instead of trying to put it at a specific
    	position in the notebook.
    	* src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.h
    	(DBGPerspectiveWideLayout::append_view): Renamed add_view into
    	this.
    	* src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
    	(DBGPerspectiveWideLayout::activate_view): Set the current page of the
    	notebook to the page number of the widget to activate instead of its ID
    	(DBGPerspectiveWideLayout::append_view): Renamed add_view into
    	this.  Append the widget instead of trying to put at a specific
    	position in the notebook.
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::add_views_to_layout): Update this to use
    	Layout::append_view and to append views in the proper order.  Add
    	comment.

 .../nmv-dbg-perspective-default-layout.cc          |    9 +++++----
 .../nmv-dbg-perspective-two-pane-layout.cc         |    4 ++--
 .../nmv-dbg-perspective-wide-layout.cc             |    9 +++++----
 3 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc b/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
index 05f7619..44d956f 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
@@ -154,7 +154,10 @@ DBGPerspectiveDefaultLayout::activate_view (int a_view)
     THROW_IF_FAIL (m_priv);
     THROW_IF_FAIL (m_priv->statuses_notebook);
 
-    m_priv->statuses_notebook->set_current_page (a_view);
+    int page_num =
+        m_priv->statuses_notebook->page_num (m_priv->views.at (a_view));
+    THROW_IF_FAIL (page_num >= 0);
+    m_priv->statuses_notebook->set_current_page (page_num);
 }
 
 void
@@ -188,9 +191,7 @@ DBGPerspectiveDefaultLayout::add_view (Gtk::Widget &a_widget,
 
     m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index, a_widget));
     a_widget.show_all ();
-    int page_num = m_priv->statuses_notebook->insert_page (a_widget,
-                                                           a_title,
-                                                           a_index);
+    int page_num = m_priv->statuses_notebook->prepend_page (a_widget, a_title);
     m_priv->statuses_notebook->set_current_page (page_num);
 }
 
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc b/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
index deb0e27..da39cca 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
@@ -193,7 +193,7 @@ DBGPerspectiveTwoPaneLayout::activate_view (int a_view)
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
     THROW_IF_FAIL (m_priv);
-    THROW_IF_FAIL (!m_priv->views.count (a_view));
+    THROW_IF_FAIL (m_priv->views.count (a_view));
 
     Gtk::Notebook &status_notebook = m_priv->statuses_notebook (a_view);
     int page_num = status_notebook.page_num (m_priv->views.at (a_view));
@@ -234,7 +234,7 @@ DBGPerspectiveTwoPaneLayout::add_view (Gtk::Widget &a_widget,
     m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index, a_widget));
     a_widget.show_all ();
     Gtk::Notebook &statuses_notebook = m_priv->statuses_notebook (a_index);
-    int page_num = statuses_notebook.insert_page (a_widget, a_title, a_index);
+    int page_num = statuses_notebook.prepend_page (a_widget, a_title);
     statuses_notebook.set_current_page (page_num);
 }
 
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc b/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
index 72370ae..78ff297 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
@@ -151,7 +151,10 @@ DBGPerspectiveWideLayout::activate_view (int a_view)
     THROW_IF_FAIL (m_priv);
     THROW_IF_FAIL (m_priv->statuses_notebook);
 
-    m_priv->statuses_notebook->set_current_page (a_view);
+    int page_num =
+        m_priv->statuses_notebook->page_num (m_priv->views.at (a_view));
+    THROW_IF_FAIL (page_num >= 0);
+    m_priv->statuses_notebook->set_current_page (page_num);
 }
 
 void
@@ -185,9 +188,7 @@ DBGPerspectiveWideLayout::add_view (Gtk::Widget &a_widget,
 
     m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index, a_widget));
     a_widget.show_all ();
-    int page_num = m_priv->statuses_notebook->insert_page (a_widget,
-                                                           a_title,
-                                                           a_index);
+    int page_num = m_priv->statuses_notebook->prepend_page (a_widget, a_title);
     m_priv->statuses_notebook->set_current_page (page_num);
 }
 



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