Exemple #1
0
void prefs_finalize(void)
{
	guint i;

#ifdef G_OS_UNIX
	if (pref_terminal_save_pos)
	{
		char *configfile = prefs_file_name();
		stash_group_save_to_file(terminal_group, configfile, G_KEY_FILE_KEEP_COMMENTS);
		g_free(configfile);
	}

	g_free(pref_vte_font);
	g_free(pref_vte_emulation);
#endif  /* G_OS_UNIX */

	gtk_widget_destroy(config_item);
	utils_stash_group_free(scope_group);
	utils_stash_group_free(terminal_group);
	for (i = 0; i < MARKER_COUNT; i++)
		utils_stash_group_free(marker_group[i]);

#ifdef stash_tree_setup
	g_ptr_array_free(pref_groups, TRUE);
#endif
}
Exemple #2
0
static void on_configure_response(G_GNUC_UNUSED GtkDialog *dialog, gint response,
	gpointer gdata)
{
	if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
	{
		char *configfile = prefs_file_name();

		stash_tree_update(GTK_TREE_VIEW(gdata));
		prefs_configure();
		scope_configure();
		stash_group_save_to_file(scope_group, configfile, G_KEY_FILE_KEEP_COMMENTS);
		g_free(configfile);
	}
}
Exemple #3
0
void program_finalize(void)
{
	char *configfile = prefs_file_name();
	GKeyFile *config = g_key_file_new();

	save_program_settings();
	g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
	store_save(recent_programs, config, "recent", recent_program_save);
	utils_key_file_write_to_file(config, configfile);
	g_key_file_free(config);
	g_free(configfile);

	gtk_widget_destroy(program_dialog);
	stash_foreach((GFunc) stash_group_destroy, NULL);
}
Exemple #4
0
static void on_document_save(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc,
	G_GNUC_UNUSED gpointer gdata)
{
	char *configfile = prefs_file_name();

	if (doc->real_path && !utils_filenamecmp(doc->real_path, configfile))
	{
		GKeyFile *config = g_key_file_new();

		g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
		load_scope_prefs(config);
		prefs_configure();
		scope_configure();
		g_key_file_free(config);
	}
	g_free(configfile);
}
Exemple #5
0
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);
}