After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702497 - Add gtk_file_chooser_get_current_name()
Add gtk_file_chooser_get_current_name()
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Reported: 2013-06-17 17:49 UTC by Jonh Wendell
Modified: 2013-06-19 18:56 UTC
See Also:
GNOME target: ---
GNOME version: ---

proposed patch (7.00 KB, patch)
2013-06-17 18:51 UTC, Jonh Wendell
none Details | Review

Description Jonh Wendell 2013-06-17 17:49:55 UTC
Similar to gtk_file_chooser_set_current_name(), it would be nice to have gtk_file_chooser_get_current_name() to get the currently typed filename in Save dialogs.
Comment 1 Jonh Wendell 2013-06-17 18:51:43 UTC
Created attachment 247060 [details] [review]
proposed patch
Comment 2 Federico Mena Quintero 2013-06-19 15:48:06 UTC
Thanks!  I like the symmetry that this gives to the API.

One quick question:  How do you envision using the text from the filename entry as entered by the user?  It could contain things like "~/Something/blah.txt" that you need to parse yourself.
Comment 3 Jonh Wendell 2013-06-19 15:57:23 UTC
indeed, I'd need to parse that myself.

one use case is: the dialog is opened in 'recent used' mode, so, there's no physical directory (get_filename() would return null).

then the user would save an image, he set the name 'image.png' and the realizes it can change the format to jpg, by clicking in a combobox custom widget. the callback function would get the filename and change only the extension part.
Comment 4 Federico Mena Quintero 2013-06-19 18:56:24 UTC
Nice use case.  I've pushed your patch with two changes:

- Make get_current_name() return a non-const gchar *, to be consistent with the rest of the file chooser.

- Minor tweaks to the docstring.

This is in master in commit 84b4910b39bdd.