[tracker/tracker-0.12] tracker-needle: Connect iconview selection change with tag-view update



commit 5f456953d6910ca730990bafe4670caedf3ea328
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Nov 21 10:02:12 2011 +0000

    tracker-needle: Connect iconview selection change with tag-view update

 src/tracker-needle/tracker-needle.vala |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 258feef..5cd6cc4 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -344,8 +344,7 @@ public class Tracker.Needle {
 		sw_icons = new Tracker.View (Tracker.View.Display.FILE_ICONS, null);
 		iconview = (IconView) sw_icons.get_child ();
 		iconview.item_activated.connect (icon_item_activated);
-		//var iconselection = iconview.get_selection ();
-		//iconselection.changed.connect (icon_item_selected);
+		iconview.selection_changed.connect (icon_view_selection_changed);
 		view.pack_start (sw_icons, true, true, 0);
 
 		// Set up tags widget
@@ -619,6 +618,33 @@ public class Tracker.Needle {
 		tags_view.set_files (uris);
 	}
 
+	private void icon_view_selection_changed () {
+		IconView iconview;
+		TreeModel model = null;
+		debug ("Icon selection changed");
+
+		iconview = (IconView) sw_icons.get_child ();
+		model = iconview.get_model ();
+		List<string> uris = null;
+
+		iconview.selected_foreach ((iconview, path) => {
+			TreeIter iter;
+
+			if (model.get_iter (out iter, path)) {
+				string uri;
+
+				model.get (iter, 1, out uri, -1);
+				debug ("--> %s", uri);
+
+				if (uri != null) {
+					uris.prepend (uri);
+				}
+			}
+		});
+
+		tags_view.set_files (uris);
+	}
+
 	private void show_tags_clicked () {
 		if (show_tags.active) {
 			debug ("Showing tags");



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