[tracker/needle] tracker-needle: Don't show find-in buttons where unused



commit 4fca26f2cbcd7d5a585abdbc15c2a3678080d3d1
Author: Martyn Russell <martyn lanedo com>
Date:   Thu Sep 9 21:53:06 2010 +0100

    tracker-needle: Don't show find-in buttons where unused

 src/tracker-needle/tracker-needle.ui   |    2 +-
 src/tracker-needle/tracker-needle.vala |   18 ++++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.ui b/src/tracker-needle/tracker-needle.ui
index af50f2a..e5f3fd2 100644
--- a/src/tracker-needle/tracker-needle.ui
+++ b/src/tracker-needle/tracker-needle.ui
@@ -58,7 +58,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkSeparatorToolItem" id="toolbutton2">
+              <object class="GtkSeparatorToolItem" id="separator_secondary">
                 <property name="visible">True</property>
               </object>
               <packing>
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index b5479cb..ea6107b 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -32,6 +32,7 @@ public class TrackerNeedle {
 	private ToggleToolButton view_list;
 	private ToggleToolButton view_icons;
 	private ToggleToolButton view_details;
+	private SeparatorToolItem separator_secondary;
 	private ToggleToolButton find_in_contents;
 	private ToggleToolButton find_in_titles;
 	private Entry search;
@@ -92,6 +93,8 @@ public class TrackerNeedle {
 		view_details = builder.get_object ("toolbutton_view_details") as ToggleToolButton;
 		view_details.toggled.connect (view_toggled);
 
+		separator_secondary = builder.get_object ("separator_secondary") as SeparatorToolItem;
+
 		find_in_contents = builder.get_object ("toolbutton_find_in_contents") as ToggleToolButton;
 		find_in_contents.toggled.connect (find_in_toggled);
 
@@ -443,6 +446,7 @@ public class TrackerNeedle {
 
 	private void view_toggled () {
 		bool rows;
+		bool show_find_in;
 
 		rows = view_list.active || view_details.active;
 		
@@ -460,23 +464,25 @@ public class TrackerNeedle {
 				treeview.set_grid_lines (Gtk.TreeViewGridLines.NONE);
 				treeview.get_column (2).visible = false;
 				treeview.set_headers_visible (false);
-				find_in_contents.sensitive = false;
-				find_in_titles.sensitive = false;
+				show_find_in = false;
 			} else {
 				treeview.set_grid_lines (Gtk.TreeViewGridLines.VERTICAL);
 				treeview.get_column (2).visible = true;
 				treeview.set_headers_visible (true);
-				find_in_contents.sensitive = true;
-				find_in_titles.sensitive = true;
+				show_find_in = true;
 			}
 		} else {
 			sw_iconview.show_all ();
 			sw_treeview.hide ();
-			find_in_contents.sensitive = true;
-			find_in_titles.sensitive = true;
+			show_find_in = true;
 			debug ("View toggled to 'icons'");
 		}
 
+		// Show/Hide secondary widgets
+		separator_secondary.visible = show_find_in;
+		find_in_contents.visible = show_find_in;
+		find_in_titles.visible = show_find_in;
+
 		search_run ();
 		current_view = rows;
 	}



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