GType iface_type = G_TYPE_FROM_INTERFACE (iface);
/**
- * GtkFileChooser::current-folder-changed
+ * GtkFileChooser::current-folder-changed:
* @chooser: the object which received the signal.
*
* This signal is emitted when the current folder in a #GtkFileChooser
G_TYPE_NONE, 0);
/**
- * GtkFileChooser::selection-changed
+ * GtkFileChooser::selection-changed:
* @chooser: the object which received the signal.
*
* This signal is emitted when there is a change in the set of selected files
G_TYPE_NONE, 0);
/**
- * GtkFileChooser::update-preview
+ * GtkFileChooser::update-preview:
* @chooser: the object which received the signal.
*
* This signal is emitted when the preview in a file chooser should be
G_TYPE_NONE, 0);
/**
- * GtkFileChooser::file-activated
+ * GtkFileChooser::file-activated:
* @chooser: the object which received the signal.
*
* This signal is emitted when the user "activates" a file in the file
* 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
* @chooser: a #GtkFileChooser
*
* Gets the filename for the currently selected file in
- * the file selector. If multiple files are selected,
- * one of the filenames will be returned at random.
+ * the file selector. The filename is returned as an absolute path. If
+ * multiple files are selected, one of the filenames will be returned at
+ * random.
*
* If the file chooser is in folder mode, this function returns the selected
* folder.
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
* 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
**/
file = gtk_file_chooser_get_file (chooser);
if (file)
{
- result = g_file_get_uri (file);
+ if (gtk_file_chooser_get_local_only (chooser))
+ 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);