Search
lxdream.org :: lxdream/src/gtkui/gtkcb.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/gtkcb.c
changeset 1124:aacaae9812ea
prev1109:700c5ab26a63
author nkeynes
date Fri Mar 02 23:49:10 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Android WIP:
* Rename gui_jni.c to gui_android.c - now quite android specific.
* Implement generic EGL driver with very minimal Java wrapper
* Run emulation in separate thread, and implement simple queue for
inter-thread communication.
* Add menu/action-bar items for start + reset
file annotate diff log raw
1.1 --- a/src/gtkui/gtkcb.c Thu Jun 10 22:13:16 2010 +1000
1.2 +++ b/src/gtkui/gtkcb.c Fri Mar 02 23:49:10 2012 +1000
1.3 @@ -76,7 +76,7 @@
1.4 }
1.5
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.9 {
1.10 GtkWidget *file;
1.11 gchar *filename = NULL;
1.12 @@ -97,6 +97,15 @@
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.21 + g_free(filename);
1.22 + filename = f2;
1.23 + }
1.24 + }
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.28 @@ -118,9 +127,9 @@
1.29 }
1.30
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.34 {
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.38 action(filename);
1.39 g_free(filename);
1.40 @@ -224,7 +233,7 @@
1.41
1.42 void save_state_action_callback( GtkAction *action, gpointer user_data)
1.43 {
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.46 }
1.47
1.48 void quick_state_action_callback( GtkRadioAction *action, GtkRadioAction *current, gpointer user_data)
1.49 @@ -316,7 +325,7 @@
1.50
1.51 void save_scene_action_callback( GtkAction *action, gpointer user_data)
1.52 {
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.55 }
1.56
1.57 int debug_window_get_selected_row( debug_window_t data );
.