* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
* However, filenames are <emphasis>always</emphasis> returned in
* the character set specified by the
* <envar>G_FILENAME_ENCODING</envar> environment variable.
- * Please see the Glib documentation for more details about this
+ * Please see the GLib documentation for more details about this
* variable.
* <note>
* This means that while you can pass the result of
* </example>
* <note>
* If you want to set more than one extra widget in the file
- * chooser, you can a container such as a #GtkVBox or a #GtkTable
+ * chooser, you can a container such as a #GtkBox or a #GtkGrid
* and include your widgets in it. Then, set the container as
* the whole extra widget.
* </note>
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);