Why on Windows "args.SelectionData.Text" is an empty string?
On Linux args.SelectionData.Text is filled with file:///path

Some one Know how to Resolve this "problem"?
=========================================================
private static TargetEntry[] dndTargetTable = new TargetEntry[] {
    new TargetEntry("STRING", 0, 0),
    new TargetEntry("text/plain", 0, 1),
    new TargetEntry("text/uri-list", 0, 2),
    new TargetEntry("_NETSCAPE_URL", 0, 3),
    new TargetEntry("application/x-color", 0, 4),
    new TargetEntry("application/x-rootwindow-drop", 0, 5),
    new TargetEntry("property/bgimage", 0, 6),
    new TargetEntry("property/keyword", 0, 7),
    new TargetEntry("x-special/gnome-icon-list", 0, 8),
    new TargetEntry("x-special/gnome-reset-background", 0, 9)
};

...
// Initialize Icon View Drag & Drop
iconView.EnableModelDragDest(dndTargetTable, Gdk.DragAction.Copy);
iconView.DragDataReceived += new DragDataReceivedHandler(OnDragDataReceived);
...

protected void OnDragDataReceived (object sender, DragDataReceivedArgs args) {
    if (args.SelectionData.Text == null ||
        args.SelectionData.Text.Length <= 0)
    {
        // On Windows args.SelectionData.Text is ""
        Drag.Finish(args.Context, false, false, args.Time);
        return;
    }

    IconViewDropPosition pos;
    TreePath path;           

    // Get Dest Item Position
    if ( iconView.GetDestItemAtPos(args.X, args.Y, out path, out pos) == false) {
        Drag.Finish(args.Context, false, false, args.Time);
        return;
    }

    // Get Drop Uri
    string[] filesUri = Regex.Split (args.SelectionData.Text, "\r\n");
    foreach (string uri in filesUri) {
        if (uri == null || uri.Equals("") || uri.Length == 0)
            continue;

        string filePath = uri;
        // Start Event Send File:
        if (filePath.StartsWith("file://") == true)
              filePath = filePath.Substring(7);

        Gtk.Application.Invoke(delegate {
               if (SendFile != null) SendFile(this, userInfo, filePath);
         });
   }

   Drag.Finish(args.Context, true, false, args.Time);
}
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to