- do not create VTE settings in the preferences dialog if VTE is disabled at runtime

- added option to preferences dialog to disable load of VTE at startup


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@354 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-05-22 00:25:19 +00:00
parent d703c394a6
commit daebef5351
9 changed files with 178 additions and 143 deletions

View File

@ -6,6 +6,14 @@
added option to disable styling within preprocessor directives
* src/dialogs.c, src/about.c, src/callbacks.c, configure.in:
rewrote about dialog to reduce code size, added subversion revision
* src/vte.c: declared some functions static
* src/dialogs.c: do not create VTE settings in the preferences dialog
if VTE is disabled at runtime
* geany.glade, src/interface.c, src/callbacks.c, src/keyfile.c,
src/main.c, src/prefs.c:
added option to disable load of VTE at startup
* src/highlighting.c, src/utils.c: applied sanity check patch from
Pierre(posted on mailing list)
2006-05-20 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -2429,6 +2429,25 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_vte">
<property name="tooltip" translatable="yes">Whether the virtual terminal emulation(VTE) should be loaded at startup. Disable it if you do not need it.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Load virtual terminal emulation at startup</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_ask_for_quit">
<property name="visible">True</property>
@ -2547,8 +2566,8 @@
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>

View File

@ -40,6 +40,7 @@
#include "sci_cb.h"
#include "utils.h"
#include "dialogs.h"
#include "about.h"
#include "msgwindow.h"
#include "build.h"
#include "prefs.h"
@ -111,9 +112,6 @@ gint destroyapp(GtkWidget *widget, gpointer gdata)
templates_free_templates();
tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));
g_free(app->configdir);
#ifdef HAVE_VTE
g_free(app->lib_vte);
#endif
g_free(app->search_text);
g_free(app->editor_font);
g_free(app->tagbar_font);
@ -146,7 +144,10 @@ gint destroyapp(GtkWidget *widget, gpointer gdata)
gtk_widget_destroy(app->default_tag_tree);
}
scintilla_release_resources();
#ifdef HAVE_VTE
if (app->have_vte) vte_close();
g_free(app->lib_vte);
#endif
gtk_widget_destroy(app->window);
// destroy popup menus

View File

@ -40,7 +40,6 @@
#include "callbacks.h"
#include "document.h"
#include "win32.h"
#include "about.h"
#include "sciwrappers.h"
#include "support.h"
#include "interface.h"
@ -1649,6 +1648,8 @@ void dialogs_show_prefs_dialog(void)
app->prefs_dialog = create_prefs_dialog();
#ifdef HAVE_VTE
if (app->have_vte)
{
tooltips = GTK_TOOLTIPS(lookup_widget(app->prefs_dialog, "tooltips"));
notebook = lookup_widget(app->prefs_dialog, "notebook2");
vbox = gtk_vbox_new(FALSE, 0);
@ -1680,7 +1681,6 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), font_term, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(font_term, FALSE);
gtk_tooltips_set_tip(tooltips, font_term, _("Sets the font for the terminal widget."), NULL);
label = gtk_label_new(_("Foreground color"));
@ -1699,7 +1699,6 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), color_fore, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(color_fore, FALSE);
gtk_tooltips_set_tip(tooltips, color_fore, _("Sets the foreground color of the text in the terminal widget."), NULL);
gtk_color_button_set_title(GTK_COLOR_BUTTON(color_fore), _("Color Chooser"));
@ -1707,7 +1706,6 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), color_back, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(color_back, FALSE);
gtk_tooltips_set_tip(tooltips, color_back, _("Sets the background color of the text in the terminal widget."), NULL);
gtk_color_button_set_title(GTK_COLOR_BUTTON(color_back), _("Color Chooser"));
@ -1722,7 +1720,6 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), spin_scrollback, 1, 2, 3, 4,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(spin_scrollback, FALSE);
gtk_tooltips_set_tip(tooltips, spin_scrollback, _("Specifies the history in lines, which you can scroll back in the terminal widget."), NULL);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spin_scrollback), TRUE);
gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spin_scrollback), TRUE);
@ -1737,14 +1734,12 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), entry_emulation, 1, 2, 4, 5,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(entry_emulation, FALSE);
gtk_tooltips_set_tip(tooltips, entry_emulation, _("Controls how the terminal emulator should behave. xterm is a good start."), NULL);
check_scroll_key = gtk_check_button_new_with_mnemonic(_("Scroll on keystroke"));
gtk_table_attach(GTK_TABLE(table), check_scroll_key, 1, 2, 5, 6,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(check_scroll_key, FALSE);
gtk_tooltips_set_tip(tooltips, check_scroll_key, _("Whether to scroll to the bottom if a key was pressed."), NULL);
gtk_button_set_focus_on_click(GTK_BUTTON(check_scroll_key), FALSE);
@ -1752,7 +1747,6 @@ void dialogs_show_prefs_dialog(void)
gtk_table_attach(GTK_TABLE(table), check_scroll_out, 1, 2, 6, 7,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_sensitive(check_scroll_out, FALSE);
gtk_tooltips_set_tip(tooltips, check_scroll_out, _("Whether to scroll to the bottom if an output was generated."), NULL);
gtk_button_set_focus_on_click(GTK_BUTTON(check_scroll_out), FALSE);
@ -1783,6 +1777,7 @@ void dialogs_show_prefs_dialog(void)
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(2));
g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "color_back"),
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(3));
}
#endif
g_signal_connect((gpointer) app->prefs_dialog, "response", G_CALLBACK(on_prefs_button_clicked), NULL);
g_signal_connect((gpointer) app->prefs_dialog, "delete_event", G_CALLBACK(on_prefs_delete_event), NULL);

View File

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id$
*/
@ -122,7 +122,6 @@ typedef struct MyApp
gboolean opening_session_files;
// represents the state when Geany is quitting completely
gboolean quitting;
gboolean have_vte;
gboolean ignore_global_tags;
gboolean toolbar_visible;
gboolean treeview_symbol_visible;
@ -162,6 +161,8 @@ typedef struct MyApp
gboolean ignore_fifo;
#endif
#ifdef HAVE_VTE
gboolean load_vte;
gboolean have_vte;
gchar *lib_vte;
#endif
gchar *long_line_color;

View File

@ -1740,6 +1740,7 @@ create_prefs_dialog (void)
GtkWidget *check_save_win_pos;
GtkWidget *check_beep;
GtkWidget *check_switch_pages;
GtkWidget *check_vte;
GtkWidget *check_ask_for_quit;
GtkWidget *hbox3;
GtkWidget *label150;
@ -1927,6 +1928,11 @@ create_prefs_dialog (void)
gtk_tooltips_set_tip (tooltips, check_switch_pages, _("Switch to the status message tab(in the notebook window at the bottom) if a new status message arrive."), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_switch_pages), FALSE);
check_vte = gtk_check_button_new_with_mnemonic (_("Load virtual terminal emulation at startup"));
gtk_box_pack_start (GTK_BOX (vbox4), check_vte, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_vte, _("Whether the virtual terminal emulation(VTE) should be loaded at startup. Disable it if you do not need it."), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_vte), FALSE);
check_ask_for_quit = gtk_check_button_new_with_mnemonic (_("Confirm exit"));
gtk_widget_show (check_ask_for_quit);
gtk_box_pack_start (GTK_BOX (vbox4), check_ask_for_quit, FALSE, FALSE, 0);
@ -1936,7 +1942,7 @@ create_prefs_dialog (void)
hbox3 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox3);
gtk_box_pack_start (GTK_BOX (vbox4), hbox3, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox4), hbox3, TRUE, TRUE, 0);
label150 = gtk_label_new (_("Placement of new file tabs: "));
gtk_widget_show (label150);
@ -2543,6 +2549,7 @@ create_prefs_dialog (void)
GLADE_HOOKUP_OBJECT (prefs_dialog, check_save_win_pos, "check_save_win_pos");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_beep, "check_beep");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_switch_pages, "check_switch_pages");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_vte, "check_vte");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_ask_for_quit, "check_ask_for_quit");
GLADE_HOOKUP_OBJECT (prefs_dialog, hbox3, "hbox3");
GLADE_HOOKUP_OBJECT (prefs_dialog, label150, "label150");

View File

@ -99,6 +99,7 @@ void configuration_save(void)
g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", app->pref_editor_auto_close_xml_tags);
g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", app->pref_editor_auto_complete_constructs);
#ifdef HAVE_VTE
g_key_file_set_boolean(config, PACKAGE, "load_vte", app->load_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);
@ -256,11 +257,12 @@ gboolean configuration_load(void)
app->pref_main_save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
app->pref_main_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_main_show_search", TRUE);
app->pref_main_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_main_show_goto", 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->load_vte = utils_get_setting_boolean(config, PACKAGE, "load_vte", TRUE);
app->terminal_settings = utils_get_setting_string(config, PACKAGE, "terminal_settings", "");
#endif
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", "");
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);

View File

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id$
*/
@ -58,10 +58,10 @@ static gboolean ignore_fifo = FALSE;
static gboolean debug_mode = FALSE;
static gboolean ignore_global_tags = FALSE;
static gboolean no_msgwin = FALSE;
static gboolean no_vte = FALSE;
static gboolean show_version = FALSE;
static gchar *alternate_config = NULL;
#ifdef HAVE_VTE
static gboolean no_vte = FALSE;
static gchar *lib_vte = NULL;
#endif
static GOptionEntry entries[] =
@ -73,8 +73,8 @@ static GOptionEntry entries[] =
#endif
{ "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, "use an alternate configuration directory", NULL },
{ "no-msgwin", 'm', 0, G_OPTION_ARG_NONE, &no_msgwin, "don't show message window at startup", NULL },
{ "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, "don't load terminal support", NULL },
#ifdef HAVE_VTE
{ "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, "don't load terminal support", NULL },
{ "vte-lib", 'l', 0, G_OPTION_ARG_FILENAME, &lib_vte, "filename of libvte.so", NULL },
#endif
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "show version and exit", NULL },
@ -216,9 +216,6 @@ static void main_init(void)
}
else
app->configdir = g_strconcat(GEANY_HOME_DIR, G_DIR_SEPARATOR_S, ".", PACKAGE, NULL);
#ifdef HAVE_VTE
app->lib_vte = lib_vte;
#endif
app->window = NULL;
app->search_text = NULL;
app->open_fontsel = NULL;
@ -236,9 +233,7 @@ static void main_init(void)
app->ignore_fifo = ignore_fifo;
#endif
#ifdef HAVE_VTE
app->have_vte = ! no_vte;
#else
app->have_vte = FALSE;
app->lib_vte = lib_vte;
#endif
app->ignore_global_tags = ignore_global_tags;
app->tm_workspace = tm_get_workspace();
@ -474,6 +469,11 @@ gint main(gint argc, gchar **argv)
templates_init();
encodings_init();
document_init_doclist();
// do this here to let cmdline options overwrite configuration settings
#ifdef HAVE_VTE
app->have_vte = app->load_vte;
if (no_vte) app->have_vte = FALSE;
#endif
filetypes_init_types();
configuration_read_filetype_extensions();

View File

@ -21,6 +21,8 @@
*/
#include <stdlib.h>
#include "geany.h"
#include "prefs.h"
@ -213,6 +215,11 @@ void prefs_init_dialog(void)
#ifdef HAVE_VTE
// make VTE switch visible only when VTE is compiled in, it is hidden by default
widget = lookup_widget(app->prefs_dialog, "check_vte");
gtk_widget_show(widget);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->load_vte);
// VTE settings
if (app->have_vte)
{
@ -236,14 +243,6 @@ void prefs_init_dialog(void)
widget = lookup_widget(app->prefs_dialog, "check_scroll_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, "color_fore"), 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, "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_out"), TRUE);
}
#endif
}
@ -367,6 +366,9 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
if (edited) keybindings_write_to_file();
#ifdef HAVE_VTE
widget = lookup_widget(app->prefs_dialog, "check_vte");
app->load_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
// VTE settings
if (app->have_vte)
{