GNOME Bugzilla – Bug 149388
FileChooserDialog does not have any action buttons
Last modified: 2004-12-22 21:47:04 UTC
I'm using gtkmm 2.4.4 with glibm 2.4.3 and libsigc++ 2.0.3, running on a SuSE 9.0 with gcc 3.3.1. When I create and run any FileChooserDialog widget, it is missing the buttons for actually doint something (Open/Save/Cancel). Everything else is working fine (navigation etc.), I just can't choose a file. FileChooserDialogs created with glade or directly from Gtk+ seem to work, so I figure it's either a problem with gtkmm or with me. I will provide a sample file.
Created attachment 30236 [details] sample code to reproduce this bug The promised sample code.
I don't believe that FileChoosers created in C with GTK+ have any action buttons by default - maybe you have a C test case that shows that.
It's not created with any default buttons, you have to pass a list of buttons in gtk_file_chooser_dialog_new() instead. But there's no way to do this in the gtkmm widget, the constructor does not take arguments other than parent window, title and action. Do I have to add them separately using Dialog::add_button()? I tried this, the buttons are displayed and even activated when I double-click on a file, but the dialog doesn't return from run() anyways. I will post both a working GTK+ and the updated non-working gtkmm example.
Created attachment 30270 [details] updated gtkmm example
Created attachment 30271 [details] working gtk+ example
In your GTK+ example, you are specifying the buttons in your call to gtk_file_chooser_dialog_new(), in the C ... arguments. The equivalent in our C++ API is to use add_button(). Please reopen this bug if I have misunderstood.
You are right, it works fine this way. My mistake, sorry. Is there any way a constructor will be added that mirrors the Gtk+ gtk_file_chooser_dialog_new() function w/o the need to use add_button()? Similarly, it would be helpful to have an additional constructor for FileFilter like this: FileFilter(const ustring& name, const ustring& pattern), at the moment one has to write 4 lines of code to add a single filter to a FileChooser which is really annoying. If you wish I could file a new 'enhancement' bug for this to separate it from this one.