зеркало из https://github.com/mono/mail-archives.git
136 строки
4.7 KiB
HTML
136 строки
4.7 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Gtk-sharp-list] Drag and drop path
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:lists-christian%40rudh.se">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
|
||
|
<LINK REL="Previous" HREF="005294.html">
|
||
|
<LINK REL="Next" HREF="005290.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Gtk-sharp-list] Drag and drop path
|
||
|
</H1>
|
||
|
<B>Christian Rudh
|
||
|
</B>
|
||
|
<A HREF="mailto:lists-christian%40rudh.se"
|
||
|
TITLE="[Gtk-sharp-list] Drag and drop path">lists-christian@rudh.se
|
||
|
</A><BR>
|
||
|
<I>Thu, 06 Jan 2005 22:13:59 +0100</I>
|
||
|
<P><UL>
|
||
|
<LI> Previous message: <A HREF="005294.html">[Gtk-sharp-list] custom cell renderer
|
||
|
</A></li>
|
||
|
<LI> Next message: <A HREF="005290.html">[Gtk-sharp-list] Drag and drop path
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#5289">[ date ]</a>
|
||
|
<a href="thread.html#5289">[ thread ]</a>
|
||
|
<a href="subject.html#5289">[ subject ]</a>
|
||
|
<a href="author.html#5289">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>Hi
|
||
|
|
||
|
The code from muine worked good. But not with international and special
|
||
|
characters. I solved it by using this C gnome-vfs function instead:
|
||
|
|
||
|
[DllImport ("libgnomevfs-2.dll")]
|
||
|
private static extern IntPtr gnome_vfs_format_uri_for_display (string
|
||
|
str);
|
||
|
|
||
|
public static string FormatUriForDisplay (string uri)
|
||
|
{
|
||
|
IntPtr p = gnome_vfs_format_uri_for_display (uri);
|
||
|
|
||
|
if (p == IntPtr.Zero)
|
||
|
return null;
|
||
|
else
|
||
|
return GLib.Marshaller.PtrToStringGFree (p);
|
||
|
}
|
||
|
|
||
|
This works fine with importing the files and showing them in the
|
||
|
application, but gstreamer doesn't accept the filenames :(
|
||
|
|
||
|
But I solved that by sending the URI instead of the filename. GStreamer
|
||
|
accepts them if you add the song to the pipeline with:
|
||
|
|
||
|
filesrc = ElementFactory.Make ("gnomevfssrc", "disk_source");
|
||
|
filesrc.SetProperty ("location", songURI);
|
||
|
|
||
|
So gnomevfssrc instead of filesrc. Now all files I have tried to add so
|
||
|
far works beutifully! :)
|
||
|
|
||
|
Hope it is to some help if you haven't solved it yet (saw that is was
|
||
|
still an issue in bluefunk cvs).
|
||
|
|
||
|
/Christian
|
||
|
|
||
|
|
||
|
On Mon, 2004-11-29 at 22:01 +0000, Mike Rhodes wrote:
|
||
|
><i> I use this code:
|
||
|
</I>><i>
|
||
|
</I>><i> [DllImport ("libgnomevfs-2.dll")]
|
||
|
</I>><i> private static extern IntPtr gnome_vfs_get_local_path_from_uri (string str);
|
||
|
</I>><i>
|
||
|
</I>><i> public static string LocalPathFromUri (string uri)
|
||
|
</I>><i> {
|
||
|
</I>><i> IntPtr p = gnome_vfs_get_local_path_from_uri (uri);
|
||
|
</I>><i>
|
||
|
</I>><i> if (p == IntPtr.Zero)
|
||
|
</I>><i> return null;
|
||
|
</I>><i> else
|
||
|
</I>><i> return GLib.Marshaller.PtrToStringGFree (p);
|
||
|
</I>><i> }
|
||
|
</I>><i>
|
||
|
</I>><i> (All credit goes to the Muine code where I found it =) ) I believe
|
||
|
</I>><i> gnome-vfs isn't part of gtk-sharp as of yet, so I'm not sure of
|
||
|
</I>><i> another way to do it.
|
||
|
</I>><i>
|
||
|
</I>><i> Mike.
|
||
|
</I>><i>
|
||
|
</I>><i> p.s. btw, if you are thinking of writing a C# music player, I'm also
|
||
|
</I>><i> writing one; perhaps we could team up -- or at least solve some of the
|
||
|
</I>><i> issues that come up -- drop me a line off-list if you are interested!
|
||
|
</I>><i>
|
||
|
</I>><i>
|
||
|
</I>><i> On Mon, 29 Nov 2004 19:08:26 +0100, Christian Rudh
|
||
|
</I>><i> <<A HREF="mailto:lists-christian@rudh.se">lists-christian@rudh.se</A>> wrote:
|
||
|
</I>><i> > Hi
|
||
|
</I>><i> >
|
||
|
</I>><i> > When drop a file on my application i get the URL in the following
|
||
|
</I>><i> > format:
|
||
|
</I>><i> >
|
||
|
</I>><i> > <A HREF="file:///home/user/song%20X.mp3">file:///home/user/song%20X.mp3</A>
|
||
|
</I>><i> >
|
||
|
</I>><i> > To be able to pass it on to Gst# (for example) I have to remove the
|
||
|
</I>><i> > file:// part and replace %20 with spaces (that goes for other special
|
||
|
</I>><i> > characters to). Is there any simple way to decode the string to a normal
|
||
|
</I>><i> > Unix path? Like the System.Web.HttpUtility.HTMLDecode that MS .NET has?
|
||
|
</I>><i>
|
||
|
</I>><i>
|
||
|
</I>--
|
||
|
Christian Rudh <<A HREF="mailto:lists-christian@rudh.se">lists-christian@rudh.se</A>>
|
||
|
|
||
|
|
||
|
</PRE>
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI> Previous message: <A HREF="005294.html">[Gtk-sharp-list] custom cell renderer
|
||
|
</A></li>
|
||
|
<LI> Next message: <A HREF="005290.html">[Gtk-sharp-list] Drag and drop path
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#5289">[ date ]</a>
|
||
|
<a href="thread.html#5289">[ thread ]</a>
|
||
|
<a href="subject.html#5289">[ subject ]</a>
|
||
|
<a href="author.html#5289">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
</body></html>
|