[tracker/needle: 21/43] tracker-needle: Added another view for detailed searching



commit 2475ca518a5a3d769ce85a442262bb6ed1a0a17d
Author: Martyn Russell <martyn lanedo com>
Date:   Sun Aug 15 16:13:47 2010 +0100

    tracker-needle: Added another view for detailed searching

 src/tracker-needle/tracker-needle.ui   |   15 +++++++++++++++
 src/tracker-needle/tracker-needle.vala |   24 ++++++++++++++++--------
 2 files changed, 31 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.ui b/src/tracker-needle/tracker-needle.ui
index 8f3187d..1000061 100644
--- a/src/tracker-needle/tracker-needle.ui
+++ b/src/tracker-needle/tracker-needle.ui
@@ -43,6 +43,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkRadioToolButton" id="toolbutton_view_details">
+                <property name="visible">True</property>
+                <property name="tooltip_text" translatable="yes">Display results for all categories</property>
+                <property name="is_important">True</property>
+                <property name="use_underline">True</property>
+                <property name="icon_name">help-faq</property>
+                <property name="active">True</property>
+                <property name="group">toolbutton_view_icons</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkSeparatorToolItem" id="toolbutton2">
                 <property name="visible">True</property>
               </object>
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index f0c02dc..4cb88c1 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -39,6 +39,7 @@ public class TrackerNeedle {
 	private Window window;
 	private ToggleToolButton view_list;
 	private ToggleToolButton view_icons;
+	private ToggleToolButton view_details;
 	private ToggleToolButton find_in_contents;
 	private ToggleToolButton find_in_titles;
 	private Entry search;
@@ -110,6 +111,9 @@ public class TrackerNeedle {
 		view_icons = builder.get_object ("toolbutton_view_icons") as ToggleToolButton;
 		view_icons.toggled.connect (view_toggled);
 
+		view_details = builder.get_object ("toolbutton_view_details") as ToggleToolButton;
+		view_details.toggled.connect (view_toggled);
+
 		find_in_contents = builder.get_object ("toolbutton_find_in_contents") as ToggleToolButton;
 		find_in_contents.toggled.connect (find_in_toggled);
 
@@ -335,29 +339,33 @@ public class TrackerNeedle {
 			}
 		} catch (DBus.Error e) {
 			warning ("Could not run SPARQL query: " + e.message);
+			return false;
 		}
-
-		last_search_id = 0;
-
-		return false;
+		
+		return true;
 	}
 
 	private void view_toggled () {
-		if (current_view == view_list.active) {
+		bool rows;
+
+		rows = view_list.active || view_details.active;
+		
+		if (current_view == rows) {
 			return;
 		}
 
-		if (view_list.active) {
+		if (rows) {
+			// FIXME: if list/details changes, re-run query
 			sw_iconview.hide ();
 			sw_treeview.show_all ();
-			debug ("View toggled to 'list'");
+			debug ("View toggled to 'list' or 'details'");
 		} else {
 			sw_iconview.show_all ();
 			sw_treeview.hide ();
 			debug ("View toggled to 'icons'");
 		}
 
-		current_view = view_list.active;
+		current_view = rows;
 	}
 
 	private void find_in_toggled () {



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