mail-archives/gtk-sharp-list/2005-January/005289.html

136 строки
4.7 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:02:55 +03:00
<!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 (&quot;libgnomevfs-2.dll&quot;)]
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 (&quot;gnomevfssrc&quot;, &quot;disk_source&quot;);
filesrc.SetProperty (&quot;location&quot;, 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:
&gt;<i> I use this code:
</I>&gt;<i>
</I>&gt;<i> [DllImport (&quot;libgnomevfs-2.dll&quot;)]
</I>&gt;<i> private static extern IntPtr gnome_vfs_get_local_path_from_uri (string str);
</I>&gt;<i>
</I>&gt;<i> public static string LocalPathFromUri (string uri)
</I>&gt;<i> {
</I>&gt;<i> IntPtr p = gnome_vfs_get_local_path_from_uri (uri);
</I>&gt;<i>
</I>&gt;<i> if (p == IntPtr.Zero)
</I>&gt;<i> return null;
</I>&gt;<i> else
</I>&gt;<i> return GLib.Marshaller.PtrToStringGFree (p);
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i> (All credit goes to the Muine code where I found it =) ) I believe
</I>&gt;<i> gnome-vfs isn't part of gtk-sharp as of yet, so I'm not sure of
</I>&gt;<i> another way to do it.
</I>&gt;<i>
</I>&gt;<i> Mike.
</I>&gt;<i>
</I>&gt;<i> p.s. btw, if you are thinking of writing a C# music player, I'm also
</I>&gt;<i> writing one; perhaps we could team up -- or at least solve some of the
</I>&gt;<i> issues that come up -- drop me a line off-list if you are interested!
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> On Mon, 29 Nov 2004 19:08:26 +0100, Christian Rudh
</I>&gt;<i> &lt;<A HREF="mailto:lists-christian@rudh.se">lists-christian@rudh.se</A>&gt; wrote:
</I>&gt;<i> &gt; Hi
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; When drop a file on my application i get the URL in the following
</I>&gt;<i> &gt; format:
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; <A HREF="file:///home/user/song%20X.mp3">file:///home/user/song%20X.mp3</A>
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; To be able to pass it on to Gst# (for example) I have to remove the
</I>&gt;<i> &gt; file:// part and replace %20 with spaces (that goes for other special
</I>&gt;<i> &gt; characters to). Is there any simple way to decode the string to a normal
</I>&gt;<i> &gt; Unix path? Like the System.Web.HttpUtility.HTMLDecode that MS .NET has?
</I>&gt;<i>
</I>&gt;<i>
</I>--
Christian Rudh &lt;<A HREF="mailto:lists-christian@rudh.se">lists-christian@rudh.se</A>&gt;
</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>