Results 1 to 1 of 1
I'm trying to save a Pixbuf to a file with a FileChooserDialog in SAVE mode but am running into a problem that I can't figure out.
Here's my code:
Code:
...
- 09-24-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 1
Gtkmm Save Dialog problem
I'm trying to save a Pixbuf to a file with a FileChooserDialog in SAVE mode but am running into a problem that I can't figure out.
Here's my code:
When I try to get the filter name from the dialog, I get the following messages:Code:void GUI::saveDialog () { FileChooserDialog dialog ("Save...", FILE_CHOOSER_ACTION_SAVE); dialog.set_transient_for (*this); dialog.set_do_overwrite_confirmation (true); dialog.set_create_folders (true); dialog.add_button (GTK_STOCK_CANCEL, RESPONSE_CANCEL); dialog.add_button (GTK_STOCK_SAVE, RESPONSE_OK); vector<PixbufFormat> formats = Pixbuf::get_formats (); for (unsigned int i=0 ; i<formats.size() ; i++) { if (formats[i].is_writable()) { FileFilter filter; filter.set_name (formats[i].get_name()); vector<string> patterns = formats[i].get_extensions(); for (unsigned int j=0 ; j<patterns.size() ; j++) { filter.add_pattern (patterns[j]); } dialog.add_filter (filter); } } dialog.set_current_folder (folder); dialog.set_current_name (getSaveFilename ()); if (dialog.run () == RESPONSE_OK) { string filename = dialog.get_filename (); FileFilter* filter = dialog.get_filter (); const gchar* filterName = gtk_file_filter_get_name (filter->gobj()); if (filename.find_last_of ('.') == string::npos) { filename += "."; filename += filterName; } save (filename, filterName); } }
I get the same messages if I use gtkmm's dialog.get_filter()->get_name(). I tried using the gtk+ to see if I could get it to work that way but came up with the same messages.Code:(CompareProfiles:12142): glibmm-WARNING **: Glib::wrap_create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted. (CompareProfiles:12142): glibmm-WARNING **: Failed to wrap object of type 'gtkmm__GtkFileFilter'. Hint: this error is commonly caused by failing to call a library init() function.

Any ideas on what I am doing wrong? Any help is greatly appreciated!


Reply With Quote