[baobab/animated-notebook: 2/4] window: replace GtkNotebook with CcNotebook



commit 010e9030350d9c3563ab2bca73c345175c20558d
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Thu Oct 18 17:36:25 2012 +0200

    window: replace GtkNotebook with CcNotebook

 src/baobab-main-window.ui |    4 +---
 src/baobab-window.vala    |   12 ++++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index b8802f1..0b4d6e5 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -97,11 +97,9 @@
       </object>
     </child>
     <child>
-      <object class="GtkNotebook" id="main-notebook">
+      <object class="CcNotebook" id="main-notebook">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
-        <property name="show_tabs">False</property> -->
-        <property name="show_border">False</property> -->
         <child>
           <object class="GtkGrid" id="home-page">
             <property name="can_focus">False</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index cb2ef7a..55a11c2 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -24,7 +24,9 @@ namespace Baobab {
 
     public class Window : Gtk.ApplicationWindow {
         Settings ui_settings;
-        Gtk.Notebook main_notebook;
+        Cc.Notebook main_notebook;
+        Gtk.Grid home_page;
+        Gtk.Grid result_page;
         Gd.MainToolbar home_toolbar;
         Gd.MainToolbar result_toolbar;
         Gtk.InfoBar infobar;
@@ -109,7 +111,9 @@ namespace Baobab {
             }
 
             // Cache some objects from the builder.
-            main_notebook = builder.get_object ("main-notebook") as Gtk.Notebook;
+            main_notebook = builder.get_object ("main-notebook") as Cc.Notebook;
+            home_page = builder.get_object ("home-page") as Gtk.Grid;
+            result_page = builder.get_object ("result-page") as Gtk.Grid;
             infobar = builder.get_object ("infobar") as Gtk.InfoBar;
             infobar_primary = builder.get_object ("infobar-primary-label") as Gtk.Label;
             infobar_secondary = builder.get_object ("infobar-secondary-label") as Gtk.Label;
@@ -496,13 +500,13 @@ namespace Baobab {
             if (page == UIPage.HOME) {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (false);
+                main_notebook.select_page (home_page, true);
             } else {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (true);
                 result_toolbar.set_labels (active_location.name, null);
+                main_notebook.select_page (result_page, true);
             }
-
-            main_notebook.page = page;
         }
 
         void first_row_has_child (Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {



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