Use a variant of the code from gtkfilesel.c to parse a "text/uri-list"

2004-04-15  Federico Mena Quintero  <federico@ximian.com>

	* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
	code from gtkfilesel.c to parse a "text/uri-list" blob.  Fixes
	#140126.
This commit is contained in:
Federico Mena Quintero 2004-04-15 19:17:50 +00:00 committed by Federico Mena Quintero
parent 647bba80a6
commit 6cb9668e69
6 changed files with 64 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
code from gtkfilesel.c to parse a "text/uri-list" blob. Fixes
#140126.
2004-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init):

View File

@ -1,3 +1,9 @@
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
code from gtkfilesel.c to parse a "text/uri-list" blob. Fixes
#140126.
2004-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init):

View File

@ -1,3 +1,9 @@
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
code from gtkfilesel.c to parse a "text/uri-list" blob. Fixes
#140126.
2004-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init):

View File

@ -1,3 +1,9 @@
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
code from gtkfilesel.c to parse a "text/uri-list" blob. Fixes
#140126.
2004-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init):

View File

@ -1,3 +1,9 @@
2004-04-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (split_uris): Use a variant of the
code from gtkfilesel.c to parse a "text/uri-list" blob. Fixes
#140126.
2004-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init):

View File

@ -2239,27 +2239,48 @@ shortcuts_drag_drop_cb (GtkWidget *widget,
return TRUE;
}
/* Converts raw selection data from text/uri-list to a list of strings */
/* Converts raw selection data from text/uri-list to a list of strings. */
static GSList *
split_uris (const char *data)
{
GSList *uris;
const char *p, *start;
const char *p, *q;
uris = NULL;
start = data;
p = data;
for (p = start; *p != 0; p++)
if (*p == '\r' && *(p + 1) == '\n')
/* We don't actually try to validate the URI according to RFC
* 2396, or even check for allowed characters - we just ignore
* comments and trim whitespace off the ends. We also
* allow LF delimination as well as the specified CRLF.
*
* We do allow comments like specified in RFC 2483.
*/
while (p)
{
char *name;
if (*p != '#')
{
while (g_ascii_isspace (*p))
p++;
name = g_strndup (start, p - start);
uris = g_slist_prepend (uris, name);
q = p;
while (*q && (*q != '\n') && (*q != '\r'))
q++;
start = p + 2;
p = start;
if (q > p)
{
q--;
while (q > p && g_ascii_isspace (*q))
q--;
if (q > p)
uris = g_slist_prepend (uris, g_strndup (p, q - p + 1));
}
}
p = strchr (p, '\n');
if (p)
p++;
}
uris = g_slist_reverse (uris);