+ // we get data in the text/uri-list format, i.e. as a sequence of URIs
+ // (filenames prefixed by "file:") delimited by "\r\n". size includes
+ // the trailing zero (in theory, not for Nautilus in early GNOME
+ // versions).
+
+ m_filenames.Empty();
+
+ const gchar *nexttemp = (const gchar*) buf;
+ for ( ; ; )
+ {
+ int len = 0;
+ const gchar *temp = nexttemp;
+ for (;;)
+ {
+ if (temp[len] == 0)
+ {
+ if (len > 0)
+ {
+ // if an app omits '\r''\n'
+ nexttemp = temp+len;
+ break;
+ }
+
+ return true;
+ }
+ if (temp[len] == '\r')
+ {
+ if (temp[len+1] == '\n')
+ nexttemp = temp+len+2;
+ else
+ nexttemp = temp+len+1;
+ break;
+ }
+ len++;
+ }
+
+ if (len == 0)
+ break;
+
+ // required to give it a trailing zero
+ gchar *uri = g_strndup( temp, len );
+
+ gchar *fn = g_filename_from_uri( uri, NULL, NULL );
+
+ g_free( uri );
+
+ if (fn)
+ {
+ AddFile( wxConvFileName->cMB2WX( fn ) );
+ g_free( fn );
+ }
+ }