summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooser.c
diff options
context:
space:
mode:
authorTimothy Arceri <t_arceri@yahoo.com.au>2012-11-18 19:39:11 +1100
committerFederico Mena Quintero <federico@gnome.org>2013-03-05 17:17:42 -0600
commitcf216d780cb2c889a3bcb5faa825fc1b21af8896 (patch)
treedb43a9d8a94dc8488c0f7b91d6c486cb24cb0c60 /gtk/gtkfilechooser.c
parent9a1c54d580f09cce207cdc7d7d98062ce7c4f189 (diff)
downloadgtk+-cf216d780cb2c889a3bcb5faa825fc1b21af8896.tar.gz
filechooser: Show FUSE mounted locations in shortcuts
Since FUSE locations can be handled safely by applications show these mounted locations regardless of whether gtk_file_chooser_set_local_only() is set to TRUE https://bugzilla.gnome.org/show_bug.cgi?id=586367
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r--gtk/gtkfilechooser.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c
index 8e2d64da4c..820db562bf 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -907,6 +907,10 @@ gtk_file_chooser_get_action (GtkFileChooser *chooser)
* rather than the URI functions like
* gtk_file_chooser_get_uri(),
*
+ * On some systems non-native files may still be
+ * available using the native filesystem via a userspace
+ * filesystem (FUSE).
+ *
* Since: 2.4
**/
void
@@ -1345,7 +1349,9 @@ gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
* folder.
*
* Return value: The currently selected URI, or %NULL
- * if no file is selected. Free with g_free()
+ * if no file is selected. If gtk_file_chooser_set_local_only() is set to %TRUE
+ * (the default) a local URI will be returned for any FUSE locations.
+ * Free with g_free()
*
* Since: 2.4
**/
@@ -1360,7 +1366,19 @@ gtk_file_chooser_get_uri (GtkFileChooser *chooser)
file = gtk_file_chooser_get_file (chooser);
if (file)
{
- result = g_file_get_uri (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);
+ }
+ }
+ else
+ {
+ result = g_file_get_uri (file);
+ }
g_object_unref (file);
}