[tracker/needle: 13/34] tracker-needle: Removed back/forward buttons and re-run query if find-in toggled



commit a6f63d64975715e966d22bef65f22befbfc8ec29
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Jun 30 09:07:55 2010 +0100

    tracker-needle: Removed back/forward buttons and re-run query if find-in toggled

 src/tracker-needle/tracker-needle.ui   |   35 -------------------------
 src/tracker-needle/tracker-needle.vala |   44 ++++++++++++++++----------------
 2 files changed, 22 insertions(+), 57 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.ui b/src/tracker-needle/tracker-needle.ui
index da23252..5a3ea70 100644
--- a/src/tracker-needle/tracker-needle.ui
+++ b/src/tracker-needle/tracker-needle.ui
@@ -14,41 +14,6 @@
           <object class="GtkToolbar" id="toolbar_main">
             <property name="visible">True</property>
             <child>
-              <object class="GtkToolButton" id="toolbutton_back">
-                <property name="visible">True</property>
-                <property name="tooltip_text" translatable="yes">Go back in search history</property>
-                <property name="label" translatable="yes">toolbutton1</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-go-back</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkToolButton" id="toolbutton_forward">
-                <property name="visible">True</property>
-                <property name="tooltip_text" translatable="yes">Go forward in search history</property>
-                <property name="label" translatable="yes">toolbutton1</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-go-forward</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSeparatorToolItem" id="toolbutton1">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkRadioToolButton" id="toolbutton_view_list">
                 <property name="visible">True</property>
                 <property name="tooltip_text" translatable="yes">Display results in a list view</property>
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 47ee703..e3bb16b 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -36,8 +36,6 @@ public class Needle {
 	private const string UI_FILE = "tracker-needle.ui";
 	private Resources tracker;
 	private Window window;
-	private ToolButton back;
-	private ToolButton forward;
 	private ToggleToolButton view_list;
 	private ToggleToolButton view_icons;
 	private ToggleToolButton find_in_contents;
@@ -49,6 +47,8 @@ public class Needle {
 	private IconView iconview;
 	private uint last_search_id = 0;
 	private ListStore store;
+    static bool current_view = true;
+    static bool current_find_in = true;
 
 	private const int secs_per_day = 60 * 60 * 24;
 
@@ -102,14 +102,6 @@ public class Needle {
 		window = builder.get_object ("window_needle") as Window;
 		window.destroy.connect (Gtk.main_quit);
 
-		back = builder.get_object ("toolbutton_back") as ToolButton;
-		back.clicked.connect (back_clicked);
-		back.set_sensitive (false);
-
-		forward = builder.get_object ("toolbutton_forward") as ToolButton;
-		forward.clicked.connect (forward_clicked);
-		forward.set_sensitive (false);
-
 		view_list = builder.get_object ("toolbutton_view_list") as ToggleToolButton;
 		view_list.toggled.connect (view_toggled);
 
@@ -335,7 +327,7 @@ public class Needle {
 				           -1);
 			}
 		} catch (DBus.Error e) {
-			// Do nothing
+			warning ("Could not run SPARQL query: " + e.message);
 		}
 
 		last_search_id = 0;
@@ -343,30 +335,38 @@ public class Needle {
 		return false;
 	}
 
-	private void forward_clicked () {
-		// Do nothing
-	}
-
-	private void back_clicked () {
-		// Do nothing
-	}
-
 	private void view_toggled () {
+	    if (current_view == view_list.active) {
+	        return;	    
+	    }
+
 		if (view_list.active) {
 			sw_iconview.hide ();
 			sw_treeview.show_all ();
+			debug ("View toggled to 'list'");
 		} else {
 			sw_iconview.show_all ();
 			sw_treeview.hide ();
+			debug ("View toggled to 'icons'");
 		}
+
+		current_view = view_list.active;
 	}
 
-	private void find_in_toggled () {
+	private void find_in_toggled () {    
+	    if (current_find_in == find_in_contents.active) {
+	        return;	    
+	    }
+	    
 		if (find_in_contents.active) {
-			// TODO: Re-run query
+			debug ("Find in toggled to 'contents'");
+			search_run ();
 		} else {
-			// TODO: Re-run query
+			debug ("Find in toggled to 'titles'");
+			search_run ();
 		}
+		
+		current_find_in = find_in_contents.active;
 	}
 
 	private void view_row_selected (TreeView view, TreePath path, TreeViewColumn column) {



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