[baobab] window: Rework home page toolbar



commit 906f187b2326b8ee7a0b80b533c8ff27a9566533
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Thu Oct 18 13:32:32 2012 +0200

    window: Rework home page toolbar
    
     * replace the "Scan Folder" and "Scan Remote Folder" buttons with
       a window menu
     * add a "Devices and locations" label as suggested by designers

 src/baobab-main-window.ui |   67 ++++++++-------------------------------------
 src/baobab-window.vala    |   12 +++++---
 2 files changed, 19 insertions(+), 60 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index 03a8fdc..b8802f1 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -1,61 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkBox" id="scan-button-box">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="vexpand">True</property>
-    <property name="homogeneous">True</property>
-    <style>
-      <class name="linked"/>
-    </style>
-    <child>
-      <object class="GtkButton" id="scan-folder-button">
-        <property name="label" translatable="yes">Scan Folder</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="has_tooltip">True</property>
-        <property name="tooltip_markup" translatable="yes">Scan a folder</property>
-        <property name="tooltip_text" translatable="yes">Scan a folder</property>
-        <property name="use_action_appearance">False</property>
-        <property name="vexpand">True</property>
-        <property name="action_name">win.scan-folder</property>
-        <property name="use_underline">True</property>
-        <style>
-          <class name="raised"/>
-        </style>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="scan-remote-button">
-        <property name="label" translatable="yes">Scan Remote Folder</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="has_tooltip">True</property>
-        <property name="tooltip_markup" translatable="yes">Scan a remote folder</property>
-        <property name="tooltip_text" translatable="yes">Scan a remote folder</property>
-        <property name="use_action_appearance">False</property>
-        <property name="vexpand">True</property>
-        <property name="action_name">win.scan-remote</property>
-        <property name="use_underline">True</property>
-        <style>
-          <class name="raised"/>
-        </style>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
+  <menu id="winmenu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Scan Folderâ</attribute>
+        <attribute name="action">win.scan-folder</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Scan Remote Folderâ</attribute>
+        <attribute name="action">win.scan-remote</attribute>
+      </item>
+    </section>
+  </menu>
   <object class="GtkGrid" id="window-contents">
     <property name="visible">True</property>
     <property name="orientation">vertical</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 086b569..cb2ef7a 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -27,7 +27,6 @@ namespace Baobab {
         Gtk.Notebook main_notebook;
         Gd.MainToolbar home_toolbar;
         Gd.MainToolbar result_toolbar;
-        Gtk.Button scan_remote;
         Gtk.InfoBar infobar;
         Gtk.Label infobar_primary;
         Gtk.Label infobar_secondary;
@@ -122,12 +121,14 @@ namespace Baobab {
             treemap_chart = builder.get_object ("treemap-chart") as Chart;
             spinner = builder.get_object ("spinner") as Gtk.Spinner;
 
+            var menu_model = builder.get_object ("winmenu") as MenuModel;
+
             // Home page toolbar
             var toolbar = builder.get_object ("home-toolbar") as Gd.MainToolbar;
             home_toolbar = toolbar;
-            var button_box = builder.get_object ("scan-button-box") as Gtk.Box;
-            scan_remote = builder.get_object ("scan-remote-button") as Gtk.Button;
-            toolbar.add_widget (button_box, true);
+            var menu_button = toolbar.add_menu ("emblem-system-symbolic", null, false) as Gtk.MenuButton;
+            menu_button.set_menu_model (menu_model);
+            toolbar.set_labels (_("Devices and locations"), null);
             toolbar.show_all ();
 
             // Result page toolbar
@@ -143,7 +144,8 @@ namespace Baobab {
             location_list.set_action (on_scan_location_activate);
             location_list.update ();
 
-            scan_remote.visible = ConnectServer.available ();
+            var action = lookup_action ("scan-remote") as SimpleAction;
+            action.set_enabled (ConnectServer.available ());
 
             setup_treeview (builder);
 



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