static void on_program_ok_button_clicked(G_GNUC_UNUSED GtkButton *button, G_GNUC_UNUSED gpointer gdata) { if (check_dialog_path(program_exec_entry, TRUE, R_OK | X_OK) && check_dialog_path(working_dir_entry, FALSE, X_OK) && check_dialog_path(load_script_entry, TRUE, R_OK)) { const gchar *program_name = gtk_entry_get_text(program_exec_entry); if (*program_name == '\0') program_name = gtk_entry_get_text(load_script_entry); if (utils_filenamecmp(program_name, *program_executable ? program_executable : program_load_script)) { save_program_settings(); } stash_foreach((GFunc) stash_group_update, NULL); option_long_mr_format = dialog_long_mr_format; g_free(program_environment); program_environment = utils_text_buffer_get_text(environment, -1); save_program_settings(); program_configure(); gtk_widget_hide(program_dialog); if (gtk_toggle_button_get_active(delete_all_items) && dialogs_show_question(_("Delete all breakpoints, watches and inspects?"))) { breaks_delete_all(); watches_delete_all(); inspects_delete_all(); } } }
void program_load_config(GKeyFile *config) { utils_load(config, "recent", recent_program_load); recent_menu_create(); config = g_key_file_new(); /* load from empty config file == set defaults */ stash_foreach((GFunc) stash_group_load_from_key_file, config); g_key_file_free(config); program_configure(); }
static void on_recent_menu_item_activate(G_GNUC_UNUSED GtkMenuItem *menuitem, const gchar *name) { GtkTreeIter iter; if (utils_filenamecmp(name, *program_executable ? program_executable : program_load_script) && program_find(&iter, name)) { gint id; char *configfile; GKeyFile *config = g_key_file_new(); GError *gerror = NULL; gchar *message; scp_tree_store_get(recent_programs, &iter, PROGRAM_ID, &id, -1); configfile = recent_file_name(id); if (g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, &gerror)) { scp_tree_store_move(recent_programs, &iter, 0); save_program_settings(); stash_foreach((GFunc) stash_group_load_from_key_file, config); if ((unsigned) option_inspect_expand > EXPAND_MAX) option_inspect_expand = 100; breaks_load(config); watches_load(config); inspects_load(config); registers_load(config); parse_load(config); message = g_strdup_printf(_("Loaded debug settings for %s."), name); program_find(&iter, name); scp_tree_store_move(recent_programs, &iter, 0); recent_menu_create(); program_configure(); } else { message = g_strdup_printf(_("Could not load debug settings file %s: %s."), configfile, gerror->message); g_error_free(gerror); } if (menuitem) ui_set_statusbar(TRUE, "%s", message); else msgwin_status_add("%s", message); g_free(message); g_key_file_free(config); g_free(configfile); } }
static void on_recent_menu_item_activate(G_GNUC_UNUSED GtkMenuItem *menuitem, const gchar *name) { RecentProgram *recent = (RecentProgram *) array_find(recent_programs, name, TRUE); if (recent && utils_filenamecmp(recent->name, *program_executable ? program_executable : program_load_script)) { char *configfile = recent_file_name(recent->id); GKeyFile *config = g_key_file_new(); GError *gerror = NULL; gchar *message; if (g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, &gerror)) { save_program_settings(); recent = (RecentProgram *) array_find(recent_programs, name, TRUE); stash_foreach((GFunc) stash_group_load_from_key_file, config); if ((unsigned) option_inspect_expand > EXPAND_MAX) option_inspect_expand = 100; breaks_load(config); watches_load(config); inspects_load(config); parse_load(config); message = g_strdup_printf(_("Loaded debug settings for %s."), recent->name); g_array_insert_vals(recent_programs, 0, ++recent, 1); array_remove(recent_programs, recent); recent_menu_create(); program_configure(); } else { message = g_strdup_printf(_("Could not load debug settings file %s: %s."), configfile, gerror->message); g_error_free(gerror); } if (menuitem) ui_set_statusbar(TRUE, "%s", message); else msgwin_status_add("%s", message); g_free(message); g_key_file_free(config); g_free(configfile); } }