Re: Accessing filenames from file choosers



On Tue, Apr 11, 2006 at 11:48:17AM +0100, Ross Clement wrote:
I create a few file chooser dialogs. These were set up in glade. I can
make the dialogs appear, use them, and then make them disappear again.
What I can't do is fetch the selected filename from the dialog.

Looking around it seems that I should use the function

gtk_file_selection_get_filename((GtkFileSelection *)fs);

No, you should not.  GtkFileSelection is the old file
selector, GtkFileChooser is the new one, they are two
completely different classes.  You have to use
GtkFileChooser methods, see

http://developer.gnome.org/doc/API/2.0/gtk/GtkFileChooser.html

There you can easily find gtk_file_chooser_get_filename()
and gtk_file_chooser_get_filenames().

BTW your typecasting is evil.  You can always disable the
type checks GTK_FOO(foo) normally performs by defining
G_DISABLE_CAST_CHECKS, but you can never enable type checks
for raw (GtkFoo*)foo casts.

Yeti


--
That's enough.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]