static UI_CALLBACK(load_save_fliplist) { char *filename, *title; int what = (int)UI_MENU_CB_PARAM; ui_button_t button; vsync_suspend_speed_eval(); title = util_concat(what ? _("Load ") : _("Save"), _("Fliplist File"), NULL); filename = ui_select_file(title, NULL, 0, 0, load_save_fliplist_last_dir, "*.vfl", &button, 1, NULL); lib_free(title); switch (button) { case UI_BUTTON_OK: if (what) { if (fliplist_load_list((unsigned int)-1, filename, 0) == 0) ui_message(_("Successfully read `%s'."), filename); else ui_error(_("Error reading `%s'."), filename); } else { if (fliplist_save_list((unsigned int)-1, filename) == 0) ui_message(_("Successfully wrote `%s'."), filename); else ui_error(_("Error writing `%s'."), filename); } if (load_save_fliplist_last_dir) lib_free(load_save_fliplist_last_dir); util_fname_split(filename, &load_save_fliplist_last_dir, NULL); break; default: break; } }
static BOOL FdmDoSaveAction(HWND hwnd, char *szpath, int act, int sact) { switch (act) { case 0: check_extension(szpath, ".cfg"); return resources_save(szpath); case 1: check_extension(szpath, ".vsf"); return trap(hwnd, save_snapshot, szpath); case 2: switch (sact) { case 0: check_extension(szpath, ".png"); break; case 1: check_extension(szpath, ".bmp"); break; } return trap(hwnd, save_screenshot, szpath); case 3: check_extension(szpath, ".vfl"); return fliplist_save_list(sact+8, szpath); case 4: return machine_romset_file_save(szpath); } return -1; }
static UI_CALLBACK(load_save_fliplist) { char *filename, *title; int what = vice_ptr_to_int(UI_MENU_CB_PARAM); ui_button_t button; uilib_file_filter_enum_t filter[] = { UILIB_FILTER_FLIPLIST, UILIB_FILTER_ALL }; vsync_suspend_speed_eval(); title = util_concat(what ? _("Load ") : _("Save"), _("Flip list file"), NULL); filename = ui_select_file(title, NULL, 0, load_save_fliplist_last_dir, filter, sizeof(filter) / sizeof(*filter), &button, 1, NULL, what ? UI_FC_LOAD : UI_FC_SAVE); lib_free(title); switch (button) { case UI_BUTTON_OK: if (what) { if (fliplist_load_list(FLIPLIST_ALL_UNITS, filename, 0) == 0) { ui_message(_("Successfully read `%s'."), filename); } else { ui_error(_("Error reading `%s'."), filename); } } else { if (fliplist_save_list(FLIPLIST_ALL_UNITS, filename) == 0) { ui_message(_("Successfully wrote `%s'"), filename); } else { ui_error(_("Error writing `%s'."), filename); } } lib_free(load_save_fliplist_last_dir); util_fname_split(filename, &load_save_fliplist_last_dir, NULL); break; default: break; } }
static void fliplist_save_response(GtkWidget *widget, gint response_id, gpointer user_data) { int unit = GPOINTER_TO_INT(user_data); gchar *filename; filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); if (response_id == GTK_RESPONSE_ACCEPT) { fliplist_save_list(unit, filename); } gtk_widget_destroy(widget); }
static UI_CALLBACK(save_resources) { char *fname; vsync_suspend_speed_eval(); if (resources_save(NULL) < 0) { ui_error(_("Cannot save settings.")); }else { if (w != NULL) { ui_message(_("Settings saved successfully.")); } } fname = archdep_default_fliplist_file_name(); fliplist_save_list((unsigned int) -1, fname); lib_free(fname); ui_update_menus(); }