2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* prefs.c - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2007-01-14 17:36:42 +00:00
|
|
|
* Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
|
2007-01-14 17:09:17 +00:00
|
|
|
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-06-08 15:12:55 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2005-12-11 02:16:02 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
2007-02-24 11:41:56 +00:00
|
|
|
/*
|
|
|
|
* Preferences dialog support functions.
|
|
|
|
*/
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-05-22 00:25:19 +00:00
|
|
|
#include <stdlib.h>
|
2006-06-08 15:12:55 +00:00
|
|
|
#include <string.h>
|
2007-07-12 11:56:17 +00:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2006-05-22 00:25:19 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "geany.h"
|
|
|
|
|
|
|
|
#include "prefs.h"
|
|
|
|
#include "support.h"
|
2006-05-30 19:19:05 +00:00
|
|
|
#include "dialogs.h"
|
2006-09-05 14:24:47 +00:00
|
|
|
#include "ui_utils.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "utils.h"
|
|
|
|
#include "msgwindow.h"
|
|
|
|
#include "sciwrappers.h"
|
2006-02-26 18:19:28 +00:00
|
|
|
#include "document.h"
|
2006-02-20 15:11:38 +00:00
|
|
|
#include "keyfile.h"
|
2006-06-16 19:58:26 +00:00
|
|
|
#include "keybindings.h"
|
2006-07-11 14:15:56 +00:00
|
|
|
#include "interface.h"
|
|
|
|
#include "encodings.h"
|
2007-04-29 16:36:42 +00:00
|
|
|
#include "project.h"
|
2007-05-29 16:30:54 +00:00
|
|
|
#include "editor.h"
|
2007-08-16 15:20:38 +00:00
|
|
|
#include "main.h"
|
2007-08-23 11:34:06 +00:00
|
|
|
#include "treeviews.h"
|
2006-06-16 19:58:26 +00:00
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
#ifdef HAVE_VTE
|
|
|
|
# include "vte.h"
|
|
|
|
#endif
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-24 11:47:29 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
# include "win32.h"
|
|
|
|
#endif
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
GeanyPrefs prefs;
|
|
|
|
|
|
|
|
static gchar *dialog_key_name;
|
|
|
|
static GtkTreeIter g_iter;
|
2007-07-09 13:48:41 +00:00
|
|
|
static GtkTreeStore *store = NULL;
|
2006-05-19 17:18:06 +00:00
|
|
|
static GtkTreeView *tree = NULL;
|
2007-08-23 11:34:06 +00:00
|
|
|
static GtkWidget *dialog_label;
|
2006-05-19 17:18:06 +00:00
|
|
|
static gboolean edited = FALSE;
|
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static gboolean on_tree_view_button_press_event(
|
2006-05-19 17:18:06 +00:00
|
|
|
GtkWidget *widget, GdkEventButton *event, gpointer user_data);
|
|
|
|
static void on_cell_edited(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, gpointer user_data);
|
|
|
|
static gboolean on_keytype_dialog_response(GtkWidget *dialog, GdkEventKey *event, gpointer user_data);
|
|
|
|
static void on_dialog_response(GtkWidget *dialog, gint response, gpointer user_data);
|
2006-05-30 19:19:05 +00:00
|
|
|
static gboolean find_duplicate(guint idx, guint key, GdkModifierType mods, const gchar *action);
|
2007-01-26 10:43:25 +00:00
|
|
|
static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
|
|
|
static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
|
|
|
static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
|
|
|
static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
2007-06-26 15:41:27 +00:00
|
|
|
static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
2007-10-13 09:28:26 +00:00
|
|
|
static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
void prefs_init_dialog(void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2005-12-11 02:16:02 +00:00
|
|
|
GdkColor *color;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
// General settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), prefs.mru_length);
|
2005-12-12 02:23:51 +00:00
|
|
|
|
2007-08-16 15:20:38 +00:00
|
|
|
// startup
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.save_winpos);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_plugins");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_plugins);
|
2007-08-16 15:20:38 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ask_for_quit");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.confirm_exit);
|
2007-08-16 15:20:38 +00:00
|
|
|
|
|
|
|
// behaviour
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_beep");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.beep_on_errors);
|
2006-01-03 12:39:25 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_switch_pages");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.switch_msgwin_pages);
|
2005-11-24 22:28:45 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_suppress_status_msgs");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.suppress_status_messages);
|
2007-08-05 11:03:44 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_focus");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.auto_focus);
|
2007-06-11 08:58:37 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ask_suppress_search_dialogs");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.suppress_search_dialogs);
|
2006-11-18 15:47:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.context_action_cmd);
|
2007-04-15 18:09:59 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "startup_path_entry");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.default_open_path);
|
2007-05-23 13:44:25 +00:00
|
|
|
|
2007-04-29 16:36:42 +00:00
|
|
|
project_setup_prefs(); // project files path
|
|
|
|
|
2006-07-02 16:21:35 +00:00
|
|
|
|
|
|
|
// Interface settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_symbol");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.sidebar_symbol_visible);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.sidebar_openfiles_visible);
|
2007-10-13 09:28:26 +00:00
|
|
|
on_openfiles_visible_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
|
|
|
|
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.sidebar_openfiles_fullpath);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "tagbar_font");
|
|
|
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), prefs.tagbar_font);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "msgwin_font");
|
|
|
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), prefs.msgwin_font);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "editor_font");
|
|
|
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), prefs.editor_font);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_column);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
switch (editor_prefs.long_line_type)
|
2006-07-02 16:21:35 +00:00
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
case 0: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line"); break;
|
|
|
|
case 1: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background"); break;
|
|
|
|
default: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_disabled"); break;
|
2006-07-02 16:21:35 +00:00
|
|
|
}
|
2006-04-27 18:01:44 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
|
|
|
|
2006-07-02 16:21:35 +00:00
|
|
|
color = g_new0(GdkColor, 1);
|
2007-08-23 11:34:06 +00:00
|
|
|
gdk_color_parse(editor_prefs.long_line_color, color);
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "long_line_color");
|
2006-07-02 16:21:35 +00:00
|
|
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), color);
|
|
|
|
g_free(color);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.show_notebook_tabs);
|
2007-04-29 16:36:42 +00:00
|
|
|
// disable following setting if notebook tabs are hidden
|
|
|
|
on_show_notebook_tabs_toggled(GTK_TOGGLE_BUTTON(
|
2007-08-23 11:34:06 +00:00
|
|
|
lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs")), NULL);
|
2007-04-29 16:36:42 +00:00
|
|
|
|
2007-08-25 14:16:52 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.show_tab_cross);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor");
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.tab_pos_editor);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_msgwin");
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.tab_pos_msgwin);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_sidebar");
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.tab_pos_sidebar);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_statusbar_visible");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.statusbar_visible);
|
2007-04-10 17:06:57 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-07-11 14:15:56 +00:00
|
|
|
// Toolbar settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_visible);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_search");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_search);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_goto");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_goto);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_compile");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_compile);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_zoom);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_undo);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_navigation");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_navigation);
|
2007-06-02 16:14:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_colour");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_colour);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_fileops);
|
2006-07-15 18:15:30 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_quit);
|
2006-10-29 01:28:58 +00:00
|
|
|
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
switch (prefs.toolbar_icon_style)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
case 0: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_image"); break;
|
|
|
|
case 1: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_text"); break;
|
|
|
|
default: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_imagetext"); break;
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
|
|
|
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
switch (prefs.toolbar_icon_size)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
|
|
|
case GTK_ICON_SIZE_LARGE_TOOLBAR:
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_large"); break;
|
|
|
|
default: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_small"); break;
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
|
|
|
// disable elements if toolbar is hidden
|
2007-01-26 10:43:25 +00:00
|
|
|
on_toolbar_show_toggled(GTK_TOGGLE_BUTTON(
|
2007-08-23 11:34:06 +00:00
|
|
|
lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show")), NULL);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
|
|
|
|
2007-04-29 16:36:42 +00:00
|
|
|
// Files settings
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tab_order_ltr)
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_tab_right");
|
2007-04-29 16:36:42 +00:00
|
|
|
else
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_tab_left");
|
2007-04-29 16:36:42 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
// Editor settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
|
2006-06-21 18:54:07 +00:00
|
|
|
// luckily the index of the combo box items match the index of the encodings array
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.default_new_encoding);
|
2007-06-26 15:41:27 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding");
|
2007-06-26 15:41:27 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
|
2007-08-24 16:20:33 +00:00
|
|
|
(prefs.default_open_encoding >= 0) ? TRUE : FALSE);
|
2007-06-26 15:41:27 +00:00
|
|
|
on_open_encoding_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding");
|
2007-08-24 16:20:33 +00:00
|
|
|
if (prefs.default_open_encoding >= 0)
|
2007-06-26 15:41:27 +00:00
|
|
|
{
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), prefs.default_open_encoding);
|
2007-06-26 15:41:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), GEANY_ENCODING_UTF_8);
|
2006-06-21 18:54:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces");
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.strip_trailing_spaces);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.final_new_line);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs");
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.replace_tabs);
|
2006-06-21 18:54:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indent");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_indent_guide);
|
2006-02-14 22:07:55 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_white_space");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_white_space);
|
2006-02-14 22:07:55 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_line_endings);
|
2006-02-14 22:07:55 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_auto_indent_mode");
|
2007-06-12 15:16:17 +00:00
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.indent_mode);
|
2006-08-01 10:06:28 +00:00
|
|
|
|
2007-10-17 12:27:07 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.detect_tab_mode);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
2007-08-24 16:20:33 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
|
2006-02-14 22:07:55 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_complete");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_constructs);
|
2006-02-14 22:07:55 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_xmltag");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_close_xml_tags);
|
2006-08-01 10:06:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_folding");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.folding);
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.unfold_all_children);
|
2007-01-26 10:43:25 +00:00
|
|
|
on_use_folding_toggled(GTK_TOGGLE_BUTTON(
|
2007-08-23 11:34:06 +00:00
|
|
|
lookup_widget(ui_widgets.prefs_dialog, "check_folding")), NULL);
|
2006-12-03 22:33:46 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_disable_dnd");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.disable_dnd);
|
2007-01-13 20:50:36 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_smart_home");
|
2007-07-12 15:44:13 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.smart_home_key);
|
|
|
|
|
2007-10-18 11:52:47 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.newline_strip);
|
|
|
|
|
2007-09-07 15:52:31 +00:00
|
|
|
if (editor_prefs.use_tabs)
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs");
|
|
|
|
else
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_spaces");
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
2007-01-14 17:09:17 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
|
2006-06-13 19:37:21 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");
|
2007-05-29 16:30:54 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_symbols);
|
2007-01-26 10:43:25 +00:00
|
|
|
on_symbol_auto_completion_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_autocheight");
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.autocompletion_max_height);
|
2006-08-13 15:04:30 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
// Tools Settings
|
2006-07-26 17:02:16 +00:00
|
|
|
#ifdef G_OS_WIN32
|
2006-07-13 14:30:44 +00:00
|
|
|
// hide related Make path setting
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "label11"), FALSE);
|
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "entry_com_make"), FALSE);
|
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "button_make"), FALSE);
|
2006-06-08 15:12:55 +00:00
|
|
|
#else
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tools_make_cmd)
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_com_make")), prefs.tools_make_cmd);
|
2006-06-08 15:12:55 +00:00
|
|
|
#endif
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tools_term_cmd)
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_com_term")), prefs.tools_term_cmd);
|
2006-09-11 11:13:36 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tools_browser_cmd)
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_browser")), prefs.tools_browser_cmd);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tools_print_cmd)
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_print")), prefs.tools_print_cmd);
|
2006-06-29 17:14:52 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.tools_grep_cmd)
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_grep")), prefs.tools_grep_cmd);
|
2006-07-13 14:30:44 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
// Template settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_developer");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.template_developer);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_company");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.template_company);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_mail");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.template_mail);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_initial");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.template_initial);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_version");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), prefs.template_version);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
// Keybindings
|
|
|
|
if (store == NULL)
|
|
|
|
{
|
|
|
|
GtkCellRenderer *renderer;
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
tree = GTK_TREE_VIEW(lookup_widget(ui_widgets.prefs_dialog, "treeview7"));
|
2006-05-19 17:18:06 +00:00
|
|
|
//g_object_set(tree, "vertical-separator", 6, NULL);
|
|
|
|
|
2007-09-05 19:40:46 +00:00
|
|
|
store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
|
2006-05-19 17:18:06 +00:00
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new();
|
|
|
|
column = gtk_tree_view_column_new_with_attributes(_("Action"), renderer, "text", 0, NULL);
|
|
|
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new();
|
|
|
|
g_object_set(renderer, "editable", TRUE, NULL);
|
|
|
|
column = gtk_tree_view_column_new_with_attributes(_("Shortcut"), renderer, "text", 1, NULL);
|
|
|
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
|
|
|
|
2006-05-30 19:19:05 +00:00
|
|
|
// set policy settings for the scollwedwindow around the treeview again, because glade
|
|
|
|
// doesn't keep the settings
|
|
|
|
gtk_scrolled_window_set_policy(
|
2007-08-23 11:34:06 +00:00
|
|
|
GTK_SCROLLED_WINDOW(lookup_widget(ui_widgets.prefs_dialog, "scrolledwindow8")),
|
2006-06-08 15:12:55 +00:00
|
|
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
2006-05-30 19:19:05 +00:00
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(on_cell_edited), NULL);
|
|
|
|
g_signal_connect(G_OBJECT(tree), "button-press-event",
|
2007-01-26 10:43:25 +00:00
|
|
|
G_CALLBACK(on_tree_view_button_press_event), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect(G_OBJECT(lookup_widget(ui_widgets.prefs_dialog, "button2")), "clicked",
|
2007-01-26 10:43:25 +00:00
|
|
|
G_CALLBACK(on_tree_view_button_press_event), NULL);
|
2006-05-19 17:18:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2007-07-09 13:48:41 +00:00
|
|
|
GtkTreeIter parent, iter;
|
|
|
|
gint i;
|
|
|
|
gchar *key_string;
|
|
|
|
|
|
|
|
for (i = 0; i < GEANY_MAX_KEYS; i++)
|
|
|
|
{
|
|
|
|
if (keys[i]->section != NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_store_append(store, &parent, NULL);
|
|
|
|
gtk_tree_store_set(store, &parent, 0, keys[i]->section, -1);
|
|
|
|
}
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
key_string = gtk_accelerator_name(keys[i]->key, keys[i]->mods);
|
|
|
|
gtk_tree_store_append(store, &iter, &parent);
|
2007-09-05 19:40:46 +00:00
|
|
|
gtk_tree_store_set(store, &iter, 0, keys[i]->label, 1, key_string, 2, i, -1);
|
2007-07-09 13:48:41 +00:00
|
|
|
g_free(key_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree));
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-08-16 15:20:38 +00:00
|
|
|
#ifndef HAVE_PLUGINS
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_plugins"), FALSE);
|
2007-08-16 15:20:38 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
#ifdef HAVE_VTE
|
2006-05-22 00:25:19 +00:00
|
|
|
// make VTE switch visible only when VTE is compiled in, it is hidden by default
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_vte");
|
2006-05-22 00:25:19 +00:00
|
|
|
gtk_widget_show(widget);
|
2006-08-19 15:07:11 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vte_info.load_vte);
|
2006-05-22 00:25:19 +00:00
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
// VTE settings
|
2006-08-19 15:07:11 +00:00
|
|
|
if (vte_info.have_vte)
|
2005-12-16 22:34:41 +00:00
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "font_term");
|
2005-12-16 22:34:41 +00:00
|
|
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "color_fore");
|
2006-08-22 19:03:38 +00:00
|
|
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->colour_fore);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "color_back");
|
2006-08-22 19:03:38 +00:00
|
|
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->colour_back);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_scrollback");
|
2005-12-16 22:34:41 +00:00
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), vc->scrollback_lines);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_emulation");
|
2005-12-16 22:34:41 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), vc->emulation);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_shell");
|
2006-08-23 16:37:05 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(widget), vc->shell);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_scroll_key");
|
2005-12-16 22:34:41 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_key);
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_scroll_out");
|
2005-12-16 22:34:41 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_out);
|
2006-07-02 18:34:03 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ignore_menu_key");
|
2006-08-23 16:37:05 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->ignore_menu_bar_accel);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_follow_path");
|
2006-07-02 18:34:03 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->follow_path);
|
2006-12-10 21:29:04 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_run_in_vte");
|
2006-12-10 21:29:04 +00:00
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->run_in_vte);
|
2005-12-16 22:34:41 +00:00
|
|
|
}
|
2005-12-11 02:16:02 +00:00
|
|
|
#endif
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* callbacks
|
|
|
|
*/
|
2007-08-23 11:34:06 +00:00
|
|
|
static void
|
|
|
|
on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-10-29 01:28:58 +00:00
|
|
|
if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2006-10-09 16:08:53 +00:00
|
|
|
guint i;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
// General settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_mru");
|
|
|
|
prefs.mru_length = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
2005-12-12 02:23:51 +00:00
|
|
|
|
2007-08-16 15:20:38 +00:00
|
|
|
// startup
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
|
|
|
|
prefs.load_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos");
|
|
|
|
prefs.save_winpos = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_plugins");
|
|
|
|
prefs.load_plugins = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-01-03 12:39:25 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ask_for_quit");
|
|
|
|
prefs.confirm_exit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-16 15:20:38 +00:00
|
|
|
// behaviour
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_beep");
|
|
|
|
prefs.beep_on_errors = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-08-16 15:20:38 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ask_suppress_search_dialogs");
|
|
|
|
prefs.suppress_search_dialogs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-11-18 15:47:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_switch_pages");
|
|
|
|
prefs.switch_msgwin_pages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-24 22:28:45 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_suppress_status_msgs");
|
|
|
|
prefs.suppress_status_messages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-08-05 11:03:44 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_focus");
|
|
|
|
prefs.auto_focus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-06-11 08:58:37 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction");
|
|
|
|
g_free(prefs.context_action_cmd);
|
|
|
|
prefs.context_action_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2007-04-15 18:09:59 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "startup_path_entry");
|
|
|
|
g_free(prefs.default_open_path);
|
|
|
|
prefs.default_open_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2007-05-23 13:44:25 +00:00
|
|
|
|
2007-04-29 16:36:42 +00:00
|
|
|
project_apply_prefs(); // project file path
|
|
|
|
|
2006-07-02 16:21:35 +00:00
|
|
|
|
|
|
|
// Interface settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_symbol");
|
|
|
|
prefs.sidebar_symbol_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
|
|
|
|
prefs.sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-10-13 09:28:26 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath");
|
|
|
|
prefs.sidebar_openfiles_fullpath = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line");
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 0;
|
2006-07-02 16:21:35 +00:00
|
|
|
else
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background");
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 1;
|
2006-07-02 16:21:35 +00:00
|
|
|
else
|
|
|
|
{ // now only the disabled radio remains, so disable it
|
2007-08-23 11:34:06 +00:00
|
|
|
editor_prefs.long_line_type = 2;
|
2006-07-02 16:21:35 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-23 11:34:06 +00:00
|
|
|
if (editor_prefs.long_line_column == 0) editor_prefs.long_line_type = 2;
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
|
|
|
|
prefs.show_notebook_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-04-29 16:36:42 +00:00
|
|
|
|
2007-08-25 14:16:52 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross");
|
|
|
|
prefs.show_tab_cross = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor");
|
|
|
|
prefs.tab_pos_editor = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_msgwin");
|
|
|
|
prefs.tab_pos_msgwin = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_tab_sidebar");
|
|
|
|
prefs.tab_pos_sidebar = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_statusbar_visible");
|
|
|
|
prefs.statusbar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-04-10 17:06:57 +00:00
|
|
|
|
2005-11-24 22:28:45 +00:00
|
|
|
|
2006-07-11 14:15:56 +00:00
|
|
|
// Toolbar settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
|
|
|
|
prefs.toolbar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_search");
|
|
|
|
prefs.toolbar_show_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_goto");
|
|
|
|
prefs.toolbar_show_goto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
|
|
|
|
prefs.toolbar_show_zoom = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
|
|
|
|
prefs.toolbar_show_undo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_navigation");
|
|
|
|
prefs.toolbar_show_navigation = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-06-02 16:14:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_compile");
|
|
|
|
prefs.toolbar_show_compile = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_colour");
|
|
|
|
prefs.toolbar_show_colour = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
|
|
|
|
prefs.toolbar_show_fileops = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-15 18:15:30 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
|
|
|
|
prefs.toolbar_show_quit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-10-29 01:28:58 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_imagetext");
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) prefs.toolbar_icon_style = 2;
|
2006-07-11 14:15:56 +00:00
|
|
|
else
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_image");
|
2006-07-11 14:15:56 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.toolbar_icon_style = 0;
|
2006-07-11 14:15:56 +00:00
|
|
|
else
|
|
|
|
// now only the text only radio remains, so set text only
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.toolbar_icon_style = 1;
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_large");
|
2006-07-11 14:15:56 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
2006-07-11 14:15:56 +00:00
|
|
|
else
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
|
|
|
|
2007-04-29 16:36:42 +00:00
|
|
|
// Files settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_tab_right");
|
|
|
|
prefs.tab_order_ltr = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-04-29 16:36:42 +00:00
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
// Editor settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.default_new_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2007-06-26 15:41:27 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding");
|
2007-06-26 15:41:27 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding");
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.default_open_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2007-06-26 15:41:27 +00:00
|
|
|
}
|
|
|
|
else
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.default_open_encoding = -1;
|
2006-06-21 18:54:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces");
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.strip_trailing_spaces = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.final_new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs");
|
2007-08-24 16:20:33 +00:00
|
|
|
prefs.replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-06-21 18:54:07 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
|
|
|
|
editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_folding");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-09-05 14:24:47 +00:00
|
|
|
ui_update_fold_items();
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.unfold_all_children = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-12-03 22:33:46 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indent");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_white_space");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.show_white_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_auto_indent_mode");
|
2007-06-12 15:16:17 +00:00
|
|
|
editor_prefs.indent_mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
2006-08-01 10:06:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
2007-08-24 16:20:33 +00:00
|
|
|
editor_prefs.line_wrapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_complete");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.auto_complete_constructs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-02-26 18:19:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_xmltag");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.auto_close_xml_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-08-01 10:06:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-06-13 19:37:21 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_disable_dnd");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-01-13 20:50:36 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_smart_home");
|
2007-07-12 15:44:13 +00:00
|
|
|
editor_prefs.smart_home_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-10-18 11:52:47 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
|
|
|
editor_prefs.newline_strip = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-09-07 15:52:31 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs");
|
2007-10-17 12:27:07 +00:00
|
|
|
{
|
|
|
|
gboolean use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
|
|
|
// override each document setting only if the default has changed
|
|
|
|
if (editor_prefs.use_tabs != use_tabs)
|
|
|
|
{
|
|
|
|
editor_prefs.use_tabs = use_tabs;
|
|
|
|
for (i = 0; i < doc_array->len; i++)
|
|
|
|
{
|
|
|
|
if (doc_list[i].is_valid)
|
|
|
|
document_set_use_tabs(i, editor_prefs.use_tabs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
|
|
|
|
editor_prefs.detect_tab_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-01-14 17:09:17 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");
|
2007-05-29 16:30:54 +00:00
|
|
|
editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2007-01-26 10:43:25 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_autocheight");
|
|
|
|
editor_prefs.autocompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
2006-08-13 15:04:30 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
// Tools Settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_com_make");
|
|
|
|
g_free(prefs.tools_make_cmd);
|
|
|
|
prefs.tools_make_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_com_term");
|
|
|
|
g_free(prefs.tools_term_cmd);
|
|
|
|
prefs.tools_term_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_browser");
|
|
|
|
g_free(prefs.tools_browser_cmd);
|
|
|
|
prefs.tools_browser_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_print");
|
|
|
|
g_free(prefs.tools_print_cmd);
|
|
|
|
prefs.tools_print_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2006-06-29 17:14:52 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_grep");
|
|
|
|
g_free(prefs.tools_grep_cmd);
|
|
|
|
prefs.tools_grep_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2006-07-13 14:30:44 +00:00
|
|
|
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
// Template settings
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_developer");
|
|
|
|
g_free(prefs.template_developer);
|
|
|
|
prefs.template_developer = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_company");
|
|
|
|
g_free(prefs.template_company);
|
|
|
|
prefs.template_company = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_mail");
|
|
|
|
g_free(prefs.template_mail);
|
|
|
|
prefs.template_mail = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_initial");
|
|
|
|
g_free(prefs.template_initial);
|
|
|
|
prefs.template_initial = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_template_version");
|
|
|
|
g_free(prefs.template_version);
|
|
|
|
prefs.template_version = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
// Keybindings
|
|
|
|
if (edited) keybindings_write_to_file();
|
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
#ifdef HAVE_VTE
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_vte");
|
2006-08-19 15:07:11 +00:00
|
|
|
vte_info.load_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-05-22 00:25:19 +00:00
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
// VTE settings
|
2006-08-19 15:07:11 +00:00
|
|
|
if (vte_info.have_vte)
|
2005-12-16 23:23:18 +00:00
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_scrollback");
|
2005-12-16 23:23:18 +00:00
|
|
|
vc->scrollback_lines = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_emulation");
|
2005-12-16 23:23:18 +00:00
|
|
|
g_free(vc->emulation);
|
|
|
|
vc->emulation = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_shell");
|
2006-08-23 16:37:05 +00:00
|
|
|
g_free(vc->shell);
|
|
|
|
vc->shell = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_scroll_key");
|
2005-12-16 23:23:18 +00:00
|
|
|
vc->scroll_on_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2005-12-11 02:16:02 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_scroll_out");
|
2005-12-16 23:23:18 +00:00
|
|
|
vc->scroll_on_out = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_ignore_menu_key");
|
2006-08-23 16:37:05 +00:00
|
|
|
vc->ignore_menu_bar_accel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_follow_path");
|
2006-07-02 18:34:03 +00:00
|
|
|
vc->follow_path = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-12-10 21:29:04 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_run_in_vte");
|
2006-12-10 21:29:04 +00:00
|
|
|
vc->run_in_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
2006-07-02 18:34:03 +00:00
|
|
|
|
2005-12-16 23:23:18 +00:00
|
|
|
vte_apply_user_settings();
|
|
|
|
}
|
2005-12-11 02:16:02 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
// apply the changes made
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_statusbar_showhide(prefs.statusbar_visible);
|
2007-10-13 09:28:26 +00:00
|
|
|
treeviews_openfiles_update_all(); // to update if full path setting has changed
|
2006-09-05 14:24:47 +00:00
|
|
|
ui_update_toolbar_items();
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_update_toolbar_icons(prefs.toolbar_icon_size);
|
|
|
|
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_style);
|
2006-09-05 14:24:47 +00:00
|
|
|
ui_treeviews_show_hide(FALSE);
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), prefs.tab_pos_editor);
|
|
|
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), prefs.tab_pos_msgwin);
|
|
|
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), prefs.tab_pos_sidebar);
|
2006-07-02 16:21:35 +00:00
|
|
|
|
2006-06-30 14:28:32 +00:00
|
|
|
// re-colourise all open documents, if tab width or long line settings have changed
|
2006-10-09 16:08:53 +00:00
|
|
|
for (i = 0; i < doc_array->len; i++)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-03-09 12:18:42 +00:00
|
|
|
if (doc_list[i].is_valid)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-03-08 18:02:08 +00:00
|
|
|
document_apply_update_prefs(i);
|
2007-05-29 16:30:54 +00:00
|
|
|
if (! editor_prefs.folding)
|
2007-03-08 18:02:08 +00:00
|
|
|
document_unfold_all(i);
|
2006-06-30 14:28:32 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2007-03-08 18:02:08 +00:00
|
|
|
ui_document_show_hide(-1);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-02-20 15:11:38 +00:00
|
|
|
// store all settings
|
|
|
|
configuration_save();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2006-12-03 22:33:46 +00:00
|
|
|
|
2006-10-29 01:28:58 +00:00
|
|
|
if (response != GTK_RESPONSE_APPLY)
|
|
|
|
{
|
2007-07-09 13:48:41 +00:00
|
|
|
gtk_tree_store_clear(store);
|
2006-10-29 01:28:58 +00:00
|
|
|
gtk_widget_hide(GTK_WIDGET(dialog));
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data)
|
|
|
|
{
|
|
|
|
GdkColor color;
|
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
switch (GPOINTER_TO_INT(user_data))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
gtk_color_button_get_color(widget, &color);
|
2007-08-23 11:34:06 +00:00
|
|
|
editor_prefs.long_line_color = utils_get_hex_from_color(&color);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-12-16 22:34:41 +00:00
|
|
|
#ifdef HAVE_VTE
|
2005-12-11 02:16:02 +00:00
|
|
|
case 2:
|
|
|
|
{
|
2006-08-22 19:03:38 +00:00
|
|
|
g_free(vc->colour_fore);
|
|
|
|
vc->colour_fore = g_new0(GdkColor, 1);
|
|
|
|
gtk_color_button_get_color(widget, vc->colour_fore);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2006-08-22 19:03:38 +00:00
|
|
|
g_free(vc->colour_back);
|
|
|
|
vc->colour_back = g_new0(GdkColor, 1);
|
|
|
|
gtk_color_button_get_color(widget, vc->colour_back);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-12-16 22:34:41 +00:00
|
|
|
#endif
|
2005-12-19 19:20:16 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
|
|
|
|
{
|
2006-06-29 16:55:29 +00:00
|
|
|
const gchar *fontbtn = gtk_font_button_get_font_name(widget);
|
2006-10-09 16:08:53 +00:00
|
|
|
guint i;
|
2006-06-29 16:55:29 +00:00
|
|
|
|
2005-12-11 02:16:02 +00:00
|
|
|
switch (GPOINTER_TO_INT(user_data))
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2005-12-11 02:16:02 +00:00
|
|
|
case 1:
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
if (strcmp(fontbtn, prefs.tagbar_font) == 0) break;
|
|
|
|
g_free(prefs.tagbar_font);
|
|
|
|
prefs.tagbar_font = g_strdup(fontbtn);
|
2006-10-09 16:08:53 +00:00
|
|
|
for (i = 0; i < doc_array->len; i++)
|
2006-06-29 16:55:29 +00:00
|
|
|
{
|
|
|
|
if (doc_list[i].is_valid && GTK_IS_WIDGET(doc_list[i].tag_tree))
|
2006-12-13 15:18:49 +00:00
|
|
|
ui_widget_modify_font_from_string(doc_list[i].tag_tree,
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.tagbar_font);
|
2006-06-29 16:55:29 +00:00
|
|
|
}
|
2007-08-23 11:34:06 +00:00
|
|
|
if (GTK_IS_WIDGET(tv.default_tag_tree))
|
|
|
|
ui_widget_modify_font_from_string(tv.default_tag_tree, prefs.tagbar_font);
|
2006-12-13 15:18:49 +00:00
|
|
|
ui_widget_modify_font_from_string(lookup_widget(app->window, "entry1"),
|
2007-08-23 11:34:06 +00:00
|
|
|
prefs.tagbar_font);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
if (strcmp(fontbtn, prefs.msgwin_font) == 0) break;
|
|
|
|
g_free(prefs.msgwin_font);
|
|
|
|
prefs.msgwin_font = g_strdup(fontbtn);
|
|
|
|
ui_widget_modify_font_from_string(msgwindow.tree_compiler, prefs.msgwin_font);
|
|
|
|
ui_widget_modify_font_from_string(msgwindow.tree_msg, prefs.msgwin_font);
|
|
|
|
ui_widget_modify_font_from_string(msgwindow.tree_status, prefs.msgwin_font);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2006-09-05 14:24:47 +00:00
|
|
|
ui_set_editor_font(fontbtn);
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-12-19 19:20:16 +00:00
|
|
|
#ifdef HAVE_VTE
|
2005-12-11 02:16:02 +00:00
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
// VTE settings
|
2006-06-29 16:55:29 +00:00
|
|
|
if (strcmp(fontbtn, vc->font) == 0) break;
|
2005-12-11 02:16:02 +00:00
|
|
|
g_free(vc->font);
|
|
|
|
vc->font = g_strdup(gtk_font_button_get_font_name(widget));
|
2006-06-29 16:55:29 +00:00
|
|
|
vte_apply_user_settings();
|
2005-12-11 02:16:02 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-12-19 19:20:16 +00:00
|
|
|
#endif
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static gboolean on_tree_view_button_press_event(
|
2006-05-19 17:18:06 +00:00
|
|
|
GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
gchar *name;
|
|
|
|
|
|
|
|
// discard click events in the tree unless it is a double click
|
2007-07-09 13:48:41 +00:00
|
|
|
if (widget == (GtkWidget*)tree && event->type != GDK_2BUTTON_PRESS)
|
|
|
|
return FALSE;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
|
2007-07-09 13:48:41 +00:00
|
|
|
if (gtk_tree_selection_get_selected(selection, &model, &g_iter))
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
2007-07-09 13:48:41 +00:00
|
|
|
if (gtk_tree_model_iter_has_child(model, &g_iter))
|
|
|
|
{ // double click on a section to expand or collapse it
|
|
|
|
GtkTreePath *path = gtk_tree_model_get_path(model, &g_iter);
|
|
|
|
|
|
|
|
if (gtk_tree_view_row_expanded(tree, path))
|
|
|
|
gtk_tree_view_collapse_row(tree, path);
|
|
|
|
else
|
|
|
|
gtk_tree_view_expand_row(tree, path, FALSE);
|
|
|
|
|
|
|
|
gtk_tree_path_free(path);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_model_get(model, &g_iter, 0, &name, -1);
|
2006-05-19 17:18:06 +00:00
|
|
|
if (name != NULL)
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *label;
|
|
|
|
gchar *str;
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
dialog = gtk_dialog_new_with_buttons(_("Grab Key"), GTK_WINDOW(ui_widgets.prefs_dialog),
|
2006-05-19 17:18:06 +00:00
|
|
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
|
2007-07-12 11:56:17 +00:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
str = g_strdup_printf(
|
|
|
|
_("Type the combination of the keys you want to use for \"%s\""), name);
|
2006-05-19 17:18:06 +00:00
|
|
|
label = gtk_label_new(str);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(label), 5, 10);
|
|
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
|
|
|
|
|
|
|
|
dialog_label = gtk_label_new("");
|
|
|
|
gtk_misc_set_padding(GTK_MISC(dialog_label), 5, 10);
|
|
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), dialog_label);
|
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
g_signal_connect(G_OBJECT(dialog), "key-press-event",
|
|
|
|
G_CALLBACK(on_keytype_dialog_response), NULL);
|
2006-05-19 17:18:06 +00:00
|
|
|
g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(on_dialog_response), NULL);
|
|
|
|
|
|
|
|
// copy name to global variable to hold it, will be freed in on_dialog_response()
|
|
|
|
dialog_key_name = g_strdup(name);
|
|
|
|
|
|
|
|
gtk_widget_show_all(dialog);
|
|
|
|
g_free(str);
|
|
|
|
g_free(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void on_cell_edited(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, gpointer user_data)
|
|
|
|
{
|
|
|
|
if (path != NULL && new_text != NULL)
|
|
|
|
{
|
|
|
|
guint idx;
|
2006-05-30 19:19:05 +00:00
|
|
|
guint lkey;
|
|
|
|
GdkModifierType lmods;
|
2006-05-19 17:18:06 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), &iter, path);
|
|
|
|
if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter))
|
|
|
|
return;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2006-05-30 19:19:05 +00:00
|
|
|
gtk_accelerator_parse(new_text, &lkey, &lmods);
|
|
|
|
|
2007-09-05 19:40:46 +00:00
|
|
|
// get index
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 2, &idx, -1);
|
|
|
|
|
2007-10-03 11:21:08 +00:00
|
|
|
if (find_duplicate(idx, lkey, lmods, new_text))
|
|
|
|
return;
|
|
|
|
|
2006-05-30 19:19:05 +00:00
|
|
|
// set the values here, because of the above check, setting it in gtk_accelerator_parse would
|
|
|
|
// return a wrong key combination if it is duplicate
|
|
|
|
keys[idx]->key = lkey;
|
|
|
|
keys[idx]->mods = lmods;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
gtk_tree_store_set(store, &iter, 1, new_text, -1);
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
edited = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean on_keytype_dialog_response(GtkWidget *dialog, GdkEventKey *event, gpointer user_data)
|
|
|
|
{
|
|
|
|
gchar *str;
|
|
|
|
|
2007-07-12 11:56:17 +00:00
|
|
|
if (event->state == 0 && event->keyval == GDK_Escape)
|
|
|
|
return FALSE; // close the dialog, don't allow escape when detecting keybindings.
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
// ignore numlock key, not necessary but nice
|
|
|
|
if (event->state & GDK_MOD2_MASK) event->state -= GDK_MOD2_MASK;
|
|
|
|
|
|
|
|
str = gtk_accelerator_name(event->keyval, event->state);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(dialog_label), str);
|
|
|
|
g_free(str);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
static void on_dialog_response(GtkWidget *dialog, gint response, gpointer iter)
|
2006-05-19 17:18:06 +00:00
|
|
|
{
|
|
|
|
if (response == GTK_RESPONSE_ACCEPT)
|
|
|
|
{
|
|
|
|
guint idx;
|
2006-05-30 19:19:05 +00:00
|
|
|
guint lkey;
|
|
|
|
GdkModifierType lmods;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-09-05 19:40:46 +00:00
|
|
|
// get index
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(store), &g_iter, 2, &idx, -1);
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2006-05-30 19:19:05 +00:00
|
|
|
gtk_accelerator_parse(gtk_label_get_text(GTK_LABEL(dialog_label)), &lkey, &lmods);
|
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
if (find_duplicate(idx, lkey, lmods, gtk_label_get_text(GTK_LABEL(dialog_label))))
|
|
|
|
return;
|
2006-05-30 19:19:05 +00:00
|
|
|
|
|
|
|
// set the values here, because of the above check, setting it in gtk_accelerator_parse would
|
|
|
|
// return a wrong key combination if it is duplicate
|
|
|
|
keys[idx]->key = lkey;
|
|
|
|
keys[idx]->mods = lmods;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
2007-07-09 13:48:41 +00:00
|
|
|
gtk_tree_store_set(store, &g_iter,
|
|
|
|
1, gtk_label_get_text(GTK_LABEL(dialog_label)), -1);
|
|
|
|
|
2006-05-19 17:18:06 +00:00
|
|
|
g_free(dialog_key_name);
|
2006-05-30 19:19:05 +00:00
|
|
|
dialog_key_name = NULL;
|
2006-05-19 17:18:06 +00:00
|
|
|
|
|
|
|
edited = TRUE;
|
|
|
|
}
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
}
|
2006-05-30 19:19:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
// test if the entered key combination is already used
|
|
|
|
static gboolean find_duplicate(guint idx, guint key, GdkModifierType mods, const gchar *action)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
// allow duplicate if there is no key combination
|
|
|
|
if (key == 0 && mods == 0) return FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < GEANY_MAX_KEYS; i++)
|
|
|
|
{
|
|
|
|
// search another item with the same key, but take not the key we are searching for(-> idx)
|
|
|
|
if (keys[i]->key == key && keys[i]->mods == mods
|
|
|
|
&& ! (keys[i]->key == keys[idx]->key && keys[i]->mods == keys[idx]->mods))
|
|
|
|
{
|
2006-10-25 14:38:48 +00:00
|
|
|
dialogs_show_msgbox(GTK_MESSAGE_ERROR,
|
2006-05-30 19:19:05 +00:00
|
|
|
_("The combination '%s' is already used for \"%s\". Please choose another one."),
|
2006-06-08 15:12:55 +00:00
|
|
|
action, keys[i]->label);
|
2006-05-30 19:19:05 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "frame11"), sens);
|
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "frame13"), sens);
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
2006-10-29 01:28:58 +00:00
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
2006-11-18 15:47:28 +00:00
|
|
|
// tab placement only enabled when tabs are visible
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor"), sens);
|
2007-08-25 14:16:52 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross"), sens);
|
2006-11-18 15:47:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
2006-12-03 22:33:46 +00:00
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children"), sens);
|
2006-12-03 22:33:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-26 10:43:25 +00:00
|
|
|
static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "hbox6"), sens);
|
2007-01-26 10:43:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-26 15:41:27 +00:00
|
|
|
static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "eventbox3"), sens);
|
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "label_open_encoding"), sens);
|
2007-06-26 15:41:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-13 09:28:26 +00:00
|
|
|
static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean sens = gtk_toggle_button_get_active(togglebutton);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles_fullpath"), sens);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-23 16:47:27 +00:00
|
|
|
void prefs_show_dialog(void)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
if (ui_widgets.prefs_dialog == NULL)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
2007-06-26 15:41:27 +00:00
|
|
|
GtkWidget *combo_new, *combo_open;
|
2006-07-11 14:15:56 +00:00
|
|
|
guint i;
|
|
|
|
gchar *encoding_string;
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_widgets.prefs_dialog = create_prefs_dialog();
|
|
|
|
gtk_widget_set_name(ui_widgets.prefs_dialog, "GeanyPrefsDialog");
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.prefs_dialog), GTK_WINDOW(app->window));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
|
|
|
// init the default file encoding combo box
|
2007-08-23 11:34:06 +00:00
|
|
|
combo_new = lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
|
|
|
|
combo_open = lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding");
|
2007-06-26 15:41:27 +00:00
|
|
|
gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo_new), 3);
|
|
|
|
gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo_open), 3);
|
2006-07-11 14:15:56 +00:00
|
|
|
for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
|
|
|
|
{
|
|
|
|
encoding_string = encodings_to_string(&encodings[i]);
|
2007-06-26 15:41:27 +00:00
|
|
|
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_new), encoding_string);
|
|
|
|
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_open), encoding_string);
|
2006-07-11 14:15:56 +00:00
|
|
|
g_free(encoding_string);
|
|
|
|
}
|
|
|
|
|
2006-11-24 11:11:06 +00:00
|
|
|
#ifdef HAVE_VTE
|
2006-11-24 11:47:29 +00:00
|
|
|
vte_append_preferences_tab();
|
2006-11-24 11:11:06 +00:00
|
|
|
#endif
|
2006-11-18 15:47:28 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_setup_open_button_callback(lookup_widget(ui_widgets.prefs_dialog, "startup_path_button"), NULL,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "startup_path_entry")));
|
2007-08-16 15:20:38 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) ui_widgets.prefs_dialog, "response",
|
2007-01-19 23:17:40 +00:00
|
|
|
G_CALLBACK(on_prefs_button_clicked), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) ui_widgets.prefs_dialog, "delete_event",
|
2007-01-19 23:17:40 +00:00
|
|
|
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
2007-05-23 13:44:25 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "tagbar_font"),
|
2006-07-11 14:15:56 +00:00
|
|
|
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(1));
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "msgwin_font"),
|
2006-07-11 14:15:56 +00:00
|
|
|
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(2));
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "editor_font"),
|
2006-07-11 14:15:56 +00:00
|
|
|
"font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(3));
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "long_line_color"),
|
2006-07-11 14:15:56 +00:00
|
|
|
"color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(1));
|
|
|
|
// file chooser buttons in the tools tab
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_make"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_com_make"));
|
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_term"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_com_term"));
|
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_browser"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_browser"));
|
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_grep"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_grep"));
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2007-07-07 16:30:44 +00:00
|
|
|
// tools commands
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_print"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_print"));
|
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_contextaction"),
|
|
|
|
"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction"));
|
2007-07-07 16:30:44 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show"),
|
2007-01-26 10:43:25 +00:00
|
|
|
"toggled", G_CALLBACK(on_toolbar_show_toggled), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs"),
|
2007-01-26 10:43:25 +00:00
|
|
|
"toggled", G_CALLBACK(on_show_notebook_tabs_toggled), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_folding"),
|
2007-01-26 10:43:25 +00:00
|
|
|
"toggled", G_CALLBACK(on_use_folding_toggled), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"),
|
2007-01-26 10:43:25 +00:00
|
|
|
"toggled", G_CALLBACK(on_symbol_auto_completion_toggled), NULL);
|
2007-08-23 11:34:06 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding"),
|
2007-06-26 15:41:27 +00:00
|
|
|
"toggled", G_CALLBACK(on_open_encoding_toggled), NULL);
|
2007-10-13 09:28:26 +00:00
|
|
|
g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles"),
|
|
|
|
"toggled", G_CALLBACK(on_openfiles_visible_toggled), NULL);
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
prefs_init_dialog();
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_show(ui_widgets.prefs_dialog);
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
2006-11-24 11:47:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_prefs_tools_button_clicked (GtkButton *button,
|
|
|
|
gpointer item)
|
|
|
|
{
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
win32_show_pref_file_dialog(item);
|
|
|
|
#else
|
|
|
|
GtkWidget *dialog;
|
|
|
|
gchar *filename, *tmp, **field;
|
|
|
|
|
|
|
|
// initialize the dialog
|
2007-08-23 11:34:06 +00:00
|
|
|
dialog = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(ui_widgets.prefs_dialog),
|
2006-11-24 11:47:29 +00:00
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
|
|
|
// cut the options from the command line
|
|
|
|
field = g_strsplit(gtk_entry_get_text(GTK_ENTRY(item)), " ", 2);
|
|
|
|
if (field[0])
|
|
|
|
{
|
|
|
|
filename = g_find_program_in_path(field[0]);
|
|
|
|
if (filename)
|
|
|
|
{
|
|
|
|
gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(dialog), filename);
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// run it
|
|
|
|
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
|
|
|
|
{
|
|
|
|
tmp = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
if (g_strv_length(field) > 1)
|
|
|
|
filename = g_strconcat(tmp, " ", field[1], NULL);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
filename = tmp;
|
|
|
|
tmp = NULL;
|
|
|
|
}
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(item), filename);
|
|
|
|
g_free(filename);
|
|
|
|
g_free(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev(field);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|