[tomboy] DnD: Add a text/path-list target source with the note path
- From: Sanford Armstrong <sharm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tomboy] DnD: Add a text/path-list target source with the note path
- Date: Mon, 15 Mar 2010 15:29:13 +0000 (UTC)
commit 083a26d4f666b4c60388503007a673f68c042e88
Author: Olivier Le Thanh Duong <olivier lethanh be>
Date: Fri Mar 5 01:20:09 2010 +0100
DnD: Add a text/path-list target source with the note path
Add a text/path-list target source for drag and drop similar to
text/uri-list which contain the notes full path. This is in order to
allow applications to retrieve the path of notes.
https://bugzilla.gnome.org/show_bug.cgi?id=611858
Tomboy/RecentChanges.cs | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/Tomboy/RecentChanges.cs b/Tomboy/RecentChanges.cs
index 9e05486..c4df82e 100644
--- a/Tomboy/RecentChanges.cs
+++ b/Tomboy/RecentChanges.cs
@@ -7,6 +7,14 @@ namespace Tomboy
{
public class NoteRecentChanges : ForcedPresentWindow
{
+
+ private enum Target
+ {
+ Text,
+ Uri,
+ Path,
+ }
+
NoteManager manager;
Gtk.MenuBar menu_bar;
@@ -289,13 +297,16 @@ namespace Tomboy
new Gtk.TargetEntry [] {
new Gtk.TargetEntry ("STRING",
Gtk.TargetFlags.App,
- 0),
+ (uint) Target.Text),
new Gtk.TargetEntry ("text/plain",
Gtk.TargetFlags.App,
- 0),
+ (uint) Target.Text),
new Gtk.TargetEntry ("text/uri-list",
Gtk.TargetFlags.App,
- 1),
+ (uint) Target.Uri),
+ new Gtk.TargetEntry ("text/path-list",
+ Gtk.TargetFlags.App,
+ (uint) Target.Path),
};
tree = new RecentTreeView ();
@@ -662,17 +673,25 @@ namespace Tomboy
return;
string uris = string.Empty;
+ string paths = string.Empty;
foreach (Note note in selected_notes) {
if (uris != string.Empty)
uris += "\n";
uris += note.Uri;
+ if (paths != string.Empty)
+ paths += "\n";
+ paths += "file://" + note.FilePath;
}
- // FIXME: Gtk.SelectionData has no way to get the
- // requested target.
- args.SelectionData.Set (Gdk.Atom.Intern ("text/uri-list", false),
- 8,
- Encoding.UTF8.GetBytes (uris));
+ if(args.Info == (uint) Target.Path)
+ args.SelectionData.Set (Gdk.Atom.Intern ("text/path-list", false),
+ 8,
+ Encoding.UTF8.GetBytes (paths));
+
+ else
+ args.SelectionData.Set (Gdk.Atom.Intern ("text/uri-list", false),
+ 8,
+ Encoding.UTF8.GetBytes (uris));
if (selected_notes.Count == 1)
args.SelectionData.Text = selected_notes [0].Title;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]