improved HAVE_VTE handling to prevent crashes

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@60 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2005-12-16 22:34:41 +00:00
parent 2afef49a5e
commit b9a545805e

View File

@ -146,36 +146,39 @@ void prefs_init_dialog(void)
#ifdef HAVE_VTE #ifdef HAVE_VTE
// VTE settings // VTE settings
extern struct vte_conf *vc; if (app->have_vte)
{
extern struct vte_conf *vc;
widget = lookup_widget(app->prefs_dialog, "font_term"); widget = lookup_widget(app->prefs_dialog, "font_term");
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font); gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font);
widget = lookup_widget(app->prefs_dialog, "color_fore"); widget = lookup_widget(app->prefs_dialog, "color_fore");
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->color_fore); gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->color_fore);
widget = lookup_widget(app->prefs_dialog, "color_back"); widget = lookup_widget(app->prefs_dialog, "color_back");
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->color_back); gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->color_back);
widget = lookup_widget(app->prefs_dialog, "spin_scrollback"); widget = lookup_widget(app->prefs_dialog, "spin_scrollback");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), vc->scrollback_lines); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), vc->scrollback_lines);
widget = lookup_widget(app->prefs_dialog, "entry_emulation"); widget = lookup_widget(app->prefs_dialog, "entry_emulation");
gtk_entry_set_text(GTK_ENTRY(widget), vc->emulation); gtk_entry_set_text(GTK_ENTRY(widget), vc->emulation);
widget = lookup_widget(app->prefs_dialog, "check_scroll_key"); widget = lookup_widget(app->prefs_dialog, "check_scroll_key");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_key); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_key);
widget = lookup_widget(app->prefs_dialog, "check_scroll_out"); widget = lookup_widget(app->prefs_dialog, "check_scroll_out");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_out); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_out);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "font_term"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "font_term"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "color_fore"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "color_fore"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "color_back"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "color_back"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "spin_scrollback"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "spin_scrollback"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "entry_emulation"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "entry_emulation"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "check_scroll_key"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "check_scroll_key"), TRUE);
gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "check_scroll_out"), TRUE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "check_scroll_out"), TRUE);
}
#endif #endif
} }
@ -386,6 +389,7 @@ void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data)
app->long_line_color = utils_get_hex_from_color(&color); app->long_line_color = utils_get_hex_from_color(&color);
break; break;
} }
#ifdef HAVE_VTE
case 2: case 2:
{ {
g_free(vc->color_fore); g_free(vc->color_fore);
@ -401,6 +405,7 @@ void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data)
break; break;
} }
} }
#endif
} }