#include <windows.h>
#endif
#include <gtkmm/accelmap.h>
+#include <gtkmm/filechooser.h>
+#include <gtkmm/filechooserdialog.h>
#endif
if(!_preferences.get_value("curr_path",prev_path))
prev_path=".";
+ Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_OPEN);
+ dialog->set_current_folder(prev_path);
+ dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT);
+ dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL);
+ if(!filename.empty())
+ dialog->set_filename(filename);
+ if(dialog->run()==GTK_RESPONSE_ACCEPT) {
+ filename=dialog->get_filename();
+ delete dialog;
+ return true;
+ }
+ delete dialog;
+ return false;
+ /*
+
GtkWidget *ok;
GtkWidget *cancel;
int val=0;
}
gtk_widget_destroy(fileselection);
return true;
+ */
#endif
}
}
return false;
#else
- return dialog_open_file(title, filename);
+ synfig::String prev_path;
+ if(!_preferences.get_value("curr_path",prev_path))
+ prev_path=".";
+
+ Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_SAVE);
+ dialog->set_current_folder(prev_path);
+ dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT);
+ dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL);
+ if(!filename.empty())
+ dialog->set_filename(filename);
+ if(dialog->run()==GTK_RESPONSE_ACCEPT) {
+ filename=dialog->get_filename();
+ delete dialog;
+ return true;
+ }
+ delete dialog;
+ return false;
+// return dialog_open_file(title, filename);
#endif
}
}
return false;
#else
- return dialog_open_file(title, filename);
+ synfig::String prev_path;
+ if(!_preferences.get_value("curr_path",prev_path))
+ prev_path=".";
+
+ Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_SAVE);
+ dialog->set_current_folder(prev_path);
+ dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT);
+ dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL);
+ if(!filename.empty())
+ dialog->set_filename(filename);
+ if(dialog->run()==GTK_RESPONSE_ACCEPT) {
+ filename=dialog->get_filename();
+ delete dialog;
+ return true;
+ }
+ delete dialog;
+ return false;
+// return dialog_open_file(title, filename);
#endif
}