Kaydet (Commit) db1c496e authored tarafından Enrico Tröger's avatar Enrico Tröger

improved HAVE_VTE handling to prevent crashes


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@62 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 1390469e
......@@ -90,9 +90,11 @@ void configuration_save(void)
g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages);
g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", app->auto_close_xml_tags);
g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", app->auto_complete_constructs);
#ifdef HAVE_VTE
g_key_file_set_comment(config, PACKAGE, "terminal_settings",
_(" VTE settings: FONT;FOREGROUND;BACKGROUND;scrollback;type;scroll on keystroke;scroll on output"), NULL);
g_key_file_set_string(config, PACKAGE, "terminal_settings", app->terminal_settings);
#endif
g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font);
g_key_file_set_string(config, PACKAGE, "tagbar_font", app->tagbar_font);
g_key_file_set_string(config, PACKAGE, "msgwin_font", app->msgwin_font);
......@@ -237,8 +239,9 @@ gboolean configuration_load(void)
app->pref_main_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_main_show_search", TRUE);
app->pref_template_developer = utils_get_setting_string(config, PACKAGE, "pref_template_developer", g_get_real_name());
app->pref_template_company = utils_get_setting_string(config, PACKAGE, "pref_template_company", "");
#ifdef HAVE_VTE
app->terminal_settings = utils_get_setting_string(config, PACKAGE, "terminal_settings", "");
#endif
tmp_string = utils_get_initials(app->pref_template_developer);
app->pref_template_initial = utils_get_setting_string(config, PACKAGE, "pref_template_initial", tmp_string);
g_free(tmp_string);
......
......@@ -148,8 +148,6 @@ void prefs_init_dialog(void)
// VTE settings
if (app->have_vte)
{
extern struct vte_conf *vc;
widget = lookup_widget(app->prefs_dialog, "font_term");
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font);
......@@ -290,33 +288,35 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
#ifdef HAVE_VTE
// VTE settings
extern struct vte_conf *vc;
gchar *hex_color_back, *hex_color_fore;
if (app->have_vte)
{
gchar *hex_color_back, *hex_color_fore;
widget = lookup_widget(app->prefs_dialog, "spin_scrollback");
vc->scrollback_lines = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "spin_scrollback");
vc->scrollback_lines = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "entry_emulation");
g_free(vc->emulation);
vc->emulation = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
widget = lookup_widget(app->prefs_dialog, "entry_emulation");
g_free(vc->emulation);
vc->emulation = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
widget = lookup_widget(app->prefs_dialog, "check_scroll_key");
vc->scroll_on_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "check_scroll_key");
vc->scroll_on_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "check_scroll_out");
vc->scroll_on_out = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
g_free(app->terminal_settings);
hex_color_fore = utils_get_hex_from_color(vc->color_fore);
hex_color_back = utils_get_hex_from_color(vc->color_back);
app->terminal_settings = g_strdup_printf("%s;%s;%s;%d;%s;%s;%s", vc->font,
hex_color_fore, hex_color_back,
vc->scrollback_lines, vc->emulation,
utils_btoa(vc->scroll_on_key), utils_btoa(vc->scroll_on_out));
vte_apply_user_settings();
g_free(hex_color_fore);
g_free(hex_color_back);
widget = lookup_widget(app->prefs_dialog, "check_scroll_out");
vc->scroll_on_out = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
g_free(app->terminal_settings);
hex_color_fore = utils_get_hex_from_color(vc->color_fore);
hex_color_back = utils_get_hex_from_color(vc->color_back);
app->terminal_settings = g_strdup_printf("%s;%s;%s;%d;%s;%s;%s", vc->font,
hex_color_fore, hex_color_back,
vc->scrollback_lines, vc->emulation,
utils_btoa(vc->scroll_on_key), utils_btoa(vc->scroll_on_out));
vte_apply_user_settings();
g_free(hex_color_fore);
g_free(hex_color_back);
}
#endif
......@@ -435,7 +435,6 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
{
#ifdef HAVE_VTE
// VTE settings
extern struct vte_conf *vc;
g_free(vc->font);
vc->font = g_strdup(gtk_font_button_get_font_name(widget));
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment