1.1 --- a/src/gtkui/gtkcb.c Thu Jun 10 22:13:16 2010 +1000
1.2 +++ b/src/gtkui/gtkcb.c Sat Sep 11 09:58:22 2010 +1000
1.6 gchar *save_file_dialog( const char *title, const char *pattern, const char *patname,
1.7 - int initial_dir_key )
1.8 + const char *mandatory_ext, int initial_dir_key )
1.11 gchar *filename = NULL;
1.13 int result = gtk_dialog_run( GTK_DIALOG(file) );
1.14 if( result == GTK_RESPONSE_ACCEPT ) {
1.15 filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
1.16 + if( mandatory_ext ) {
1.17 + int extlen = strlen(mandatory_ext);
1.18 + int fnlen = strlen(filename);
1.19 + if( fnlen < extlen || strcmp(filename + (fnlen - extlen), mandatory_ext) != 0 ) {
1.20 + gchar *f2 = g_strdup_printf("%s%s",filename, mandatory_ext);
1.25 if( initial_dir_key != -1 ) {
1.26 gchar *end_path = gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER(file) );
1.27 set_gui_path(initial_dir_key,end_path);
1.31 void save_file_dialog_cb( const char *title, file_callback_t action, const char *pattern, const char *patname,
1.32 - int initial_dir_key )
1.33 + const char *mandatory_ext, int initial_dir_key )
1.35 - gchar *filename = save_file_dialog( title, pattern, patname, initial_dir_key );
1.36 + gchar *filename = save_file_dialog( title, pattern, patname, mandatory_ext, initial_dir_key );
1.37 if( filename != NULL ) {
1.42 void save_state_action_callback( GtkAction *action, gpointer user_data)
1.44 - save_file_dialog_cb( "Save state...", dreamcast_save_state, "*.dst", _("lxDream Save State (*.dst)"), CONFIG_SAVE_PATH );
1.45 + save_file_dialog_cb( "Save state...", dreamcast_save_state, "*.dst", _("lxDream Save State (*.dst)"), ".dst", CONFIG_SAVE_PATH );
1.48 void quick_state_action_callback( GtkRadioAction *action, GtkRadioAction *current, gpointer user_data)
1.51 void save_scene_action_callback( GtkAction *action, gpointer user_data)
1.53 - save_file_dialog_cb( _("Save next scene..."), pvr2_save_next_scene, "*.dsc", _("lxdream scene file (*.dsc)"), CONFIG_SAVE_PATH );
1.54 + save_file_dialog_cb( _("Save next scene..."), pvr2_save_next_scene, "*.dsc", _("lxdream scene file (*.dsc)"), ".dsc", CONFIG_SAVE_PATH );
1.57 int debug_window_get_selected_row( debug_window_t data );