forked from AuroraMiddleware/gtk
filechooser: Also convert get_uris() to returning native paths
It was only being done in gtk_file_chooser_get_uri(). Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
f907d16329
commit
7a93355977
@ -1228,6 +1228,22 @@ files_to_strings (GSList *files,
|
|||||||
return g_slist_reverse (strings);
|
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:
|
* gtk_file_chooser_get_filenames:
|
||||||
* @chooser: a #GtkFileChooser
|
* @chooser: a #GtkFileChooser
|
||||||
@ -1390,18 +1406,10 @@ gtk_file_chooser_get_uri (GtkFileChooser *chooser)
|
|||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (gtk_file_chooser_get_local_only (chooser))
|
if (gtk_file_chooser_get_local_only (chooser))
|
||||||
{
|
result = file_to_uri_with_native_path (file);
|
||||||
gchar *local = g_file_get_path (file);
|
|
||||||
if (local)
|
|
||||||
{
|
|
||||||
result = g_filename_to_uri (local, NULL, NULL);
|
|
||||||
g_free (local);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
result = g_file_get_uri (file);
|
result = g_file_get_uri (file);
|
||||||
}
|
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,7 +1580,11 @@ gtk_file_chooser_get_uris (GtkFileChooser *chooser)
|
|||||||
|
|
||||||
files = gtk_file_chooser_get_files (chooser);
|
files = gtk_file_chooser_get_files (chooser);
|
||||||
|
|
||||||
|
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);
|
result = files_to_strings (files, g_file_get_uri);
|
||||||
|
|
||||||
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
|
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
|
||||||
g_slist_free (files);
|
g_slist_free (files);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user