[baobab/wip/gtkmaster] Use just one HeaderBar.



commit 63127a20b089eb6e2282b25a74b302b9ff1b0382
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Jun 2 11:56:36 2013 +0200

    Use just one HeaderBar.
    
    This is in preparation to use a titlebar

 src/baobab-main-window.ui |   50 ++++++++++++++------------------------------
 src/baobab-window.vala    |   16 +++++++++----
 2 files changed, 27 insertions(+), 39 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index 69f27ba..c3aec28 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -20,77 +20,59 @@
       <object class="GtkHeaderBar" id="header-bar">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="title" translatable="yes">Devices and locations</property>
-        <style>
-          <class name="menubar"/>
-          <class name="baobab-toolbar"/>
-        </style>
         <child>
-          <object class="GtkMenuButton" id="menu-button">
-            <property name="visible">True</property>
+          <object class="GtkButton" id="back-button">
             <property name="valign">center</property>
-            <property name="menu_model">winmenu</property>
-            <property name="action_name">win.gear-menu</property>
+            <property name="can_focus">True</property>
+            <property name="action_name">win.show-home-page</property>
             <style>
               <class name="image-button"/>
             </style>
             <child>
-              <object class="GtkImage" id="menu-button-image">
+              <object class="GtkImage" id="back-button-image">
                 <property name="visible">True</property>
                 <property name="icon_size">1</property>
-                <property name="icon_name">emblem-system-symbolic</property>
+                <property name="icon_name">go-previous-symbolic</property>
               </object>
             </child>
           </object>
           <packing>
-            <property name="pack_type">end</property>
+            <property name="pack_type">start</property>
           </packing>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkHeaderBar" id="result-header-bar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <style>
-          <class name="menubar"/>
-          <class name="baobab-toolbar"/>
-        </style>
         <child>
-          <object class="GtkButton" id="back-button">
-            <property name="visible">True</property>
+          <object class="GtkButton" id="reload-button">
             <property name="valign">center</property>
             <property name="can_focus">True</property>
-            <property name="action_name">win.show-home-page</property>
+            <property name="action_name">win.reload</property>
             <style>
               <class name="image-button"/>
             </style>
             <child>
-              <object class="GtkImage" id="back-button-image">
+              <object class="GtkImage" id="reload-button-image">
                 <property name="visible">True</property>
                 <property name="icon_size">1</property>
-                <property name="icon_name">go-previous-symbolic</property>
+                <property name="icon_name">view-refresh-symbolic</property>
               </object>
             </child>
           </object>
           <packing>
-            <property name="pack_type">start</property>
+            <property name="pack_type">end</property>
           </packing>
         </child>
         <child>
-          <object class="GtkButton" id="reload-button">
-            <property name="visible">True</property>
+          <object class="GtkMenuButton" id="menu-button">
             <property name="valign">center</property>
-            <property name="can_focus">True</property>
-            <property name="action_name">win.reload</property>
+            <property name="menu_model">winmenu</property>
+            <property name="action_name">win.gear-menu</property>
             <style>
               <class name="image-button"/>
             </style>
             <child>
-              <object class="GtkImage" id="reload-button-image">
+              <object class="GtkImage" id="menu-button-image">
                 <property name="visible">True</property>
                 <property name="icon_size">1</property>
-                <property name="icon_name">view-refresh-symbolic</property>
+                <property name="icon_name">emblem-system-symbolic</property>
               </object>
             </child>
           </object>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index cc0c517..10cba24 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -25,7 +25,9 @@ namespace Baobab {
     public class Window : Gtk.ApplicationWindow {
         Settings ui_settings;
         Gtk.HeaderBar header_bar;
-        Gtk.HeaderBar result_header_bar;
+        Gtk.Button back_button;
+        Gtk.Button reload_button;
+        Gtk.MenuButton menu_button;
         Gtk.Stack main_stack;
         Gtk.Widget home_page;
         Gtk.Widget result_page;
@@ -107,7 +109,9 @@ namespace Baobab {
             home_page = builder.get_object ("home-page") as Gtk.Widget;
             result_page = builder.get_object ("result-page") as Gtk.Widget;
             header_bar = builder.get_object ("header-bar") as Gtk.HeaderBar;
-            result_header_bar = builder.get_object ("result-header-bar") as Gtk.HeaderBar;
+            back_button = builder.get_object ("back-button") as Gtk.Button;
+            reload_button = builder.get_object ("reload-button") as Gtk.Button;
+            menu_button = builder.get_object ("menu-button") as Gtk.MenuButton;
             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;
@@ -494,19 +498,21 @@ namespace Baobab {
         }
 
         void set_ui_state (Gtk.Widget child, bool busy) {
-            header_bar.visible = (child == home_page);
-            result_header_bar.visible = (child == result_page);
+            menu_button.visible = (child == home_page);
+            reload_button.visible = (child == result_page);
+            back_button.visible = (child == result_page);
 
             set_busy (busy);
 
             if (child == home_page) {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (false);
+                header_bar.set_title (_("Devices and locations"));
                 main_stack.transition_type = Gtk.StackTransitionType.SLIDE_RIGHT;
             } else {
                 var action = lookup_action ("reload") as SimpleAction;
                 action.set_enabled (true);
-                result_header_bar.set_title (active_location.name);
+                header_bar.set_title (active_location.name);
                 main_stack.transition_type = Gtk.StackTransitionType.SLIDE_LEFT;
             }
 


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