comparison src/xs_config.c @ 898:212d4738438d

Use the message box dialog, inform user when the path is not a directory when returning from file selector of HVSC or ROM paths. Adjust path to the "most likely" one.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 09 Nov 2012 08:28:35 +0200
parents cfc20df88401
children eba5d47edc13
comparison
equal deleted inserted replaced
897:cfc20df88401 898:212d4738438d
1108 1108
1109 void xs_hvsc_fs_ok(GtkButton *button, gpointer user_data) 1109 void xs_hvsc_fs_ok(GtkButton *button, gpointer user_data)
1110 { 1110 {
1111 (void) button; 1111 (void) button;
1112 (void) user_data; 1112 (void) user_data;
1113 1113 gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector));
1114 /* Selection was accepted! */ 1114 if (!xs_is_dir_path(result))
1115 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), 1115 {
1116 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector))); 1116 path = xs_get_dir_path(result);
1117 xs_messagebox("Warning",
1118 "Selected HVSC path '%s' does not seem like a path, adjusting to '%s'.\n",
1119 result, path);
1120 }
1121 else
1122 path = result;
1123
1124 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), path);
1117 1125
1118 /* Close file selector window */ 1126 /* Close file selector window */
1119 gtk_widget_destroy(xs_hvsc_selector); 1127 gtk_widget_destroy(xs_hvsc_selector);
1120 xs_hvsc_selector = NULL; 1128 xs_hvsc_selector = NULL;
1121 } 1129 }
1148 1156
1149 void xs_rom_fs_ok(GtkButton *button, gpointer user_data) 1157 void xs_rom_fs_ok(GtkButton *button, gpointer user_data)
1150 { 1158 {
1151 (void) button; 1159 (void) button;
1152 (void) user_data; 1160 (void) user_data;
1153 1161 gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_rom_selector));
1154 /* Selection was accepted! */ 1162 if (!xs_is_dir_path(result))
1155 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_rom_path")), 1163 {
1156 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_rom_selector))); 1164 path = xs_get_dir_path(result);
1165 xs_messagebox("Warning",
1166 "Selected ROM path '%s' does not seem like a path, adjusting to '%s'.\n",
1167 result, path);
1168 }
1169 else
1170 path = result;
1171
1172 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_rom_path")), path);
1157 1173
1158 /* Close file selector window */ 1174 /* Close file selector window */
1159 gtk_widget_destroy(xs_rom_selector); 1175 gtk_widget_destroy(xs_rom_selector);
1160 xs_rom_selector = NULL; 1176 xs_rom_selector = NULL;
1161 } 1177 }