Index: src/nautilus-emblem-sidebar.c =================================================================== --- src/nautilus-emblem-sidebar.c (revisione 13269) +++ src/nautilus-emblem-sidebar.c (copia locale) @@ -727,12 +727,13 @@ nautilus_emblem_sidebar_drag_received_cb Emblem *emblem; GdkPixbuf *pixbuf; char *uri, *error, *uri_utf8; - GList *uris, *l; + char **uris; + int i; gboolean had_failure; had_failure = FALSE; emblems = NULL; - + switch (info) { case TARGET_URI_LIST: if (data->format != 8 || @@ -742,12 +743,13 @@ nautilus_emblem_sidebar_drag_received_cb return; } - uris = nautilus_icon_dnd_uri_list_extract_uris (data->data); - l = uris; - while (l != NULL) { - uri = eel_make_uri_canonical (l->data); - l = l->next; + uris = g_uri_list_extract_uris (data->data); + if (uris == NULL) { + break; + } + for (i = 0; uris[i] != NULL; ++i) { + uri = eel_make_uri_canonical (uris[i]); if (uri == NULL) { had_failure = TRUE; continue; @@ -771,7 +773,8 @@ nautilus_emblem_sidebar_drag_received_cb emblems = g_slist_prepend (emblems, emblem); } - nautilus_icon_dnd_uri_list_free_strings (uris); + + g_strfreev (uris); if (had_failure && emblems != NULL) { eel_show_error_dialog (_("Some of the files could not be added as emblems."), _("The emblems do not appear to be valid images."), NULL); @@ -842,16 +845,15 @@ nautilus_emblem_sidebar_drag_received_cb /* apparently, this is a URI/title pair? or just a pair * of identical URIs? Regardless, this seems to work... */ - uris = nautilus_icon_dnd_uri_list_extract_uris (data->data); + uris = g_uri_list_extract_uris (data->data); if (uris == NULL) { break; } - - uri = uris->data; + uri = uris[0]; if (uri == NULL) { - nautilus_icon_dnd_uri_list_free_strings (uris); + g_strfreev (uris); break; } @@ -874,6 +876,9 @@ nautilus_emblem_sidebar_drag_received_cb eel_show_error_dialog (_("The emblem cannot be added."), error, NULL); g_free (error); } + + g_strfreev (uris); + break; } } Index: src/nautilus-location-bar.c =================================================================== --- src/nautilus-location-bar.c (revisione 13269) +++ src/nautilus-location-bar.c (copia locale) @@ -117,7 +117,7 @@ drag_data_received_callback (GtkWidget * guint32 time, gpointer callback_data) { - GList *names, *node; + char **names; NautilusApplication *application; int name_count; NautilusWindow *new_window; @@ -131,9 +131,9 @@ drag_data_received_callback (GtkWidget * g_assert (data != NULL); g_assert (callback_data == NULL); - names = nautilus_icon_dnd_uri_list_extract_uris (data->data); + names = g_uri_list_extract_uris (data->data); - if (names == NULL) { + if (names == NULL || *names == NULL) { g_warning ("No D&D URI's"); gtk_drag_finish (context, FALSE, FALSE, time); return; @@ -145,7 +145,7 @@ drag_data_received_callback (GtkWidget * * for multiple dropped URIs. This is likely to have been * a mistake. */ - name_count = g_list_length (names); + name_count = g_strv_length (names); if (name_count > 1) { prompt = g_strdup_printf (ngettext("Do you want to view %d location?", "Do you want to view %d locations?", @@ -176,20 +176,22 @@ drag_data_received_callback (GtkWidget * } nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (widget), - names->data); + names[0]); nautilus_navigation_bar_location_changed (NAUTILUS_NAVIGATION_BAR (widget)); if (new_windows_for_extras) { + int i; + application = NAUTILUS_WINDOW (window)->application; screen = gtk_window_get_screen (GTK_WINDOW (window)); - for (node = names->next; node != NULL; node = node->next) { + for (i = 1; names[i] != NULL; ++i) { new_window = nautilus_application_create_navigation_window (application, NULL, screen); - nautilus_window_go_to (new_window, node->data); + nautilus_window_go_to (new_window, names[i]); } } - nautilus_icon_dnd_uri_list_free_strings (names); + g_strfreev (names); gtk_drag_finish (context, TRUE, FALSE, time); } Index: libnautilus-private/nautilus-icon-dnd.c =================================================================== --- libnautilus-private/nautilus-icon-dnd.c (revisione 13269) +++ libnautilus-private/nautilus-icon-dnd.c (copia locale) @@ -1639,74 +1639,6 @@ nautilus_icon_dnd_end_drag (NautilusIcon */ } -/** - * implements the gnome 1.x gnome_vfs_uri_list_extract_uris(), which - * returns a GList of char *uris. - **/ -GList * -nautilus_icon_dnd_uri_list_extract_uris (const char *uri_list) -{ - /* Note that this is mostly very stolen from old libgnome/gnome-mime.c */ - - const gchar *p, *q; - gchar *retval; - GList *result = NULL; - - g_return_val_if_fail (uri_list != NULL, NULL); - - p = uri_list; - - /* 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. - */ - while (p != NULL) { - if (*p != '#') { - while (g_ascii_isspace (*p)) - p++; - - q = p; - while ((*q != '\0') - && (*q != '\n') - && (*q != '\r')) - q++; - - if (q > p) { - q--; - while (q > p - && g_ascii_isspace (*q)) - q--; - - retval = g_malloc (q - p + 2); - strncpy (retval, p, q - p + 1); - retval[q - p + 1] = '\0'; - - result = g_list_prepend (result, retval); - } - } - p = strchr (p, '\n'); - if (p != NULL) - p++; - } - - return g_list_reverse (result); -} - -/** - * nautilus_icon_dnd_uri_list_free_strings: - * @list: A GList returned by nautilus_icon_dnd_uri_list_extract_uris() - * - * Releases all of the resources allocated by @list. - * - * stolen from gnome-mime.c - */ -void -nautilus_icon_dnd_uri_list_free_strings (GList *list) -{ - eel_g_list_free_deep (list); -} - /** this callback is called in 2 cases. It is called upon drag_motion events to get the actual data In that case, it just makes sure it gets the data. Index: libnautilus-private/nautilus-icon-dnd.h =================================================================== --- libnautilus-private/nautilus-icon-dnd.h (revisione 13269) +++ libnautilus-private/nautilus-icon-dnd.h (copia locale) @@ -59,7 +59,4 @@ void nautilus_icon_dnd_begin_drag int start_y); void nautilus_icon_dnd_end_drag (NautilusIconContainer *container); -GList *nautilus_icon_dnd_uri_list_extract_uris (const char *uri_list); -void nautilus_icon_dnd_uri_list_free_strings (GList *list); - #endif /* NAUTILUS_ICON_DND_H */