diff options
author | Jonh Wendell <jonh.wendell@linux.intel.com> | 2013-06-17 15:47:56 -0300 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2013-06-19 13:37:35 -0500 |
commit | 84b4910b39bdd85195887437445a8f089cda621f (patch) | |
tree | 0d6ef223d8634a5b09025d80eab187908968b89c /gtk/gtkfilechooser.c | |
parent | 159cccfe7b50e1e0fbede08132abfc74f4206fdb (diff) | |
download | gtk+-84b4910b39bdd85195887437445a8f089cda621f.tar.gz |
filechooser: Add gtk_file_chooser_get_current_name()
Currently you can only set the current filename, but not
get it. It's useful to be able to get it in save
dialogs, where the user has typed the desired filename
and you are not in a real directory (recent used, for
example).
https://bugzilla.gnome.org/show_bug.cgi?id=702497
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r-- | gtk/gtkfilechooser.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index 42bc0d22be..e199d3e070 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -1353,6 +1353,34 @@ gtk_file_chooser_set_current_name (GtkFileChooser *chooser, } /** + * gtk_file_chooser_get_current_name: + * @chooser: a #GtkFileChooser + * + * Gets the current name in the file selector, as entered by the user in the + * text entry for "Name". + * + * This is meant to be used in save dialogs, to get the currently typed filename + * when the file itself does not exist yet. For example, an application that + * adds a custom extra widget to the file chooser for "file format" may want to + * change the extension of the typed filename based on the chosen format, say, + * from ".jpg" to ".png". + * + * Returns: The raw text from the file chooser's "Name" entry. Free this with + * g_free(). Note that this string is not a full pathname or URI; it is + * whatever the contents of the entry are. Note also that this string is in + * UTF-8 encoding, which is not necessarily the system's encoding for filenames. + * + * Since: 3.10 + **/ +gchar * +gtk_file_chooser_get_current_name (GtkFileChooser *chooser) +{ + g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser)); + + return GTK_FILE_CHOOSER_GET_IFACE (chooser)->get_current_name (chooser); +} + +/** * gtk_file_chooser_get_uri: * @chooser: a #GtkFileChooser * |