void prefs_init(void) { guint i; MarkerStyle *style = pref_marker_styles; StashGroup *group; char *configdir = g_build_filename(geany->app->configdir, "plugins", "scope", NULL); char *configfile = prefs_file_name(); GKeyFile *config = g_key_file_new(); gchar *tmp_string; group = stash_group_new("scope"); stash_group_add_string(group, &pref_gdb_executable, "gdb_executable", "gdb"); stash_group_add_boolean(group, &pref_gdb_async_mode, "gdb_async_mode", FALSE); stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 16383); stash_group_add_integer(group, &pref_gdb_wait_death, "gdb_wait_death", 20); #ifndef G_OS_UNIX stash_group_add_integer(group, &pref_gdb_send_interval, "gdb_send_interval", 5); stash_group_add_boolean(group, &pref_async_break_bugs, "async_break_bugs", TRUE); #endif stash_group_add_boolean(group, &pref_auto_view_source, "auto_view_source", FALSE); stash_group_add_boolean(group, &pref_keep_exec_point, "keep_exec_point", FALSE); stash_group_add_integer(group, &pref_visual_beep_length, "visual_beep_length", 25); #ifdef G_OS_UNIX stash_group_add_boolean(group, &pref_debug_console_vte, "debug_console_vte", TRUE); #endif stash_group_add_integer(group, &pref_sci_marker_1st, "sci_marker_first", 17); stash_group_add_integer(group, &pref_sci_caret_policy, "sci_caret_policy", CARET_SLOP | CARET_JUMPS | CARET_EVEN); stash_group_add_integer(group, &pref_sci_caret_slop, "sci_caret_slop", 3); stash_group_add_boolean(group, &pref_unmark_current_line, "unmark_current_line", FALSE); stash_group_add_boolean(group, &pref_scope_goto_cursor, "scope_run_to_cursor", FALSE); stash_group_add_boolean(group, &pref_seek_with_navqueue, "seek_with_navqueue", FALSE); stash_group_add_integer(group, &pref_panel_tab_pos, "panel_tab_pos", GTK_POS_TOP); stash_group_add_integer(group, &pref_show_recent_items, "show_recent_items", 10); stash_group_add_integer(group, &pref_show_toolbar_items, "show_toolbar_items", 0xFF); stash_group_add_integer(group, &pref_tooltips_fail_action, "tooltips_fail_action", 0); stash_group_add_integer(group, &pref_tooltips_send_delay, "tooltips_send_delay", 25); stash_group_add_integer(group, &pref_tooltips_length, "tooltips_length", 2048); stash_group_add_integer(group, &pref_memory_bytes_per_line, "memory_line_bytes", 16); stash_group_add_string(group, &pref_memory_font, "memory_font", ""); scope_group = group; config_item = ui_add_config_file_menu_item(configfile, NULL, NULL); plugin_signal_connect(geany_plugin, NULL, "document-save", FALSE, G_CALLBACK(on_document_save), NULL); group = stash_group_new("terminal"); #ifdef G_OS_UNIX stash_group_add_boolean(group, &pref_terminal_save_pos, "save_pos", TRUE); stash_group_add_boolean(group, &pref_terminal_padding, "padding", TRUE); stash_group_add_integer(group, &pref_terminal_window_x, "window_x", 70); stash_group_add_integer(group, &pref_terminal_window_y, "window_y", 50); stash_group_add_integer(group, &pref_terminal_width, "width", 640); stash_group_add_integer(group, &pref_terminal_height, "height", 480); #endif /* G_OS_UNIX */ terminal_group = group; for (i = 0; i < MARKER_COUNT; i++, style++) { group = stash_group_new(style->name); stash_group_add_integer(group, &style->mark, "mark", style->default_mark); stash_group_add_integer(group, &style->alpha, "alpha", style->default_alpha); marker_group[i] = group; } g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); load_scope_prefs(config); pref_sci_marker_first = pref_sci_marker_1st; prefs_configure(); program_load_config(config); if (pref_panel_tab_pos == GTK_POS_LEFT || pref_panel_tab_pos == GTK_POS_RIGHT) { gtk_label_set_label(GTK_LABEL(get_widget("program_terminal_label")), _("Program")); gtk_label_set_label(GTK_LABEL(get_widget("break_view_label")), _("Breaks")); gtk_label_set_label(GTK_LABEL(get_widget("debug_console_label")), _("Console")); } if (!g_file_test(configfile, G_FILE_TEST_IS_REGULAR)) { gint error = utils_mkdir(configdir, TRUE); if (error) msgwin_status_add(_("Scope: %s: %s."), configdir, g_strerror(error)); else { save_scope_prefs(config); if (utils_key_file_write_to_file(config, configfile)) msgwin_status_add(_("Scope: created configuration file.")); } } g_key_file_free(config); g_free(configfile); g_free(configdir); configfile = g_build_filename(geany_data->app->configdir, "geany.conf", NULL); config = g_key_file_new(); g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); pref_vte_blinken = utils_get_setting_boolean(config, "VTE", "cursor_blinks", FALSE); pref_vte_emulation = utils_get_setting_string(config, "VTE", "emulation", "xterm"); pref_vte_font = utils_get_setting_string(config, "VTE", "font", "Monospace 10"); pref_vte_scrollback = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500); tmp_string = utils_get_setting_string(config, "VTE", "colour_fore", "#ffffff"); gdk_color_parse(tmp_string, &pref_vte_colour_fore); g_free(tmp_string); tmp_string = utils_get_setting_string(config, "VTE", "colour_back", "#000000"); gdk_color_parse(tmp_string, &pref_vte_colour_back); g_free(tmp_string); g_key_file_free(config); g_free(configfile); }
static void init_pref_groups(void) { StashGroup *group; group = stash_group_new(PACKAGE); configuration_add_pref_group(group, TRUE); stash_group_add_entry(group, &prefs.default_open_path, "default_open_path", "", "startup_path_entry"); stash_group_add_toggle_button(group, &file_prefs.cmdline_new_files, "cmdline_new_files", TRUE, "check_cmdline_new_files"); stash_group_add_toggle_button(group, &interface_prefs.notebook_double_click_hides_widgets, "notebook_double_click_hides_widgets", FALSE, "check_double_click_hides_widgets"); stash_group_add_toggle_button(group, &file_prefs.tab_close_switch_to_mru, "tab_close_switch_to_mru", FALSE, "check_tab_close_switch_to_mru"); stash_group_add_integer(group, &interface_prefs.tab_pos_sidebar, "tab_pos_sidebar", GTK_POS_TOP); stash_group_add_radio_buttons(group, &interface_prefs.sidebar_pos, "sidebar_pos", GTK_POS_LEFT, "radio_sidebar_left", GTK_POS_LEFT, "radio_sidebar_right", GTK_POS_RIGHT, NULL); /* editor display */ stash_group_add_toggle_button(group, &interface_prefs.highlighting_invert_all, "highlighting_invert_all", FALSE, "check_highlighting_invert"); stash_group_add_toggle_button(group, &search_prefs.use_current_word, "pref_main_search_use_current_word", TRUE, "check_search_use_current_word"); /* editor */ stash_group_add_toggle_button(group, &editor_prefs.indentation->detect_type, "check_detect_indent", FALSE, "check_detect_indent_type"); stash_group_add_toggle_button(group, &editor_prefs.indentation->detect_width, "detect_indent_width", FALSE, "check_detect_indent_width"); stash_group_add_toggle_button(group, &editor_prefs.use_tab_to_indent, "use_tab_to_indent", TRUE, "check_tab_key_indents"); stash_group_add_spin_button_integer(group, &editor_prefs.indentation->width, "pref_editor_tab_width", 4, "spin_indent_width"); stash_group_add_combo_box(group, (gint*)(void*)&editor_prefs.indentation->auto_indent_mode, "indent_mode", GEANY_AUTOINDENT_CURRENTCHARS, "combo_auto_indent_mode"); stash_group_add_radio_buttons(group, (gint*)(void*)&editor_prefs.indentation->type, "indent_type", GEANY_INDENT_TYPE_TABS, "radio_indent_spaces", GEANY_INDENT_TYPE_SPACES, "radio_indent_tabs", GEANY_INDENT_TYPE_TABS, "radio_indent_both", GEANY_INDENT_TYPE_BOTH, NULL); stash_group_add_radio_buttons(group, (gint*)(void*)&editor_prefs.show_virtual_space, "virtualspace", GEANY_VIRTUAL_SPACE_SELECTION, "radio_virtualspace_disabled", GEANY_VIRTUAL_SPACE_DISABLED, "radio_virtualspace_selection", GEANY_VIRTUAL_SPACE_SELECTION, "radio_virtualspace_always", GEANY_VIRTUAL_SPACE_ALWAYS, NULL); stash_group_add_toggle_button(group, &editor_prefs.autocomplete_doc_words, "autocomplete_doc_words", FALSE, "check_autocomplete_doc_words"); stash_group_add_toggle_button(group, &editor_prefs.completion_drops_rest_of_word, "completion_drops_rest_of_word", FALSE, "check_completion_drops_rest_of_word"); stash_group_add_spin_button_integer(group, (gint*)&editor_prefs.autocompletion_max_entries, "autocompletion_max_entries", GEANY_MAX_AUTOCOMPLETE_WORDS, "spin_autocompletion_max_entries"); stash_group_add_spin_button_integer(group, (gint*)&editor_prefs.autocompletion_update_freq, "autocompletion_update_freq", GEANY_MAX_SYMBOLS_UPDATE_FREQ, "spin_symbol_update_freq"); stash_group_add_string(group, &editor_prefs.color_scheme, "color_scheme", NULL); /* files */ stash_group_add_spin_button_integer(group, (gint*)&file_prefs.mru_length, "mru_length", GEANY_DEFAULT_MRU_LENGTH, "spin_mru"); stash_group_add_spin_button_integer(group, &file_prefs.disk_check_timeout, "disk_check_timeout", GEANY_DISK_CHECK_TIMEOUT, "spin_disk_check"); /* various geany prefs */ group = stash_group_new(PACKAGE); configuration_add_various_pref_group(group); stash_group_add_boolean(group, &editor_prefs.show_scrollbars, "show_editor_scrollbars", TRUE); stash_group_add_boolean(group, &editor_prefs.brace_match_ltgt, "brace_match_ltgt", FALSE); stash_group_add_boolean(group, &editor_prefs.use_gtk_word_boundaries, "use_gtk_word_boundaries", TRUE); stash_group_add_boolean(group, &editor_prefs.complete_snippets_whilst_editing, "complete_snippets_whilst_editing", FALSE); stash_group_add_boolean(group, &file_prefs.use_safe_file_saving, atomic_file_saving_key, FALSE); stash_group_add_boolean(group, &file_prefs.gio_unsafe_save_backup, "gio_unsafe_save_backup", FALSE); stash_group_add_boolean(group, &file_prefs.use_gio_unsafe_file_saving, "use_gio_unsafe_file_saving", TRUE); /* for backwards-compatibility */ stash_group_add_integer(group, &editor_prefs.indentation->hard_tab_width, "indent_hard_tab_width", 8); stash_group_add_integer(group, (gint*)&search_prefs.find_selection_type, "find_selection_type", GEANY_FIND_SEL_CURRENT_WORD); stash_group_add_string(group, &file_prefs.extract_filetype_regex, "extract_filetype_regex", GEANY_DEFAULT_FILETYPE_REGEX); /* Note: Interface-related various prefs are in ui_init_prefs() */ /* various build-menu prefs */ group = stash_group_new("build-menu"); configuration_add_various_pref_group(group); stash_group_add_integer(group, &build_menu_prefs.number_ft_menu_items, "number_ft_menu_items", 0); stash_group_add_integer(group, &build_menu_prefs.number_non_ft_menu_items, "number_non_ft_menu_items", 0); stash_group_add_integer(group, &build_menu_prefs.number_exec_menu_items, "number_exec_menu_items", 0); }
void program_init(void) { GtkWidget *widget; StashGroup *group = stash_group_new("program"); extern gboolean thread_select_on_running; extern gboolean thread_select_on_stopped; extern gboolean thread_select_on_exited; extern gboolean thread_select_follow; program_dialog = dialog_connect("program_dialog"); program_page_vbox = get_widget("program_page_vbox"); program_exec_entry = GTK_ENTRY(get_widget("program_executable_entry")); gtk_entry_set_max_length(program_exec_entry, PATH_MAX); stash_group_add_entry(group, &program_executable, "executable", "", program_exec_entry); ui_setup_open_button_callback(get_widget("program_executable_button"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, program_exec_entry); stash_group_add_entry(group, &program_arguments, "arguments", "", get_widget("program_arguments_entry")); widget = get_widget("program_environment"); environment = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)); stash_group_add_string(group, &program_environment, "environment", ""); working_dir_entry = GTK_ENTRY(get_widget("program_working_dir_entry")); gtk_entry_set_max_length(working_dir_entry, PATH_MAX); stash_group_add_entry(group, &program_working_dir, "working_dir", "", working_dir_entry); ui_setup_open_button_callback(get_widget("program_working_dir_button"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, working_dir_entry); load_script_entry = GTK_ENTRY(get_widget("program_load_script_entry")); gtk_entry_set_max_length(load_script_entry, PATH_MAX); stash_group_add_entry(group, &program_load_script, "load_script", "", load_script_entry); ui_setup_open_button_callback(get_widget("program_load_script_button"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, load_script_entry); auto_run_exit = get_widget("program_auto_run_exit"); stash_group_add_toggle_button(group, &program_auto_run_exit, "auto_run_exit", TRUE, auto_run_exit); stash_group_add_toggle_button(group, &program_non_stop_mode, "non_stop_mode", FALSE, get_widget("program_non_stop_mode")); temp_breakpoint = get_widget("program_temp_breakpoint"); stash_group_add_toggle_button(group, &program_temp_breakpoint, "temp_breakpoint", FALSE, temp_breakpoint); widget = get_widget("program_temp_break_location"); gtk_entry_set_max_length(GTK_ENTRY(widget), PATH_MAX + 0xFF); stash_group_add_entry(group, &program_temp_break_location, "temp_break_location", "", widget); program_group = group; delete_all_items = GTK_TOGGLE_BUTTON(get_widget("program_delete_all_items")); g_signal_connect(program_exec_entry, "changed", G_CALLBACK(on_program_name_entry_changed), NULL); g_signal_connect(load_script_entry, "changed", G_CALLBACK(on_program_name_entry_changed), NULL); g_signal_connect(temp_breakpoint, "toggled", G_CALLBACK(on_temp_breakpoint_toggled), widget); import_button = get_widget("program_import"); g_signal_connect(import_button, "clicked", G_CALLBACK(on_program_import_button_clicked), NULL); widget = get_widget("program_ok"); g_signal_connect(widget, "clicked", G_CALLBACK(on_program_ok_button_clicked), NULL); gtk_widget_grab_default(widget); group = stash_group_new("options"); stash_group_add_toggle_button(group, &option_open_panel_on_load, "open_panel_on_load", TRUE, get_widget("option_open_panel_on_load")); stash_group_add_toggle_button(group, &option_open_panel_on_start, "open_panel_on_start", TRUE, get_widget("option_open_panel_on_start")); stash_group_add_toggle_button(group, &option_update_all_views, "update_all_views", FALSE, get_widget("option_update_all_views")); stash_group_add_radio_buttons(group, &option_high_bit_mode, "high_bit_mode", HB_7BIT, get_widget("option_high_bit_mode_7bit"), HB_7BIT, get_widget("option_high_bit_mode_locale"), HB_LOCALE, get_widget("option_high_bit_mode_utf8"), HB_UTF8, NULL); stash_group_add_toggle_button(group, &option_member_names, "member_names", TRUE, get_widget("option_member_names")); stash_group_add_toggle_button(group, &option_argument_names, "argument_names", TRUE, get_widget("option_argument_names")); long_mr_format = GTK_BUTTON(get_widget("option_mr_long_mr_format")); stash_group_add_boolean(group, &option_long_mr_format, "long_mr_format", TRUE); LONG_MR_FORMAT[FALSE] = _("as _Name=value"); LONG_MR_FORMAT[TRUE] = _("as _Name = value"); g_signal_connect(long_mr_format, "clicked", G_CALLBACK(on_long_mr_format_clicked), NULL); stash_group_add_toggle_button(group, &option_inspect_expand, "inspect_expand", TRUE, get_widget("option_inspect_expand")); stash_group_add_spin_button_integer(group, &option_inspect_count, "inspect_count", 100, get_widget("option_inspect_count")); stash_group_add_toggle_button(group, &option_library_messages, "library_messages", FALSE, get_widget("option_library_messages")); stash_group_add_toggle_button(group, &option_editor_tooltips, "editor_tooltips", TRUE, get_widget("option_editor_tooltips")); stash_group_add_boolean(group, &stack_show_address, "stack_show_address", TRUE); options_group = group; group = stash_group_new("terminal"); #ifdef G_OS_UNIX stash_group_add_boolean(group, &terminal_auto_show, "auto_show", FALSE); stash_group_add_boolean(group, &terminal_auto_hide, "auto_hide", FALSE); stash_group_add_boolean(group, &terminal_show_on_error, "show_on_error", FALSE); #endif terminal_group = group; group = stash_group_new("thread"); stash_group_add_boolean(group, &thread_select_on_running, "select_on_running", FALSE); stash_group_add_boolean(group, &thread_select_on_stopped, "select_on_stopped", TRUE); stash_group_add_boolean(group, &thread_select_on_exited, "select_on_exited", TRUE); stash_group_add_boolean(group, &thread_select_follow, "select_follow", TRUE); stash_group_add_boolean(group, &thread_show_group, "show_group", TRUE); stash_group_add_boolean(group, &thread_show_core, "show_core", TRUE); thread_group = group; recent_programs = SCP_TREE_STORE(get_object("recent_program_store")); recent_bitmap = 0; recent_menu = get_widget("program_recent_menu"); }