[tracker/new-tracker-search-tool] Added drag/drop for search results
- From: Jamie McCracken <jamiemcc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/new-tracker-search-tool] Added drag/drop for search results
- Date: Tue, 22 Sep 2009 06:06:20 +0000 (UTC)
commit c35232fbf8f949ad84131e593bef174b0a45f84a
Author: Jamie McCracken <jamiemcc gnome org>
Date: Tue Sep 22 02:09:23 2009 -0400
Added drag/drop for search results
src/tracker-search-tool/tracker-entry.gs | 1 +
src/tracker-search-tool/tracker-result-grid.gs | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-search-tool/tracker-entry.gs b/src/tracker-search-tool/tracker-entry.gs
index 9e24748..6be1084 100644
--- a/src/tracker-search-tool/tracker-entry.gs
+++ b/src/tracker-search-tool/tracker-entry.gs
@@ -11,6 +11,7 @@ class TrackerSearchEntry : Gtk.Entry
init
set_icon_from_stock (EntryIconPosition.PRIMARY, STOCK_FIND)
set_icon_from_stock (EntryIconPosition.SECONDARY, STOCK_CLEAR)
+ set_icon_sensitive (EntryIconPosition.PRIMARY, false)
set_icon_sensitive (EntryIconPosition.SECONDARY, false)
set_icon_tooltip_text (EntryIconPosition.SECONDARY, _("Clear the search text"))
changed += entry_changed
diff --git a/src/tracker-search-tool/tracker-result-grid.gs b/src/tracker-search-tool/tracker-result-grid.gs
index fdf48f9..9e7973e 100644
--- a/src/tracker-search-tool/tracker-result-grid.gs
+++ b/src/tracker-search-tool/tracker-result-grid.gs
@@ -15,6 +15,9 @@ enum ResultColumns
IsDirectory
NumOfCols
+
+const targets : array of TargetEntry[] = {{ "text/uri-list", 0, 1 },{ "text/plain", 0, 0 },{ "STRING", 0, 0 }}
+
class TrackerResultGrid : ScrolledWindow
store : ListStore
@@ -49,11 +52,31 @@ class TrackerResultGrid : ScrolledWindow
iconview = new IconView.with_model (store)
iconview.set_pixbuf_column (ResultColumns.Icon)
iconview.set_text_column (ResultColumns.DisplayName)
+ iconview.set_selection_mode (SelectionMode.BROWSE)
+ iconview.enable_model_drag_source (Gdk.ModifierType.BUTTON1_MASK | Gdk.ModifierType.BUTTON2_MASK, targets, Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.ASK)
iconview.set_item_width (150)
iconview.set_row_spacing (10)
iconview.item_activated += ActivateUri
+
iconview.selection_changed += def ()
SelectedUriChanged ()
+
+ /* set correct uri for drag drop */
+ iconview.drag_data_get += def (context, data, info, time)
+ l : weak GLib.List of TreePath
+ l = iconview.get_selected_items ()
+ if l is not null and l.data is not null
+ iter : TreeIter
+ uri : weak string
+ path : TreePath = l.data
+ store.get_iter (out iter, path)
+ store.get (iter, ResultColumns.Uri, out uri);
+ var s = new array of string [1]
+ s[0] = uri
+ data.set_uris (s)
+
+
+
add (iconview)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]