geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

prefs.c
Go to the documentation of this file.
1/*
2 * prefs.c - this file is part of Geany, a fast and lightweight IDE
3 *
4 * Copyright 2005 The Geany contributors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/*
22 * @file prefs.h
23 * Preferences dialog.
24 */
25
26/*
27 * Preferences dialog support functions.
28 * New 'simple' prefs should use Stash code in keyfile.c - init_pref_groups().
29 */
30
31#ifdef HAVE_CONFIG_H
32# include "config.h"
33#endif
34
35#include "prefs.h"
36
37#include "app.h"
38#include "dialogs.h"
39#include "documentprivate.h"
40#include "editor.h"
41#include "encodingsprivate.h"
42#include "filetypes.h"
43#include "geanywraplabel.h"
44#include "keybindingsprivate.h"
45#include "keyfile.h"
46#include "msgwindow.h"
47#include "prefs.h"
48#include "printing.h"
49#include "sidebar.h"
50#include "stash.h"
51#include "support.h"
52#include "templates.h"
53#include "toolbar.h"
54#include "tools.h"
55#include "ui_utils.h"
56#include "utils.h"
57#include "vte.h"
58#include "osx.h"
59
60#include <stdlib.h>
61#include <string.h>
62#include <gtk/gtk.h>
63#include <gdk/gdkkeysyms.h>
64
65
68
69
70typedef struct
71{
72 GtkTreeStore *store;
73 GtkTreeView *tree;
74 gboolean edited;
75}
76KbData;
77
78static KbData global_kb_data = { NULL, NULL, FALSE };
79static GtkTreeView *various_treeview = NULL;
80
81static GeanyKeyBinding *kb_index(guint gidx, guint kid);
82static void kb_cell_edited_cb(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, KbData *kbdata);
83static gboolean kb_grab_key_dialog_key_press_cb(GtkWidget *dialog, GdkEventKey *event, GtkLabel *label);
84static void kb_change_iter_shortcut(KbData *kbdata, GtkTreeIter *iter, const gchar *new_text);
85static gboolean kb_find_duplicate(GtkTreeStore *store, GtkWidget *parent, GtkTreeIter *old_iter,
86 guint key, GdkModifierType mods, const gchar *shortcut);
87static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data);
88static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data);
89static void on_enable_plugins_toggled(GtkToggleButton *togglebutton, gpointer user_data);
90static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
91static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
92static void on_sidebar_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
93static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data);
94static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
95static void open_preferences_help(void);
96
97
99{
104
105
106/* Synchronize Stash settings with widgets (see keyfile.c - init_pref_groups()). */
108{
110 guint i;
111
113 {
114 switch (action)
115 {
116 case PREF_DISPLAY:
117 stash_group_display(group, ui_widgets.prefs_dialog);
118 break;
119 case PREF_UPDATE:
120 stash_group_update(group, ui_widgets.prefs_dialog);
121 break;
122 }
123 }
124
125 switch (action)
126 {
127 case PREF_DISPLAY:
129 break;
130 case PREF_UPDATE:
132 break;
133 }
134}
135
136
137enum
138{
146
147
148static void kb_tree_view_change_button_clicked_cb(GtkWidget *button, KbData *kbdata)
149{
150 GtkTreeModel *model;
151 GtkTreeIter iter;
152 GtkTreeSelection *selection;
153 gchar *name;
154
155 selection = gtk_tree_view_get_selection(kbdata->tree);
156 if (gtk_tree_selection_get_selected(selection, &model, &iter))
157 {
158 if (gtk_tree_model_iter_has_child(model, &iter))
159 { /* double click on a section to expand or collapse it */
160 GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
161
162 if (gtk_tree_view_row_expanded(kbdata->tree, path))
163 gtk_tree_view_collapse_row(kbdata->tree, path);
164 else
165 gtk_tree_view_expand_row(kbdata->tree, path, FALSE);
166
167 gtk_tree_path_free(path);
168 return;
169 }
170
171 gtk_tree_model_get(model, &iter, KB_TREE_ACTION, &name, -1);
172 if (name != NULL)
173 {
174 GtkWidget *dialog;
175 GtkWidget *label;
176 GtkWidget *accel_label;
177 gchar *str;
178
179 dialog = gtk_dialog_new_with_buttons(_("Grab Key"), GTK_WINDOW(ui_widgets.prefs_dialog),
180 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
181 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
182 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
183
184 str = g_strdup_printf(
185 _("Press the combination of the keys you want to use for \"%s\"."), name);
186 label = gtk_label_new(str);
187 gtk_misc_set_padding(GTK_MISC(label), 5, 10);
188 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
189
190 accel_label = gtk_label_new("");
191 gtk_misc_set_padding(GTK_MISC(accel_label), 5, 10);
192 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), accel_label);
193
194 g_signal_connect(dialog, "key-press-event",
195 G_CALLBACK(kb_grab_key_dialog_key_press_cb), accel_label);
196
198 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
199 {
200 const gchar *new_text = gtk_label_get_text(GTK_LABEL(accel_label));
201
202 kb_change_iter_shortcut(kbdata, &iter, new_text);
203 }
204 gtk_widget_destroy(dialog);
205
206 g_free(str);
207 g_free(name);
208 }
209 }
210}
211
212
213static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton *event)
214{
215 static GtkWidget *menu = NULL;
216 guint button;
217 guint32 event_time;
218
219 if (menu == NULL)
220 {
221 GtkWidget *item;
222
223 menu = gtk_menu_new();
224
225 item = ui_image_menu_item_new(GTK_STOCK_ADD, _("_Expand All"));
226 gtk_widget_show(item);
227 gtk_container_add(GTK_CONTAINER(menu), item);
228 g_signal_connect_swapped(item, "activate", G_CALLBACK(gtk_tree_view_expand_all), kbdata->tree);
229
230 item = ui_image_menu_item_new(GTK_STOCK_REMOVE, _("_Collapse All"));
231 gtk_widget_show(item);
232 gtk_container_add(GTK_CONTAINER(menu), item);
233 g_signal_connect_swapped(item, "activate", G_CALLBACK(gtk_tree_view_collapse_all), kbdata->tree);
234
235 gtk_menu_attach_to_widget(GTK_MENU(menu), widget, NULL);
236 }
237
238 if (event != NULL)
239 {
240 button = event->button;
241 event_time = event->time;
242 }
243 else
244 {
245 button = 0;
246 event_time = gtk_get_current_event_time();
247 }
248
249 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, event_time);
250}
251
252
253static gboolean kb_popup_menu_cb(GtkWidget *widget, KbData *kbdata)
254{
255 kb_show_popup_menu(kbdata, widget, NULL);
256 return TRUE;
257}
258
259
260static gboolean kb_tree_view_button_press_event_cb(GtkWidget *widget, GdkEventButton *event,
261 KbData *kbdata)
262{
263 if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
264 {
265 kb_show_popup_menu(kbdata, widget, event);
266 return TRUE;
267 }
268 else if (event->type == GDK_2BUTTON_PRESS)
269 {
271 return TRUE;
272 }
273 return FALSE;
274}
275
276
277static void kb_init_tree(KbData *kbdata)
278{
279 GtkCellRenderer *renderer;
280 GtkTreeViewColumn *column;
281
282 kbdata->tree = GTK_TREE_VIEW(ui_lookup_widget(ui_widgets.prefs_dialog, "treeview7"));
283
284 kbdata->store = gtk_tree_store_new(KB_TREE_COLUMNS,
285 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT);
286 gtk_tree_view_set_model(GTK_TREE_VIEW(kbdata->tree), GTK_TREE_MODEL(kbdata->store));
287 g_object_unref(kbdata->store);
288
289 renderer = gtk_cell_renderer_text_new();
290 column = gtk_tree_view_column_new_with_attributes(_("Action"), renderer,
291 "text", KB_TREE_ACTION, "weight", KB_TREE_WEIGHT, NULL);
292 gtk_tree_view_append_column(GTK_TREE_VIEW(kbdata->tree), column);
293
294 renderer = gtk_cell_renderer_text_new();
295 column = gtk_tree_view_column_new_with_attributes(_("Shortcut"), renderer,
296 "text", KB_TREE_SHORTCUT, "editable", KB_TREE_EDITABLE,
297 "weight", KB_TREE_WEIGHT, NULL);
298 gtk_tree_view_append_column(GTK_TREE_VIEW(kbdata->tree), column);
299
300 /* set policy settings for the scrolled window around the treeview again, because glade
301 * doesn't keep the settings */
302 gtk_scrolled_window_set_policy(
303 GTK_SCROLLED_WINDOW(ui_lookup_widget(ui_widgets.prefs_dialog, "scrolledwindow8")),
304 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
305
306 g_signal_connect(renderer, "edited", G_CALLBACK(kb_cell_edited_cb), kbdata);
307 g_signal_connect(kbdata->tree, "button-press-event", G_CALLBACK(kb_tree_view_button_press_event_cb), kbdata);
308 g_signal_connect(kbdata->tree, "popup-menu", G_CALLBACK(kb_popup_menu_cb), kbdata);
309 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "button2"), "clicked",
310 G_CALLBACK(kb_tree_view_change_button_clicked_cb), kbdata);
311}
312
313
314static void kb_set_shortcut(GtkTreeStore *store, GtkTreeIter *iter,
315 guint key, GdkModifierType mods)
316{
317 gchar *key_string = gtk_accelerator_name(key, mods);
318 GtkTreeIter parent;
319 guint kid, gid;
320 GeanyKeyBinding *kb;
321 gboolean bold;
322
323 gtk_tree_store_set(store, iter, KB_TREE_SHORTCUT, key_string, -1);
324 g_free(key_string);
325
326 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, KB_TREE_INDEX, &kid, -1);
327 gtk_tree_model_iter_parent(GTK_TREE_MODEL(store), &parent, iter);
328 gtk_tree_model_get(GTK_TREE_MODEL(store), &parent, KB_TREE_INDEX, &gid, -1);
329 kb = kb_index(gid, kid);
330 bold = key != kb->default_key || mods != kb->default_mods;
331 gtk_tree_store_set(store, iter, KB_TREE_WEIGHT,
332 bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1);
333}
334
335
336void prefs_kb_search_name(const gchar *search)
337{
338 GtkTreeIter iter;
339 gboolean valid;
340 GtkTreeModel *model;
341 KbData *kbdata = &global_kb_data;
342
343 model = gtk_tree_view_get_model(kbdata->tree);
344 valid = gtk_tree_model_get_iter_first(model, &iter);
345 while (valid)
346 {
347 gchar *name;
348
349 gtk_tree_model_get(model, &iter, KB_TREE_ACTION, &name, -1);
350 if (g_strcmp0(name, search) == 0)
351 {
352 GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
353 gtk_tree_view_scroll_to_cell(kbdata->tree, path, NULL, TRUE, .0f, .0f);
354 gtk_tree_path_free(path);
355 g_free(name);
356 break;
357 }
358 g_free(name);
359 valid = gtk_tree_model_iter_next(model, &iter);
360 }
361}
362
363
364static void kb_init(KbData *kbdata)
365{
366 GtkTreeIter parent, iter;
367 gsize g, i;
368 gchar *label;
370 GeanyKeyBinding *kb;
371
372 if (kbdata->store == NULL)
373 kb_init_tree(kbdata);
374
376 {
377 gtk_tree_store_append(kbdata->store, &parent, NULL);
378 gtk_tree_store_set(kbdata->store, &parent, KB_TREE_ACTION, group->label,
379 KB_TREE_INDEX, g, -1);
380
381 foreach_ptr_array(kb, i, group->key_items)
382 {
384 gtk_tree_store_append(kbdata->store, &iter, &parent);
385 gtk_tree_store_set(kbdata->store, &iter, KB_TREE_ACTION, label,
386 KB_TREE_EDITABLE, TRUE, KB_TREE_INDEX, kb->id, -1);
387 kb_set_shortcut(kbdata->store, &iter, kb->key, kb->mods);
388 g_free(label);
389 }
390 }
391 gtk_tree_view_expand_all(GTK_TREE_VIEW(kbdata->tree));
392}
393
394
395/* note: new 'simple' prefs should use Stash code in keyfile.c */
396static void prefs_init_dialog(void)
397{
398 GtkWidget *widget;
399 GdkColor color = {0};
400
401 /* Synchronize with Stash settings */
403
404 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "label_project_indent_warning");
405 ui_widget_show_hide(widget, app->project != NULL);
406
407 /* General settings */
408 /* startup */
409 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
410 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session);
411
412 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_session");
413 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), project_prefs.project_session);
414
415 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_file_in_basedir");
416 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), project_prefs.project_file_in_basedir);
417
418 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos");
419 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.save_winpos);
420
421 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_save_win_geom");
422 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.save_wingeom);
423
424 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ask_for_quit");
425 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.confirm_exit);
426
427 /* behaviour */
428 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_beep");
429 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.beep_on_errors);
430
431 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_switch_pages");
432 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.switch_to_status);
433
434 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_suppress_status_msgs");
435 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.suppress_status_messages);
436
437 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_auto_focus");
438 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.auto_focus);
439
440 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_native_windows_dialogs");
441 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
443
444 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction");
445 gtk_entry_set_text(GTK_ENTRY(widget), tool_prefs.context_action_cmd);
446
447 project_setup_prefs(); /* project files path */
448
449
450 /* Interface settings */
451 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_sidebar_visible");
452 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ui_prefs.sidebar_visible);
453 on_sidebar_visible_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
454
455 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_symbol");
456 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), interface_prefs.sidebar_symbol_visible);
457
458 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
459 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), interface_prefs.sidebar_openfiles_visible);
460
461 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "tagbar_font");
462 gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), interface_prefs.tagbar_font);
463
464 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "msgwin_font");
465 gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), interface_prefs.msgwin_font);
466
467 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "editor_font");
468 gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), interface_prefs.editor_font);
469
470 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
471 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_column);
472
473 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
474 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.long_line_enabled);
475
477 {
478 case 0: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line"); break;
479 case 1: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background"); break;
480 }
481 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
482
484 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "long_line_color");
485 gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);
486
487 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
488 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), interface_prefs.show_notebook_tabs);
489 /* disable following setting if notebook tabs are hidden */
490 on_show_notebook_tabs_toggled(GTK_TOGGLE_BUTTON(
491 ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs")), NULL);
492
493 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross");
494 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.show_tab_cross);
495
496 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor");
497 gtk_combo_box_set_active(GTK_COMBO_BOX(widget), interface_prefs.tab_pos_editor);
498
499 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_msgwin");
500 gtk_combo_box_set_active(GTK_COMBO_BOX(widget), interface_prefs.tab_pos_msgwin);
501
502 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_sidebar");
503 gtk_combo_box_set_active(GTK_COMBO_BOX(widget), interface_prefs.tab_pos_sidebar);
504
505 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_statusbar_visible");
506 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), interface_prefs.statusbar_visible);
507
508
509 /* Toolbar settings */
510 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
511 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.visible);
512 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_in_menu");
513 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.append_to_menu);
514
516 {
517 case 0: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_image"); break;
518 case 1: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_text"); break;
519 default: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_imagetext"); break;
520 }
522 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_style_default");
523 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
524
525 switch (toolbar_prefs.icon_size)
526 {
527 case GTK_ICON_SIZE_LARGE_TOOLBAR:
528 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_large"); break;
529 case GTK_ICON_SIZE_SMALL_TOOLBAR:
530 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_small"); break;
531 default: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_verysmall"); break;
532 }
534 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_icon_default");
535 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
536
537 /* disable elements if toolbar is hidden */
538 on_toolbar_show_toggled(GTK_TOGGLE_BUTTON(
539 ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show")), NULL);
540
541
542 /* Files settings */
544 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_tab_right");
545 else
546 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_tab_left");
547 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
548
549 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_tab_beside");
550 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.tab_order_beside);
551
552 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
554
555 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding");
556 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
557 (file_prefs.default_open_encoding >= 0) ? TRUE : FALSE);
558 on_open_encoding_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
559
560 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding");
562 {
564 }
565 else
567
568 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_eol");
570 {
571 gtk_combo_box_set_active(GTK_COMBO_BOX(widget), file_prefs.default_eol_character);
572 }
573 else
574 gtk_combo_box_set_active(GTK_COMBO_BOX(widget), GEANY_DEFAULT_EOL_CHARACTER);
575
576 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces");
577 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.strip_trailing_spaces);
578
579 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
580 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.final_new_line);
581
582 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ensure_convert_new_lines");
583 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.ensure_convert_new_lines);
584
585 /* Editor settings */
586 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_toggle_mark");
587 gtk_entry_set_text(GTK_ENTRY(widget), editor_prefs.comment_toggle_mark);
588
589 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs");
590 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.replace_tabs);
591
592 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_indent");
593 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_indent_guide);
594
595 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_white_space");
596 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_white_space);
597
598 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
599 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_line_endings);
600
601 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_numbers");
602 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_linenumber_margin);
603
604 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_markers_margin");
605 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_markers_margin);
606
607 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_stop_at_last_line");
608 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.scroll_stop_at_last_line);
609
610 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
611 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
612
613 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_complete_snippets");
614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.complete_snippets);
615
616 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_xmltag");
617 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_close_xml_tags);
618
619 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding");
620 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.folding);
621
622 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children");
623 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.unfold_all_children);
624 on_use_folding_toggled(GTK_TOGGLE_BUTTON(
625 ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding")), NULL);
626
627 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_disable_dnd");
628 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.disable_dnd);
629
630 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_smart_home");
631 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.smart_home_key);
632
633 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
634 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.newline_strip);
635
636 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
637 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
638
639 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline");
640 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_continue_multiline);
641
642 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");
643 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_symbols);
644
645 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight");
646 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.symbolcompletion_max_height);
647
648 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_symbol_complete_chars");
649 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.symbolcompletion_min_chars);
650
651 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_line_break");
652 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.line_break_column);
653
654 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_parenthesis");
655 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
656 (editor_prefs.autoclose_chars & GEANY_AC_PARENTHESIS));
657
658 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_cbracket");
659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
660 (editor_prefs.autoclose_chars & GEANY_AC_CBRACKET));
661
662 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_sbracket");
663 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
664 (editor_prefs.autoclose_chars & GEANY_AC_SBRACKET));
665
666 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_squote");
667 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
668 (editor_prefs.autoclose_chars & GEANY_AC_SQUOTE));
669
670 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_dquote");
671 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
672 (editor_prefs.autoclose_chars & GEANY_AC_DQUOTE));
673
674 /* Tools Settings */
675
677 gtk_entry_set_text(GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_com_term")), tool_prefs.term_cmd);
678
680 gtk_entry_set_text(GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_browser")), tool_prefs.browser_cmd);
681
683 gtk_entry_set_text(GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_grep")), tool_prefs.grep_cmd);
684
685
686 /* Template settings */
687 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_developer");
688 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.developer);
689
690 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_company");
691 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.company);
692
693 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_mail");
694 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.mail);
695
696 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_initial");
697 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.initials);
698
699 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_version");
700 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.version);
701
702 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_year");
703 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.year_format);
704
705 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_date");
706 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.date_format);
707
708 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_datetime");
709 gtk_entry_set_text(GTK_ENTRY(widget), template_prefs.datetime_format);
710
711
712 /* Keybindings */
714
715 /* Printing */
716 {
717 GtkWidget *widget_gtk = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk");
719 widget = widget_gtk;
720 else
721 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_print_external");
722
723 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
724
725 on_prefs_print_radio_button_toggled(GTK_TOGGLE_BUTTON(widget_gtk), NULL);
726 }
728 gtk_entry_set_text(
729 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd")),
731
732 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_linenumbers");
733 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_line_numbers);
734
735 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_pagenumbers");
736 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_page_numbers);
737
738 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader");
739 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_page_header);
740 on_prefs_print_page_header_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
741
742 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_basename");
743 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.page_header_basename);
744
746 gtk_entry_set_text(
747 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat")),
749
750
751#ifndef HAVE_PLUGINS
752 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_plugins"), FALSE);
753#endif
754 on_enable_plugins_toggled(GTK_TOGGLE_BUTTON( ui_lookup_widget(ui_widgets.prefs_dialog, "check_plugins")), NULL);
755
756#ifdef HAVE_VTE
757 /* make VTE switch visible only when VTE is compiled in, it is hidden by default */
758 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_vte");
759 gtk_widget_show(widget);
760 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vte_info.load_vte);
761
762 /* VTE settings */
763 if (vte_info.have_vte)
764 {
765 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "font_term");
766 gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font);
767
768 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "color_fore");
769 gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &vc->colour_fore);
770
771 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "color_back");
772 gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &vc->colour_back);
773
774 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_scrollback");
775 gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), vc->scrollback_lines);
776
777 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_shell");
778 gtk_entry_set_text(GTK_ENTRY(widget), vc->shell);
779
780 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_key");
781 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_key);
782
783 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_out");
784 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_out);
785
786 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_enable_bash_keys");
787 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->enable_bash_keys);
788
789 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ignore_menu_key");
790 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->ignore_menu_bar_accel);
791
792 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_follow_path");
793 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->follow_path);
794
795 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_run_in_vte");
796 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->run_in_vte);
797
798 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_skip_script");
799 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->skip_run_script);
800
801 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_cursor_blinks");
802 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->cursor_blinks);
803 }
804#endif
805}
806
807
808/* note: uses group index, not group id, unlike keybindings_lookup_item(). */
809static GeanyKeyBinding *kb_index(guint gidx, guint kid)
810{
812
813 group = g_ptr_array_index(keybinding_groups, gidx);
814 return keybindings_get_item(group, kid);
815}
816
817
818/* read the treeview shortcut fields into keybindings */
819static void kb_update(KbData *kbdata)
820{
821 GtkTreeModel *model = GTK_TREE_MODEL(kbdata->store);
822 GtkTreeIter child, parent;
823 guint gid = 0;
824
825 /* get first parent */
826 if (! gtk_tree_model_iter_children(model, &parent, NULL))
827 return;
828
829 /* foreach parent */
830 while (TRUE)
831 {
832 /* get first child */
833 if (! gtk_tree_model_iter_children(model, &child, &parent))
834 return;
835
836 /* foreach child */
837 while (TRUE)
838 {
839 guint kid;
840 gchar *str;
841 guint key;
842 GdkModifierType mods;
843 GeanyKeyBinding *kb;
844
845 gtk_tree_model_get(model, &child, KB_TREE_INDEX, &kid, KB_TREE_SHORTCUT, &str, -1);
846 gtk_accelerator_parse(str, &key, &mods);
847 g_free(str);
848 kb = kb_index(gid, kid);
849 if (kb->key != key || kb->mods != mods)
850 keybindings_update_combo(kb, key, mods);
851
852 if (! gtk_tree_model_iter_next(model, &child))
853 break;
854 }
855 if (! gtk_tree_model_iter_next(model, &parent))
856 return;
857 gid++;
858 }
859}
860
861
862/*
863 * callbacks
864 */
865/* note: new 'simple' prefs should use Stash code in keyfile.c */
866static void
867on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
868{
869 if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY)
870 {
871 GtkWidget *widget;
872 guint i;
873 gboolean autoclose_brackets[5];
874 gboolean old_invert_all = interface_prefs.highlighting_invert_all;
875 gboolean old_sidebar_pos = interface_prefs.sidebar_pos;
877
878 /* Synchronize Stash settings */
880
881 if (interface_prefs.highlighting_invert_all != old_invert_all)
883
884 if (interface_prefs.sidebar_pos != old_sidebar_pos)
886
887 widget = ui_lookup_widget(main_widgets.window, "vpaned1");
888 gtk_orientable_set_orientation(GTK_ORIENTABLE(widget), interface_prefs.msgwin_orientation);
889
890 /* General settings */
891 /* startup */
892 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session");
893 prefs.load_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
894
895 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_session");
896 project_prefs.project_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
897
898 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_file_in_basedir");
899 project_prefs.project_file_in_basedir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
900
901 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos");
902 prefs.save_winpos = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
903
904 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_save_win_geom");
905 prefs.save_wingeom = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
906
907 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ask_for_quit");
908 prefs.confirm_exit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
909
910 /* behaviour */
911 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_beep");
912 prefs.beep_on_errors = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
913
914 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_switch_pages");
915 prefs.switch_to_status = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
916
917 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_suppress_status_msgs");
918 prefs.suppress_status_messages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
919
920 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_auto_focus");
921 prefs.auto_focus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
922
923 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_native_windows_dialogs");
925 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
926
927 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction");
929 tool_prefs.context_action_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
930
931 project_apply_prefs(); /* project file path */
932
933
934 /* Interface settings */
935 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_sidebar_visible");
936 ui_prefs.sidebar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
937
938 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_symbol");
939 interface_prefs.sidebar_symbol_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
940
941 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
942 interface_prefs.sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
943
944 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
945 editor_prefs.long_line_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
946
947 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line");
948 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
950 else
951 /* now only the "background" radio remains */
953
956
957 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
958 interface_prefs.show_notebook_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
959
960 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross");
961 file_prefs.show_tab_cross = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
962
963 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor");
964 interface_prefs.tab_pos_editor = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
965
966 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_msgwin");
967 interface_prefs.tab_pos_msgwin = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
968
969 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_sidebar");
970 interface_prefs.tab_pos_sidebar = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
971
972 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_statusbar_visible");
973 interface_prefs.statusbar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
974
975
976 /* Toolbar settings */
977 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
978 toolbar_prefs.visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
979 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_in_menu");
980 toolbar_prefs.append_to_menu = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
981
982 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_style_default");
983 toolbar_prefs.use_gtk_default_style = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
985 {
986 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_imagetext");
987 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
989 else
990 {
991 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_image");
992 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
994 else
995 /* now only the text only radio remains, so set text only */
997 }
998 }
999
1000 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_icon_default");
1001 toolbar_prefs.use_gtk_default_icon = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1003 { toolbar_prefs.icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
1004 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_large");
1005 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
1006 toolbar_prefs.icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
1007 else
1008 {
1009 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_small");
1010 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
1011 toolbar_prefs.icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
1012 else
1013 toolbar_prefs.icon_size = GTK_ICON_SIZE_MENU;
1014 }
1015 }
1016
1017 /* Files settings */
1018 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_tab_right");
1019 file_prefs.tab_order_ltr = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1020
1021 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_tab_beside");
1022 file_prefs.tab_order_beside = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1023
1024 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding");
1026
1027 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding");
1028 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
1029 {
1030 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding");
1032 }
1033 else
1035
1036 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_eol");
1037 file_prefs.default_eol_character = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
1038
1039 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_trailing_spaces");
1040 file_prefs.strip_trailing_spaces = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1041
1042 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
1043 file_prefs.final_new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1044
1045 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ensure_convert_new_lines");
1046 file_prefs.ensure_convert_new_lines = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1047
1048 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs");
1049 file_prefs.replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1050
1051
1052 /* Editor settings */
1053 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_toggle_mark");
1055 gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1));
1056
1057 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
1058 /* note: use stash for new code - it updates spin buttons itself */
1059 gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
1060 editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
1061
1062 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding");
1063 editor_prefs.folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1065
1066 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children");
1067 editor_prefs.unfold_all_children = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1068
1069 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_indent");
1070 editor_prefs.show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1071
1072 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_white_space");
1073 editor_prefs.show_white_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1074
1075 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
1076 editor_prefs.show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1077
1078 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_numbers");
1079 editor_prefs.show_linenumber_margin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1080
1081 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_markers_margin");
1082 editor_prefs.show_markers_margin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1083
1084 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_stop_at_last_line");
1085 editor_prefs.scroll_stop_at_last_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1086
1087 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
1088 editor_prefs.line_wrapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1089
1090 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_complete_snippets");
1091 editor_prefs.complete_snippets = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1092
1093 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_xmltag");
1094 editor_prefs.auto_close_xml_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1095
1096 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
1097 editor_prefs.use_indicators = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1098
1099 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_disable_dnd");
1100 editor_prefs.disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1101
1102 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_smart_home");
1103 editor_prefs.smart_home_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1104
1105 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
1106 editor_prefs.newline_strip = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1107
1108 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline");
1109 editor_prefs.auto_continue_multiline = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1110
1111 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");
1112 editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1113
1114 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_symbol_complete_chars");
1115 gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
1116 editor_prefs.symbolcompletion_min_chars = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
1117
1118 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight");
1119 gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
1120 editor_prefs.symbolcompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
1121
1122 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_line_break");
1123 gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
1124 editor_prefs.line_break_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
1125
1126 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_parenthesis");
1127 autoclose_brackets[0] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1128
1129 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_cbracket");
1130 autoclose_brackets[1] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1131
1132 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_sbracket");
1133 autoclose_brackets[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1134
1135 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_squote");
1136 autoclose_brackets[3] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1137
1138 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_autoclose_dquote");
1139 autoclose_brackets[4] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1140
1142 (autoclose_brackets[0] ? GEANY_AC_PARENTHESIS : 0u)
1143 | (autoclose_brackets[1] ? GEANY_AC_CBRACKET : 0u)
1144 | (autoclose_brackets[2] ? GEANY_AC_SBRACKET : 0u)
1145 | (autoclose_brackets[3] ? GEANY_AC_SQUOTE : 0u)
1146 | (autoclose_brackets[4] ? GEANY_AC_DQUOTE : 0u);
1147
1148 /* Tools Settings */
1149
1150 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_com_term");
1151 g_free(tool_prefs.term_cmd);
1152 tool_prefs.term_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1153
1154 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_browser");
1155 g_free(tool_prefs.browser_cmd);
1156 tool_prefs.browser_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1157
1158 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_grep");
1159 g_free(tool_prefs.grep_cmd);
1160 tool_prefs.grep_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1161
1162
1163 /* Template settings */
1164 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_developer");
1165 g_free(template_prefs.developer);
1166 template_prefs.developer = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1167
1168 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_company");
1169 g_free(template_prefs.company);
1170 template_prefs.company = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1171
1172 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_mail");
1173 g_free(template_prefs.mail);
1174 template_prefs.mail = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1175
1176 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_initial");
1177 g_free(template_prefs.initials);
1178 template_prefs.initials = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1179
1180 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_version");
1181 g_free(template_prefs.version);
1182 template_prefs.version = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1183
1184 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_year");
1186 template_prefs.year_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1187
1188 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_date");
1190 template_prefs.date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1191
1192 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_template_datetime");
1194 template_prefs.datetime_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1195
1196
1197 /* Keybindings */
1199 {
1203#ifdef MAC_INTEGRATION
1204 /* Force re-syncing the menubar to update displayed keybindings. */
1205 gtkosx_application_sync_menubar(gtkosx_application_get());
1206#endif
1207 }
1208
1209 /* Printing */
1210 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk");
1211 printing_prefs.use_gtk_printing = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1212
1213 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd");
1215 printing_prefs.external_print_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1216
1217 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_linenumbers");
1218 printing_prefs.print_line_numbers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1219
1220 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_pagenumbers");
1221 printing_prefs.print_page_numbers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1222
1223 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader");
1224 printing_prefs.print_page_header = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1225
1226 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_basename");
1227 printing_prefs.page_header_basename = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1228
1229 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat");
1231 printing_prefs.page_header_datefmt = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1232
1233
1234#ifdef HAVE_VTE
1235 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_vte");
1236 vte_info.load_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1237
1238 /* VTE settings */
1239 if (vte_info.have_vte)
1240 {
1241 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_scrollback");
1242 gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
1243 vc->scrollback_lines = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
1244
1245 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_shell");
1246 g_free(vc->shell);
1247 vc->shell = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
1248
1249 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_key");
1250 vc->scroll_on_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1251
1252 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_scroll_out");
1253 vc->scroll_on_out = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1254
1255 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_enable_bash_keys");
1256 vc->enable_bash_keys = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1257
1258 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ignore_menu_key");
1259 vc->ignore_menu_bar_accel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1260
1261 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_follow_path");
1262 vc->follow_path = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1263
1264 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_run_in_vte");
1265 vc->run_in_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1266
1267 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_skip_script");
1268 vc->skip_run_script = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1269
1270 widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_cursor_blinks");
1271 vc->cursor_blinks = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
1272
1273 vte_apply_user_settings();
1274 }
1275#endif
1276
1277 /* apply the changes made */
1279 sidebar_openfiles_update_all(); /* to update if full path setting has changed */
1284 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
1285
1286 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor);
1287 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin);
1288 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar);
1289
1290 /* re-colourise all open documents, if tab width or long line settings have changed */
1291 for (i = 0; i < documents_array->len; i++)
1292 {
1293 if (documents[i]->is_valid)
1294 {
1296 if (! editor_prefs.folding)
1297 editor_unfold_all(documents[i]->editor);
1298 }
1299 }
1302
1303 /* various preferences */
1304 ui_save_buttons_toggle((doc != NULL) ? doc->changed : FALSE);
1306 ui_update_statusbar(doc, -1);
1307
1308 /* store all settings */
1310 }
1311
1312 if (response == GTK_RESPONSE_HELP)
1313 {
1315 }
1316 else if (response != GTK_RESPONSE_APPLY)
1317 {
1318 gtk_tree_store_clear(global_kb_data.store);
1319 gtk_widget_hide(GTK_WIDGET(dialog));
1320 }
1321}
1322
1323
1324static void on_color_button_choose_cb(GtkColorButton *widget, gpointer user_data)
1325{
1326 GdkColor color;
1327
1328 gtk_color_button_get_color(widget, &color);
1330}
1331
1332
1333static void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
1334{
1335 const gchar *fontbtn = gtk_font_button_get_font_name(widget);
1336 guint i;
1337
1338 switch (GPOINTER_TO_INT(user_data))
1339 {
1340 case 1:
1341 {
1342 if (strcmp(fontbtn, interface_prefs.tagbar_font) == 0)
1343 break;
1344
1345 SETPTR(interface_prefs.tagbar_font, g_strdup(fontbtn));
1346 for (i = 0; i < documents_array->len; i++)
1347 {
1348 GeanyDocument *doc = documents[i];
1349
1350 if (documents[i]->is_valid && GTK_IS_WIDGET(doc->priv->tag_tree))
1353 }
1354 if (GTK_IS_WIDGET(tv.default_tag_tree))
1357 break;
1358 }
1359 case 2:
1360 {
1361 if (strcmp(fontbtn, interface_prefs.msgwin_font) == 0)
1362 break;
1363 SETPTR(interface_prefs.msgwin_font, g_strdup(fontbtn));
1368 break;
1369 }
1370 case 3:
1371 {
1372 ui_set_editor_font(fontbtn);
1373 break;
1374 }
1375 }
1376}
1377
1378
1379static void kb_change_iter_shortcut(KbData *kbdata, GtkTreeIter *iter, const gchar *new_text)
1380{
1381 guint lkey;
1382 GdkModifierType lmods;
1383
1384 gtk_accelerator_parse(new_text, &lkey, &lmods);
1385
1386 if (kb_find_duplicate(kbdata->store, ui_widgets.prefs_dialog, iter, lkey, lmods, new_text))
1387 return;
1388
1389 /* set the values here, because of the above check, setting it in
1390 * gtk_accelerator_parse would return a wrong key combination if it is duplicate */
1391 kb_set_shortcut(kbdata->store, iter, lkey, lmods);
1392
1393 kbdata->edited = TRUE;
1394}
1395
1396
1397static void kb_cell_edited_cb(GtkCellRendererText *cellrenderertext,
1398 gchar *path, gchar *new_text, KbData *kbdata)
1399{
1400 if (path != NULL && new_text != NULL)
1401 {
1402 GtkTreeIter iter;
1403
1404 gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(kbdata->store), &iter, path);
1405 if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(kbdata->store), &iter))
1406 return; /* ignore group items */
1407
1408 kb_change_iter_shortcut(kbdata, &iter, new_text);
1409 }
1410}
1411
1412
1413static gboolean kb_grab_key_dialog_key_press_cb(GtkWidget *dialog, GdkEventKey *event, GtkLabel *label)
1414{
1415 gchar *str;
1416 guint state;
1417
1418 g_return_val_if_fail(GTK_IS_LABEL(label), FALSE);
1419
1420 state = keybindings_get_modifiers(event->state);
1421
1422 if (event->keyval == GDK_KEY_Escape)
1423 return FALSE; /* close the dialog, don't allow escape when detecting keybindings. */
1424
1425 str = gtk_accelerator_name(event->keyval, state);
1426
1427 gtk_label_set_text(label, str);
1428 g_free(str);
1429
1430 return TRUE;
1431}
1432
1433
1434/* test if the entered key combination is already used
1435 * returns true if cancelling duplicate */
1436static gboolean kb_find_duplicate(GtkTreeStore *store, GtkWidget *parent, GtkTreeIter *old_iter,
1437 guint key, GdkModifierType mods, const gchar *shortcut)
1438{
1439 GtkTreeModel *model = GTK_TREE_MODEL(store);
1440 GtkTreeIter parent_iter;
1441 gchar *kb_str;
1442 guint kb_key;
1443 GdkModifierType kb_mods;
1444
1445 /* allow duplicate if there is no key combination */
1446 if (key == 0 && mods == 0)
1447 return FALSE;
1448
1449 /* don't check if the new keybinding is the same as the old one */
1450 gtk_tree_model_get(model, old_iter, KB_TREE_SHORTCUT, &kb_str, -1);
1451 if (kb_str)
1452 {
1453 gtk_accelerator_parse(kb_str, &kb_key, &kb_mods);
1454 g_free(kb_str);
1455 if (key == kb_key && mods == kb_mods)
1456 return FALSE;
1457 }
1458
1459 if (! gtk_tree_model_get_iter_first(model, &parent_iter))
1460 return FALSE;
1461 do /* foreach top level */
1462 {
1463 GtkTreeIter iter;
1464
1465 if (! gtk_tree_model_iter_children(model, &iter, &parent_iter))
1466 continue;
1467 do /* foreach children */
1468 {
1469 gtk_tree_model_get(model, &iter, KB_TREE_SHORTCUT, &kb_str, -1);
1470 if (! kb_str)
1471 continue;
1472
1473 gtk_accelerator_parse(kb_str, &kb_key, &kb_mods);
1474 g_free(kb_str);
1475 /* search another item with the same key and modifiers */
1476 if (kb_key == key && kb_mods == mods)
1477 {
1478 gchar *label;
1479 gint ret;
1480
1481 gtk_tree_model_get(model, &iter, KB_TREE_ACTION, &label, -1);
1482 ret = dialogs_show_prompt(parent,
1483 _("_Allow"), GTK_RESPONSE_APPLY,
1484 GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
1485 _("_Override"), GTK_RESPONSE_YES,
1486 _("Override that keybinding?"),
1487 _("The combination '%s' is already used for \"%s\"."),
1488 shortcut, label);
1489
1490 g_free(label);
1491
1492 if (ret == GTK_RESPONSE_YES)
1493 {
1494 kb_set_shortcut(store, &iter, 0, 0); /* clear shortcut */
1495 /* carry on looking for other duplicates if overriding */
1496 continue;
1497 }
1498 return ret != GTK_RESPONSE_APPLY;
1499 }
1500 }
1501 while (gtk_tree_model_iter_next(model, &iter));
1502 }
1503 while (gtk_tree_model_iter_next(model, &parent_iter));
1504
1505 return FALSE;
1506}
1507
1508
1509static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1510{
1511 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1512
1513 gtk_widget_set_sensitive(
1514 ui_lookup_widget(ui_widgets.prefs_dialog, "frame_toolbar_style"), sens);
1515 gtk_widget_set_sensitive(
1516 ui_lookup_widget(ui_widgets.prefs_dialog, "frame_toolbar_icon"), sens);
1517 gtk_widget_set_sensitive(
1518 ui_lookup_widget(ui_widgets.prefs_dialog, "button_customize_toolbar"), sens);
1519 gtk_widget_set_sensitive(
1520 ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_in_menu"), sens);
1521}
1522
1523
1524static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1525{
1526 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1527
1528 /* tab placement only enabled when tabs are visible */
1529 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "combo_tab_editor"), sens);
1530 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_tab_cross"), sens);
1531}
1532
1533
1534static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1535{
1536 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1537
1538 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_unfold_children"), sens);
1539}
1540
1541
1542static void on_enable_plugins_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1543{
1544 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1545
1546 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "extra_plugin_path_entry"), sens);
1547 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "extra_plugin_path_button"), sens);
1548}
1549
1550
1551static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1552{
1553 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1554
1555 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "eventbox3"), sens);
1556 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "label_open_encoding"), sens);
1557}
1558
1559
1560static void on_sidebar_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1561{
1562 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1563
1564 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "box_sidebar_visible_children"), sens);
1565}
1566
1567
1568static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1569{
1570 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1571
1572 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "vbox29"), sens);
1573 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "hbox9"), ! sens);
1574}
1575
1576
1577static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data)
1578{
1579 gboolean sens = gtk_toggle_button_get_active(togglebutton);
1580
1581 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_basename"), sens);
1582 gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat"), sens);
1583}
1584
1585
1586static void open_preferences_help(void)
1587{
1588 gchar *uri;
1589 const gchar *label, *suffix = NULL;
1590 GtkNotebook *notebook = GTK_NOTEBOOK(
1591 ui_lookup_widget(ui_widgets.prefs_dialog, "notebook2"));
1592 gint page_nr = gtk_notebook_get_current_page(notebook);
1593 GtkWidget *page = gtk_notebook_get_nth_page(notebook, page_nr);
1594
1595 label = gtk_notebook_get_tab_label_text(notebook, page);
1596
1597 /* TODO Find a better way to map the current notebook page to the
1598 * corresponding chapter in the documentation, comparing translatable
1599 * strings is easy to break. Maybe attach an identifying string to the
1600 * tab label object. */
1601 if (utils_str_equal(label, _("General")))
1602 suffix = "#general-startup-preferences";
1603 else if (utils_str_equal(label, _("Interface")))
1604 suffix = "#interface-preferences";
1605 else if (utils_str_equal(label, _("Toolbar")))
1606 suffix = "#toolbar-preferences";
1607 else if (utils_str_equal(label, _("Editor")))
1608 suffix = "#editor-features-preferences";
1609 else if (utils_str_equal(label, _("Files")))
1610 suffix = "#files-preferences";
1611 else if (utils_str_equal(label, _("Tools")))
1612 suffix = "#tools-preferences";
1613 else if (utils_str_equal(label, _("Templates")))
1614 suffix = "#template-preferences";
1615 else if (utils_str_equal(label, _("Keybindings")))
1616 suffix = "#keybinding-preferences";
1617 else if (utils_str_equal(label, _("Printing")))
1618 suffix = "#printing-preferences";
1619 else if (utils_str_equal(label, _("Various")))
1620 suffix = "#various-preferences";
1621 else if (utils_str_equal(label, _("Terminal")))
1622 suffix = "#terminal-vte-preferences";
1623
1624 uri = utils_get_help_url(suffix);
1625 utils_open_browser(uri);
1626 g_free(uri);
1627}
1628
1629
1630static gboolean prefs_dialog_key_press_response_cb(GtkWidget *dialog, GdkEventKey *event,
1631 gpointer data)
1632{
1634
1635 if (keybindings_check_event(event, kb))
1636 {
1638 return TRUE;
1639 }
1640 return FALSE;
1641}
1642
1643
1644static void list_store_append_text(GtkListStore *list, const gchar *text)
1645{
1646 GtkTreeIter iter;
1647
1648 gtk_list_store_append(list, &iter);
1649 gtk_list_store_set(list, &iter, 0, text, -1);
1650}
1651
1652
1654{
1655 if (ui_widgets.prefs_dialog == NULL)
1656 {
1657 GtkListStore *eol_list;
1658 GtkWidget *label;
1659
1660 ui_widgets.prefs_dialog = create_prefs_dialog();
1661 gtk_widget_set_name(ui_widgets.prefs_dialog, "GeanyPrefsDialog");
1662 gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.prefs_dialog), GTK_WINDOW(main_widgets.window));
1663
1664 /* init the file encoding combo boxes */
1665 {
1666 struct {
1667 const gchar *combo, *renderer;
1668 } names[] = {
1669 { "combo_new_encoding", "combo_new_encoding_renderer" },
1670 { "combo_open_encoding", "combo_open_encoding_renderer" }
1671 };
1672 guint i;
1673 GtkTreeStore *encoding_list = encodings_encoding_store_new(FALSE);
1674
1675 for (i = 0; i < G_N_ELEMENTS(names); i++)
1676 {
1677 GtkWidget *combo = ui_lookup_widget(ui_widgets.prefs_dialog, names[i].combo);
1678
1679 gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(combo),
1680 ui_builder_get_object(names[i].renderer),
1682 gtk_combo_box_set_model(GTK_COMBO_BOX(combo), GTK_TREE_MODEL(encoding_list));
1683 }
1684 g_object_unref(encoding_list);
1685 }
1686
1687 /* init the eol character combo box */
1688 eol_list = ui_builder_get_object("eol_list");
1692
1693
1694 /* add manually GeanyWrapLabels because they can't be added with Glade */
1695 /* page Tools */
1696 label = geany_wrap_label_new(_("Enter tool paths below. Tools you do not need can be left blank."));
1697 gtk_widget_show(label);
1698 gtk_box_pack_start(GTK_BOX(ui_lookup_widget(ui_widgets.prefs_dialog, "vbox33")),
1699 label, FALSE, TRUE, 5);
1700 /* page Templates */
1701 label = geany_wrap_label_new(_("Set the information to be used in templates. See the documentation for details."));
1702 gtk_widget_show(label);
1703 gtk_box_pack_start(GTK_BOX(ui_lookup_widget(ui_widgets.prefs_dialog, "vbox31")),
1704 label, FALSE, TRUE, 5);
1705 /* page Keybindings */
1706 label = geany_wrap_label_new(_("Here you can change keyboard shortcuts for various actions. Select one and press the Change button to enter a new shortcut, or double click on an action to edit the string representation of the shortcut directly."));
1707 gtk_widget_show(label);
1708 gtk_box_pack_start(GTK_BOX(ui_lookup_widget(ui_widgets.prefs_dialog, "vbox32")),
1709 label, FALSE, TRUE, 5);
1710 /* page Editor->Indentation */
1711 label = geany_wrap_label_new(_("<i>Warning: these settings are overridden by the current project. See <b>Project->Properties</b>.</i>"));
1712 gtk_widget_show(label);
1713 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
1714 gtk_misc_set_padding(GTK_MISC(label), 6, 0);
1715 gtk_box_pack_start(GTK_BOX(ui_lookup_widget(ui_widgets.prefs_dialog,
1716 "label_project_indent_warning")), label, FALSE, TRUE, 5);
1717
1718 /* add the clear icon to GtkEntry widgets in the dialog */
1719 {
1720 const gchar *names[] = {
1721 "startup_path_entry",
1722 "project_file_path_entry",
1723 "extra_plugin_path_entry",
1724 "entry_toggle_mark",
1725 /* "entry_com_make", */
1726 "entry_com_term",
1727 "entry_browser",
1728 "entry_grep",
1729 "entry_contextaction",
1730 "entry_template_developer",
1731 "entry_template_initial",
1732 "entry_template_mail",
1733 "entry_template_company",
1734 "entry_template_version",
1735 "entry_template_year",
1736 "entry_template_date",
1737 "entry_template_datetime",
1738 "entry_print_external_cmd",
1739 "entry_print_dateformat"};
1740 const gchar **name;
1741
1742 foreach_c_array(name, names, G_N_ELEMENTS(names))
1743 ui_entry_add_clear_icon(GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, *name)));
1744 }
1745
1746 /* page Various */
1747 various_treeview = GTK_TREE_VIEW(ui_lookup_widget(ui_widgets.prefs_dialog,
1748 "various_treeview"));
1750
1751#ifdef HAVE_VTE
1752 vte_append_preferences_tab();
1753#endif
1754
1755#ifndef G_OS_WIN32
1756 gtk_widget_hide(ui_lookup_widget(ui_widgets.prefs_dialog, "check_native_windows_dialogs"));
1757#endif
1758 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "startup_path_button"), NULL,
1759 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "startup_path_entry")));
1760 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "extra_plugin_path_button"), NULL,
1761 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "extra_plugin_path_entry")));
1762
1763 g_signal_connect(ui_widgets.prefs_dialog, "response",
1764 G_CALLBACK(on_prefs_dialog_response), NULL);
1765 g_signal_connect(ui_widgets.prefs_dialog, "delete-event",
1766 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
1767
1768 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "tagbar_font"),
1769 "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(1));
1770 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "msgwin_font"),
1771 "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(2));
1772 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "editor_font"),
1773 "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(3));
1774 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "long_line_color"),
1775 "color-set", G_CALLBACK(on_color_button_choose_cb), NULL);
1776 /* file chooser buttons in the tools tab */
1777 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "button_term"),
1778 NULL,
1779 GTK_FILE_CHOOSER_ACTION_OPEN,
1780 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_com_term")));
1781 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "button_browser"),
1782 NULL,
1783 GTK_FILE_CHOOSER_ACTION_OPEN,
1784 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_browser")));
1785 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "button_grep"),
1786 NULL,
1787 GTK_FILE_CHOOSER_ACTION_OPEN,
1788 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_grep")));
1789
1790 /* tools commands */
1791 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "button_contextaction"),
1792 NULL,
1793 GTK_FILE_CHOOSER_ACTION_OPEN,
1794 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction")));
1795
1796 /* printing */
1797 ui_setup_open_button_callback(ui_lookup_widget(ui_widgets.prefs_dialog, "button_print_external_cmd"),
1798 NULL,
1799 GTK_FILE_CHOOSER_ACTION_OPEN,
1800 GTK_ENTRY(ui_lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd")));
1801
1802 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk"),
1803 "toggled", G_CALLBACK(on_prefs_print_radio_button_toggled), NULL);
1804 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader"),
1805 "toggled", G_CALLBACK(on_prefs_print_page_header_toggled), NULL);
1806
1807 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_plugins"),
1808 "toggled", G_CALLBACK(on_enable_plugins_toggled), NULL);
1809 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show"),
1810 "toggled", G_CALLBACK(on_toolbar_show_toggled), NULL);
1811 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs"),
1812 "toggled", G_CALLBACK(on_show_notebook_tabs_toggled), NULL);
1813 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding"),
1814 "toggled", G_CALLBACK(on_use_folding_toggled), NULL);
1815 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding"),
1816 "toggled", G_CALLBACK(on_open_encoding_toggled), NULL);
1817 g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_sidebar_visible"),
1818 "toggled", G_CALLBACK(on_sidebar_visible_toggled), NULL);
1819
1820 g_signal_connect(ui_widgets.prefs_dialog,
1821 "key-press-event", G_CALLBACK(prefs_dialog_key_press_response_cb), NULL);
1822 }
1823
1825 gtk_window_present(GTK_WINDOW(ui_widgets.prefs_dialog));
1826}
#define SC_EOL_CR
Definition: Scintilla.h:89
#define SC_EOL_LF
Definition: Scintilla.h:90
#define SC_EOL_CRLF
Definition: Scintilla.h:88
Contains the GeanyApp.
const gchar * label
Definition: build.c:2676
gint dialogs_show_prompt(GtkWidget *parent, const gchar *btn_1, GtkResponseType response_1, const gchar *btn_2, GtkResponseType response_2, const gchar *btn_3, GtkResponseType response_3, const gchar *extra_text, const gchar *main_text,...)
Definition: dialogs.c:1417
File related dialogs, miscellaneous dialogs, font dialog.
GeanyDocument * document_get_current(void)
Finds the current document.
Definition: document.c:371
const gchar * name
Definition: document.c:3219
GeanyFilePrefs file_prefs
Definition: document.c:86
GdkColor color
Definition: document.c:3220
GPtrArray * documents_array
Definition: document.c:87
#define documents
Wraps GeanyData::documents_array so it can be used with C array syntax.
Definition: document.h:130
void editor_unfold_all(GeanyEditor *editor)
Definition: editor.c:4384
gchar * text
Definition: editor.c:83
void editor_apply_update_prefs(GeanyEditor *editor)
Definition: editor.c:5161
GeanyEditorPrefs editor_prefs
Definition: editor.c:77
Editor-related functions for GeanyEditor.
void encodings_encoding_store_cell_data_func(GtkCellLayout *cell_layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
Definition: encodings.c:597
GtkTreeStore * encodings_encoding_store_new(gboolean has_detect)
Definition: encodings.c:517
@ GEANY_ENCODING_UTF_8
Definition: encodings.h:68
Filetype detection, file extensions and filetype menu items.
tokenInfo * list
GtkWidget * geany_wrap_label_new(const gchar *text)
void keybindings_update_combo(GeanyKeyBinding *kb, guint key, GdkModifierType mods)
Definition: keybindings.c:2644
GeanyKeyBinding * keybindings_lookup_item(guint group_id, guint key_id)
Definition: keybindings.c:1408
GPtrArray * keybinding_groups
Definition: keybindings.c:62
GdkModifierType keybindings_get_modifiers(GdkModifierType mods)
Gets significant modifiers from a GdkModifierType mask.
Definition: keybindings.c:121
GeanyKeyBinding * keybindings_get_item(GeanyKeyGroup *group, gsize key_id)
Looks up a keybinding item.
Definition: keybindings.c:140
gboolean keybindings_check_event(GdkEventKey *ev, GeanyKeyBinding *kb)
Definition: keybindings.c:1302
void keybindings_write_to_file(void)
Definition: keybindings.c:915
gchar * keybindings_get_label(GeanyKeyBinding *kb)
Definition: keybindings.c:946
@ GEANY_KEY_GROUP_HELP
Group.
Definition: keybindings.h:118
@ GEANY_KEYS_HELP_HELP
Keybinding.
Definition: keybindings.h:160
void configuration_save(void)
Definition: keyfile.c:632
GPtrArray * pref_groups
Definition: keyfile.c:115
GeanyApp * app
Definition: libmain.c:86
void msgwin_show_hide_tabs(void)
Definition: msgwindow.c:99
MessageWindow msgwindow
Definition: msgwindow.c:66
Message window functions (status, compiler, messages windows).
static gboolean prefs_dialog_key_press_response_cb(GtkWidget *dialog, GdkEventKey *event, gpointer data)
Definition: prefs.c:1630
static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1577
static void kb_tree_view_change_button_clicked_cb(GtkWidget *button, KbData *kbdata)
Definition: prefs.c:148
static GeanyKeyBinding * kb_index(guint gidx, guint kid)
Definition: prefs.c:809
static void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
Definition: prefs.c:1333
@ KB_TREE_COLUMNS
Definition: prefs.c:144
@ KB_TREE_EDITABLE
Definition: prefs.c:142
@ KB_TREE_SHORTCUT
Definition: prefs.c:140
@ KB_TREE_WEIGHT
Definition: prefs.c:143
@ KB_TREE_ACTION
Definition: prefs.c:139
@ KB_TREE_INDEX
Definition: prefs.c:141
static void kb_update(KbData *kbdata)
Definition: prefs.c:819
static void on_color_button_choose_cb(GtkColorButton *widget, gpointer user_data)
Definition: prefs.c:1324
static void on_enable_plugins_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1542
static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1551
static gboolean kb_find_duplicate(GtkTreeStore *store, GtkWidget *parent, GtkTreeIter *old_iter, guint key, GdkModifierType mods, const gchar *shortcut)
Definition: prefs.c:1436
static void prefs_action(PrefCallbackAction action)
Definition: prefs.c:107
PrefCallbackAction
Definition: prefs.c:99
@ PREF_UPDATE
Definition: prefs.c:101
@ PREF_DISPLAY
Definition: prefs.c:100
static void kb_cell_edited_cb(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, KbData *kbdata)
Definition: prefs.c:1397
static void on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
Definition: prefs.c:867
static void on_sidebar_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1560
static gboolean kb_popup_menu_cb(GtkWidget *widget, KbData *kbdata)
Definition: prefs.c:253
static gboolean kb_grab_key_dialog_key_press_cb(GtkWidget *dialog, GdkEventKey *event, GtkLabel *label)
Definition: prefs.c:1413
static gboolean kb_tree_view_button_press_event_cb(GtkWidget *widget, GdkEventButton *event, KbData *kbdata)
Definition: prefs.c:260
static void kb_show_popup_menu(KbData *kbdata, GtkWidget *widget, GdkEventButton *event)
Definition: prefs.c:213
static void list_store_append_text(GtkListStore *list, const gchar *text)
Definition: prefs.c:1644
GeanyToolPrefs tool_prefs
Definition: prefs.c:67
static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1509
static void prefs_init_dialog(void)
Definition: prefs.c:396
static void kb_set_shortcut(GtkTreeStore *store, GtkTreeIter *iter, guint key, GdkModifierType mods)
Definition: prefs.c:314
static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1534
static void open_preferences_help(void)
Definition: prefs.c:1586
static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1568
static GtkTreeView * various_treeview
Definition: prefs.c:79
void prefs_show_dialog(void)
Definition: prefs.c:1653
static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data)
Definition: prefs.c:1524
GeanyPrefs prefs
Definition: prefs.c:66
static void kb_change_iter_shortcut(KbData *kbdata, GtkTreeIter *iter, const gchar *new_text)
Definition: prefs.c:1379
static KbData global_kb_data
Definition: prefs.c:78
void prefs_kb_search_name(const gchar *search)
Definition: prefs.c:336
static void kb_init(KbData *kbdata)
Definition: prefs.c:364
static void kb_init_tree(KbData *kbdata)
Definition: prefs.c:277
PrintingPrefs printing_prefs
Definition: printing.c:50
void project_apply_prefs(void)
Definition: project.c:1249
ProjectPrefs project_prefs
Definition: project.c:53
void project_setup_prefs(void)
Definition: project.c:1230
#define NULL
Definition: rbtree.h:150
SidebarTreeviews tv
Definition: sidebar.c:50
void sidebar_openfiles_update_all(void)
Definition: sidebar.c:542
void filetypes_reload(void)
Definition: filetypes.c:1495
StashGroup * group
Definition: stash-example.c:1
stash_group_update(group, dialog)
GtkWidget * dialog
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button)
gtk_widget_show_all(dialog)
stash_group_display(group, dialog)
void stash_tree_setup(GPtrArray *group_array, GtkTreeView *tree)
Definition: stash.c:1154
void stash_tree_update(GtkTreeView *tree)
Definition: stash.c:1279
void stash_tree_display(GtkTreeView *tree)
Definition: stash.c:1273
Lightweight library for reading/writing GKeyFile settings and synchronizing widgets with C variables.
struct GeanyProject * project
Currently active project or NULL if none is open.
Definition: app.h:49
Structure for representing an open tab with all its properties.
Definition: document.h:81
gboolean changed
Whether this document has been changed since it was last saved.
Definition: document.h:107
struct GeanyDocumentPrivate * priv
Definition: document.h:121
gboolean unfold_all_children
Definition: editor.h:115
gint symbolcompletion_min_chars
Definition: editor.h:123
gboolean line_wrapping
Definition: editor.h:112
gboolean scroll_stop_at_last_line
Definition: editor.h:111
gboolean newline_strip
Definition: editor.h:119
gboolean disable_dnd
Definition: editor.h:116
gboolean show_markers_margin
Definition: editor.h:108
gboolean auto_continue_multiline
Definition: editor.h:129
gint line_break_column
Definition: editor.h:128
gboolean long_line_enabled
Definition: editor.h:137
gboolean show_indent_guide
Definition: editor.h:102
gboolean show_linenumber_margin
Definition: editor.h:109
gint long_line_column
Definition: editor.h:106
guint autoclose_chars
Definition: editor.h:132
gchar * comment_toggle_mark
Definition: editor.h:130
gboolean auto_close_xml_tags
Definition: editor.h:121
gboolean auto_complete_symbols
Definition: editor.h:120
gboolean use_indicators
Definition: editor.h:113
gboolean complete_snippets
Definition: editor.h:122
gint symbolcompletion_max_height
Definition: editor.h:124
gint long_line_type
Definition: editor.h:105
gboolean smart_home_key
Definition: editor.h:118
gboolean show_line_endings
Definition: editor.h:103
gboolean folding
Definition: editor.h:114
gchar * long_line_color
Definition: editor.h:107
gboolean show_white_space
Definition: editor.h:101
gint default_new_encoding
Definition: document.h:48
gboolean tab_order_beside
Definition: document.h:54
gint default_open_encoding
Definition: document.h:49
gboolean strip_trailing_spaces
Definition: document.h:51
gboolean final_new_line
Definition: document.h:50
gint default_eol_character
Definition: document.h:57
gboolean show_tab_cross
Definition: document.h:55
gboolean ensure_convert_new_lines
Definition: document.h:61
gboolean replace_tabs
Definition: document.h:52
gboolean tab_order_ltr
Definition: document.h:53
gint tab_pos_editor
positions of editor's tabs
Definition: ui_utils.h:53
gboolean statusbar_visible
whether the status bar is visible
Definition: ui_utils.h:56
gint sidebar_pos
position of the sidebar (left or right)
Definition: ui_utils.h:61
gboolean use_native_windows_dialogs
whether to use native Windows' dialogs (only used on Windows)
Definition: ui_utils.h:67
gboolean sidebar_symbol_visible
whether the symbol sidebar is visible
Definition: ui_utils.h:47
gint tab_pos_sidebar
positions of sidebar's tabs
Definition: ui_utils.h:55
gchar * editor_font
editor font
Definition: ui_utils.h:49
gboolean highlighting_invert_all
whether highlighting colors are inverted
Definition: ui_utils.h:60
gboolean sidebar_openfiles_visible
whether the open file list is visible
Definition: ui_utils.h:48
gchar * msgwin_font
message window font
Definition: ui_utils.h:51
gboolean show_notebook_tabs
whether editor tabs are visible
Definition: ui_utils.h:52
gint tab_pos_msgwin
positions of message window's tabs
Definition: ui_utils.h:54
gint msgwin_orientation
orientation of the message window
Definition: ui_utils.h:70
gchar * tagbar_font
symbol sidebar font
Definition: ui_utils.h:50
Represents a single keybinding action.
Definition: keybindings.h:75
GdkModifierType default_mods
Definition: keybindings.h:88
GdkModifierType mods
Modifier keys, such as GDK_CONTROL_MASK or 0.
Definition: keybindings.h:77
guint key
Key value in lower-case, such as GDK_KEY_a or 0.
Definition: keybindings.h:76
GtkWidget * window
Main window.
Definition: ui_utils.h:80
GtkWidget * notebook
Document notebook.
Definition: ui_utils.h:83
GtkWidget * sidebar_notebook
Sidebar notebook.
Definition: ui_utils.h:82
General Preferences dialog settings.
Definition: prefs.h:30
gboolean confirm_exit
Definition: prefs.h:34
gboolean save_winpos
Definition: prefs.h:33
gboolean save_wingeom
Definition: prefs.h:41
gboolean auto_focus
Definition: prefs.h:38
gboolean suppress_status_messages
Definition: prefs.h:36
gboolean load_session
Definition: prefs.h:31
gboolean beep_on_errors
Definition: prefs.h:35
gboolean switch_to_status
Definition: prefs.h:37
gchar * initials
Initials.
Definition: templates.h:43
gchar * mail
Email.
Definition: templates.h:42
gchar * year_format
Definition: templates.h:45
gchar * company
Company.
Definition: templates.h:41
gchar * version
Initial version.
Definition: templates.h:44
gchar * datetime_format
Definition: templates.h:47
gchar * date_format
Definition: templates.h:46
gchar * developer
Name.
Definition: templates.h:40
Tools preferences.
Definition: prefs.h:50
gchar * grep_cmd
grep command
Definition: prefs.h:53
gchar * context_action_cmd
context action command
Definition: prefs.h:54
gchar * term_cmd
terminal emulator command
Definition: prefs.h:52
gchar * browser_cmd
web browser command
Definition: prefs.h:51
GtkToolbarStyle icon_style
Icon style.
Definition: toolbar.h:33
gboolean visible
Definition: toolbar.h:31
gboolean use_gtk_default_icon
Definition: toolbar.h:35
gboolean use_gtk_default_style
Definition: toolbar.h:34
gboolean append_to_menu
Definition: toolbar.h:36
GtkIconSize icon_size
Definition: toolbar.h:32
Definition: prefs.c:71
GtkTreeView * tree
Definition: prefs.c:73
gboolean edited
Definition: prefs.c:74
GtkTreeStore * store
Definition: prefs.c:72
gchar * external_print_cmd
Definition: printing.h:40
gboolean use_gtk_printing
Definition: printing.h:34
gboolean print_page_header
Definition: printing.h:37
gboolean page_header_basename
Definition: printing.h:38
gchar * page_header_datefmt
Definition: printing.h:39
gboolean print_page_numbers
Definition: printing.h:36
gboolean print_line_numbers
Definition: printing.h:35
GtkWidget * tree_openfiles
Definition: sidebar.h:34
GtkWidget * default_tag_tree
Definition: sidebar.h:35
Defines internationalization macros.
#define _(String)
Definition: support.h:42
GeanyTemplatePrefs template_prefs
Definition: templates.c:50
Templates (prefs).
void toolbar_show_hide(void)
Definition: toolbar.c:539
GeanyToolbarPrefs toolbar_prefs
Definition: toolbar.c:48
void toolbar_update_ui(void)
Definition: toolbar.c:414
void toolbar_apply_settings(void)
Definition: toolbar.c:577
Toolbar (prefs).
void tools_create_insert_custom_command_menu_items(void)
Definition: tools.c:581
void ui_update_statusbar(GeanyDocument *doc, gint pos)
Definition: ui_utils.c:324
void ui_widget_show_hide(GtkWidget *widget, gboolean show)
Definition: ui_utils.c:987
void ui_sidebar_show_hide(void)
Definition: ui_utils.c:1000
void ui_statusbar_showhide(gboolean state)
Definition: ui_utils.c:2046
gpointer ui_builder_get_object(const gchar *name)
Definition: ui_utils.c:2773
void ui_set_editor_font(const gchar *font_name)
Definition: ui_utils.c:413
gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc)
Definition: ui_utils.c:3203
void ui_save_buttons_toggle(gboolean enable)
Definition: ui_utils.c:830
GtkWidget * create_prefs_dialog(void)
Definition: ui_utils.c:2386
void ui_swap_sidebar_pos(void)
Definition: ui_utils.c:2241
GeanyMainWidgets main_widgets
Definition: ui_utils.c:72
void ui_entry_add_clear_icon(GtkEntry *entry)
Adds a small clear icon to the right end of the passed entry.
Definition: ui_utils.c:1604
void ui_document_show_hide(GeanyDocument *doc)
Definition: ui_utils.c:1029
gint ui_encodings_combo_box_get_active_encoding(GtkComboBox *combo)
Definition: ui_utils.c:3187
void ui_update_view_editor_menu_items(void)
Definition: ui_utils.c:1453
UIPrefs ui_prefs
Definition: ui_utils.c:74
void ui_update_fold_items(void)
Definition: ui_utils.c:562
GtkWidget * ui_image_menu_item_new(const gchar *stock_id, const gchar *label)
Creates a GtkImageMenuItem with a stock image and a custom label.
Definition: ui_utils.c:1574
GtkWidget * ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
Returns a widget from a name in a component, usually created by Glade.
Definition: ui_utils.c:2743
void ui_widget_modify_font_from_string(GtkWidget *widget, const gchar *str)
Modifies the font of a widget using gtk_widget_modify_font().
Definition: ui_utils.c:1894
void ui_setup_open_button_callback(GtkWidget *open_btn, const gchar *title, GtkFileChooserAction action, GtkEntry *entry)
Definition: ui_utils.c:1950
UIWidgets ui_widgets
Definition: ui_utils.c:75
GeanyInterfacePrefs interface_prefs
Definition: ui_utils.c:71
User Interface general utility functions.
void utils_open_browser(const gchar *uri)
Tries to open the given URI in a browser.
Definition: utils.c:75
gboolean utils_parse_color(const gchar *spec, GdkColor *color)
Definition: utils.c:976
gchar * utils_get_help_url(const gchar *suffix)
Definition: utils.c:1902
gboolean utils_str_equal(const gchar *a, const gchar *b)
NULL-safe string comparison.
Definition: utils.c:599
gchar * utils_get_hex_from_color(GdkColor *color)
Definition: utils.c:883
const gchar * utils_get_eol_name(gint eol_mode)
Definition: utils.c:371
General utility functions, non-GTK related.
#define foreach_ptr_array(item, idx, ptr_array)
Iterates all the pointers in ptr_array.
Definition: utils.h:108
#define foreach_c_array(item, array, len)
Iterates all the items in array using pointers.
Definition: utils.h:94
#define SETPTR(ptr, result)
Assigns result to ptr, then frees the old value.
Definition: utils.h:50