return g_slist_reverse (strings);
}
+static gchar *
+file_to_uri_with_native_path (GFile *file)
+{
+ gchar *result = NULL;
+ gchar *native;
+
+ native = g_file_get_path (file);
+ if (native)
+ {
+ result = g_filename_to_uri (native, NULL, NULL); /* NULL-GError */
+ g_free (native);
+ }
+
+ return result;
+}
+
/**
* gtk_file_chooser_get_filenames:
* @chooser: a #GtkFileChooser
if (file)
{
if (gtk_file_chooser_get_local_only (chooser))
- {
- gchar *local = g_file_get_path (file);
- if (local)
- {
- result = g_filename_to_uri (local, NULL, NULL);
- g_free (local);
- }
- }
+ result = file_to_uri_with_native_path (file);
else
- {
result = g_file_get_uri (file);
- }
+
g_object_unref (file);
}
files = gtk_file_chooser_get_files (chooser);
- result = files_to_strings (files, g_file_get_uri);
+ if (gtk_file_chooser_get_local_only (chooser))
+ result = files_to_strings (files, file_to_uri_with_native_path);
+ else
+ result = files_to_strings (files, g_file_get_uri);
+
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
g_slist_free (files);