Пример #1
0
void project_init(void)
{
	StashGroup *group;

	group = stash_group_new("indentation");
	/* defaults are copied from editor indent prefs */
	stash_group_set_use_defaults(group, FALSE);
	indent_group = group;

	stash_group_add_spin_button_integer(group, &indentation.width,
		"indent_width", 4, "spin_indent_width");
	stash_group_add_radio_buttons(group, (gint*)(gpointer)&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);
	/* This is a 'hidden' pref for backwards-compatibility */
	stash_group_add_integer(group, &indentation.hard_tab_width,
		"indent_hard_tab_width", 8);
	stash_group_add_toggle_button(group, &indentation.detect_type,
		"detect_indent", FALSE, "check_detect_indent_type");
	stash_group_add_toggle_button(group, &indentation.detect_width,
		"detect_indent_width", FALSE, "check_detect_indent_width");
	stash_group_add_combo_box(group, (gint*)(gpointer)&indentation.auto_indent_mode,
		"indent_mode", GEANY_AUTOINDENT_CURRENTCHARS, "combo_auto_indent_mode");
}
Пример #2
0
static void init_stash_prefs(void)
{
	StashGroup *group;
	GKeyFile *kf;

	group = stash_group_new("indentation");
	/* copy global defaults */
	indentation = *editor_get_indent_prefs(NULL);
	stash_group_set_use_defaults(group, FALSE);
	add_stash_group(group);

	stash_group_add_spin_button_integer(group, &indentation.width,
		"indent_width", 4, "spin_indent_width_project");
	stash_group_add_radio_buttons(group, (gint*)(gpointer)&indentation.type,
		"indent_type", GEANY_INDENT_TYPE_TABS,
		"radio_indent_spaces_project", GEANY_INDENT_TYPE_SPACES,
		"radio_indent_tabs_project", GEANY_INDENT_TYPE_TABS,
		"radio_indent_both_project", GEANY_INDENT_TYPE_BOTH,
		NULL);
	/* This is a 'hidden' pref for backwards-compatibility */
	stash_group_add_integer(group, &indentation.hard_tab_width,
		"indent_hard_tab_width", 8);
	stash_group_add_toggle_button(group, &indentation.detect_type,
		"detect_indent", FALSE, "check_detect_indent_type_project");
	stash_group_add_toggle_button(group, &indentation.detect_width,
		"detect_indent_width", FALSE, "check_detect_indent_width_project");
	stash_group_add_combo_box(group, (gint*)(gpointer)&indentation.auto_indent_mode,
		"indent_mode", GEANY_AUTOINDENT_CURRENTCHARS, "combo_auto_indent_mode_project");

	group = stash_group_new("file_prefs");
	stash_group_add_toggle_button(group, &priv.final_new_line,
		"final_new_line", file_prefs.final_new_line, "check_new_line1");
	stash_group_add_toggle_button(group, &priv.ensure_convert_new_lines,
		"ensure_convert_new_lines", file_prefs.ensure_convert_new_lines, "check_ensure_convert_new_lines1");
	stash_group_add_toggle_button(group, &priv.strip_trailing_spaces,
		"strip_trailing_spaces", file_prefs.strip_trailing_spaces, "check_trailing_spaces1");
	stash_group_add_toggle_button(group, &priv.replace_tabs,
		"replace_tabs", file_prefs.replace_tabs, "check_replace_tabs1");
	add_stash_group(group);
	/* apply defaults */
	kf = g_key_file_new();
	stash_group_load_from_key_file(group, kf);
	g_key_file_free(kf);
}