Bug Summary

File:lapiz/lapiz-prefs-manager-app.c
Warning:line 796, column 3
Value stored to 'def' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lapiz-prefs-manager-app.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/lapiz -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -I .. -I . -I ./smclient -I /usr/include/libxml2 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/local/include/ctksourceview-4 -I /usr/local/include/libbean-1.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/gobject-introspection-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -D DATADIR="/usr/share" -D LAPIZ_DATADIR="/usr/share/lapiz" -D LIBDIR="/usr/lib" -D PIC -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/lapiz -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-08-07-102128-33851-1 -x c lapiz-prefs-manager-app.c
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * lapiz-prefs-manager.c
4 * This file is part of lapiz
5 *
6 * Copyright (C) 2002-2005 Paolo Maggi
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24/*
25 * Modified by the lapiz Team, 2002-2003. See the AUTHORS file for a
26 * list of people on the lapiz Team.
27 * See the ChangeLog files for a list of changes.
28 *
29 * $Id$
30 */
31
32#ifdef HAVE_CONFIG_H1
33#include <config.h>
34#endif
35
36#include <string.h>
37
38#include <gio/gio.h>
39#include "lapiz-prefs-manager.h"
40#include "lapiz-prefs-manager-private.h"
41#include "lapiz-prefs-manager-app.h"
42#include "lapiz-app.h"
43#include "lapiz-debug.h"
44#include "lapiz-view.h"
45#include "lapiz-window.h"
46#include "lapiz-window-private.h"
47#include "lapiz-plugins-engine.h"
48#include "lapiz-style-scheme-manager.h"
49#include "lapiz-dirs.h"
50
51static void lapiz_prefs_manager_editor_font_changed (GSettings *settings,
52 gchar *key,
53 gpointer user_data);
54
55static void lapiz_prefs_manager_system_font_changed (GSettings *settings,
56 gchar *key,
57 gpointer user_data);
58
59static void lapiz_prefs_manager_tabs_size_changed (GSettings *settings,
60 gchar *key,
61 gpointer user_data);
62
63static void lapiz_prefs_manager_wrap_mode_changed (GSettings *settings,
64 gchar *key,
65 gpointer user_data);
66
67static void lapiz_prefs_manager_line_numbers_changed (GSettings *settings,
68 gchar *key,
69 gpointer user_data);
70
71static void lapiz_prefs_manager_auto_indent_changed (GSettings *settings,
72 gchar *key,
73 gpointer user_data);
74
75static void lapiz_prefs_manager_undo_changed (GSettings *settings,
76 gchar *key,
77 gpointer user_data);
78
79static void lapiz_prefs_manager_right_margin_changed (GSettings *settings,
80 gchar *key,
81 gpointer user_data);
82
83static void lapiz_prefs_manager_smart_home_end_changed (GSettings *settings,
84 gchar *key,
85 gpointer user_data);
86
87static void lapiz_prefs_manager_hl_current_line_changed (GSettings *settings,
88 gchar *key,
89 gpointer user_data);
90
91static void lapiz_prefs_manager_bracket_matching_changed(GSettings *settings,
92 gchar *key,
93 gpointer user_data);
94
95static void lapiz_prefs_manager_syntax_hl_enable_changed(GSettings *settings,
96 gchar *key,
97 gpointer user_data);
98
99static void lapiz_prefs_manager_search_hl_enable_changed(GSettings *settings,
100 gchar *key,
101 gpointer user_data);
102
103static void lapiz_prefs_manager_source_style_scheme_changed(GSettings *settings,
104 gchar *key,
105 gpointer user_data);
106
107static void lapiz_prefs_manager_max_recents_changed (GSettings *settings,
108 gchar *key,
109 gpointer user_data);
110
111static void lapiz_prefs_manager_auto_save_changed (GSettings *settings,
112 gchar *key,
113 gpointer user_data);
114
115static void lapiz_prefs_manager_lockdown_changed (GSettings *settings,
116 gchar *key,
117 gpointer user_data);
118
119static void lapiz_prefs_manager_draw_spaces_changed (GSettings *settings,
120 gchar *key,
121 gpointer user_data);
122
123static void lapiz_prefs_manager_draw_tabs_changed (GSettings *settings,
124 gchar *key,
125 gpointer user_data);
126
127static void lapiz_prefs_manager_draw_newlines_changed (GSettings *settings,
128 gchar *key,
129 gpointer user_data);
130
131static void lapiz_prefs_manager_draw_nbsp_changed (GSettings *settings,
132 gchar *key,
133 gpointer user_data);
134
135/* GUI state is serialized to a .desktop file, not in GSettings */
136
137#define LAPIZ_STATE_DEFAULT_WINDOW_STATE0 0
138#define LAPIZ_STATE_DEFAULT_WINDOW_WIDTH650 650
139#define LAPIZ_STATE_DEFAULT_WINDOW_HEIGHT500 500
140#define LAPIZ_STATE_DEFAULT_SIDE_PANEL_SIZE200 200
141#define LAPIZ_STATE_DEFAULT_BOTTOM_PANEL_SIZE140 140
142
143#define LAPIZ_STATE_FILE_LOCATION"lapiz.ini" "lapiz.ini"
144
145#define LAPIZ_STATE_WINDOW_GROUP"window" "window"
146#define LAPIZ_STATE_WINDOW_STATE"state" "state"
147#define LAPIZ_STATE_WINDOW_HEIGHT"height" "height"
148#define LAPIZ_STATE_WINDOW_WIDTH"width" "width"
149#define LAPIZ_STATE_SIDE_PANEL_SIZE"side_panel_size" "side_panel_size"
150#define LAPIZ_STATE_BOTTOM_PANEL_SIZE"bottom_panel_size" "bottom_panel_size"
151#define LAPIZ_STATE_SIDE_PANEL_ACTIVE_PAGE"side_panel_active_page" "side_panel_active_page"
152#define LAPIZ_STATE_BOTTOM_PANEL_ACTIVE_PAGE"bottom_panel_active_page" "bottom_panel_active_page"
153
154#define LAPIZ_STATE_FILEFILTER_GROUP"filefilter" "filefilter"
155#define LAPIZ_STATE_FILEFILTER_ID"id" "id"
156
157static gint window_state = -1;
158static gint window_height = -1;
159static gint window_width = -1;
160static gint side_panel_size = -1;
161static gint bottom_panel_size = -1;
162static gint side_panel_active_page = -1;
163static gint bottom_panel_active_page = -1;
164static gint active_file_filter = -1;
165
166
167static gchar *
168get_state_filename (void)
169{
170 gchar *config_dir;
171 gchar *filename = NULL((void*)0);
172
173 config_dir = lapiz_dirs_get_user_config_dir ();
174
175 if (config_dir != NULL((void*)0))
176 {
177 filename = g_build_filename (config_dir,
178 LAPIZ_STATE_FILE_LOCATION"lapiz.ini",
179 NULL((void*)0));
180 g_free (config_dir);
181 }
182
183 return filename;
184}
185
186static GKeyFile *
187get_lapiz_state_file (void)
188{
189 static GKeyFile *state_file = NULL((void*)0);
190
191 if (state_file == NULL((void*)0))
192 {
193 gchar *filename;
194 GError *err = NULL((void*)0);
195
196 state_file = g_key_file_new ();
197
198 filename = get_state_filename ();
199
200 if (!g_key_file_load_from_file (state_file,
201 filename,
202 G_KEY_FILE_NONE,
203 &err))
204 {
205 if (err->domain != G_FILE_ERRORg_file_error_quark () ||
206 err->code != G_FILE_ERROR_NOENT)
207 {
208 g_warning ("Could not load lapiz state file: %s\n",
209 err->message);
210 }
211
212 g_error_free (err);
213 }
214
215 g_free (filename);
216 }
217
218 return state_file;
219}
220
221static void
222lapiz_state_get_int (const gchar *group,
223 const gchar *key,
224 gint defval,
225 gint *result)
226{
227 GKeyFile *state_file;
228 gint res;
229 GError *err = NULL((void*)0);
230
231 state_file = get_lapiz_state_file ();
232 res = g_key_file_get_integer (state_file,
233 group,
234 key,
235 &err);
236
237 if (err != NULL((void*)0))
238 {
239 if ((err->domain != G_KEY_FILE_ERRORg_key_file_error_quark()) ||
240 ((err->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND &&
241 err->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND)))
242 {
243 g_warning ("Could not get state value %s::%s : %s\n",
244 group,
245 key,
246 err->message);
247 }
248
249 *result = defval;
250 g_error_free (err);
251 }
252 else
253 {
254 *result = res;
255 }
256}
257
258static void
259lapiz_state_set_int (const gchar *group,
260 const gchar *key,
261 gint value)
262{
263 GKeyFile *state_file;
264
265 state_file = get_lapiz_state_file ();
266 g_key_file_set_integer (state_file,
267 group,
268 key,
269 value);
270}
271
272static gboolean
273lapiz_state_file_sync (void)
274{
275 GKeyFile *state_file;
276 gchar *config_dir;
277 gchar *filename = NULL((void*)0);
278 gchar *content = NULL((void*)0);
279 gsize length;
280 gint res;
281 GError *err = NULL((void*)0);
282 gboolean ret = FALSE(0);
283
284 state_file = get_lapiz_state_file ();
285 g_return_val_if_fail (state_file != NULL, FALSE)do { if ((state_file != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "state_file != NULL"
); return ((0)); } } while (0)
;
286
287 config_dir = lapiz_dirs_get_user_config_dir ();
288 if (config_dir == NULL((void*)0))
289 {
290 g_warning ("Could not get config directory\n");
291 return ret;
292 }
293
294 res = g_mkdir_with_parents (config_dir, 0755);
295 if (res < 0)
296 {
297 g_warning ("Could not create config directory\n");
298 goto out;
299 }
300
301 content = g_key_file_to_data (state_file,
302 &length,
303 &err);
304
305 if (err != NULL((void*)0))
306 {
307 g_warning ("Could not get data from state file: %s\n",
308 err->message);
309 goto out;
310 }
311
312 if (content != NULL((void*)0))
313 {
314 filename = get_state_filename ();
315 if (!g_file_set_contents (filename,
316 content,
317 length,
318 &err))
319 {
320 g_warning ("Could not write lapiz state file: %s\n",
321 err->message);
322 goto out;
323 }
324 }
325
326 ret = TRUE(!(0));
327
328 out:
329 if (err != NULL((void*)0))
330 g_error_free (err);
331
332 g_free (config_dir);
333 g_free (filename);
334 g_free (content);
335
336 return ret;
337}
338
339/* Window state */
340gint
341lapiz_prefs_manager_get_window_state (void)
342{
343 if (window_state == -1)
344 {
345 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
346 LAPIZ_STATE_WINDOW_STATE"state",
347 LAPIZ_STATE_DEFAULT_WINDOW_STATE0,
348 &window_state);
349 }
350
351 return window_state;
352}
353
354void
355lapiz_prefs_manager_set_window_state (gint ws)
356{
357 g_return_if_fail (ws > -1)do { if ((ws > -1)) { } else { g_return_if_fail_warning ((
(gchar*) 0), ((const char*) (__func__)), "ws > -1"); return
; } } while (0)
;
358
359 window_state = ws;
360
361 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
362 LAPIZ_STATE_WINDOW_STATE"state",
363 ws);
364}
365
366gboolean
367lapiz_prefs_manager_window_state_can_set (void)
368{
369 return TRUE(!(0));
370}
371
372/* Window size */
373void
374lapiz_prefs_manager_get_window_size (gint *width, gint *height)
375{
376 g_return_if_fail (width != NULL && height != NULL)do { if ((width != ((void*)0) && height != ((void*)0)
)) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "width != NULL && height != NULL"
); return; } } while (0)
;
377
378 if (window_width == -1)
379 {
380 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
381 LAPIZ_STATE_WINDOW_WIDTH"width",
382 LAPIZ_STATE_DEFAULT_WINDOW_WIDTH650,
383 &window_width);
384 }
385
386 if (window_height == -1)
387 {
388 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
389 LAPIZ_STATE_WINDOW_HEIGHT"height",
390 LAPIZ_STATE_DEFAULT_WINDOW_HEIGHT500,
391 &window_height);
392 }
393
394 *width = window_width;
395 *height = window_height;
396}
397
398void
399lapiz_prefs_manager_get_default_window_size (gint *width, gint *height)
400{
401 g_return_if_fail (width != NULL && height != NULL)do { if ((width != ((void*)0) && height != ((void*)0)
)) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "width != NULL && height != NULL"
); return; } } while (0)
;
402
403 *width = LAPIZ_STATE_DEFAULT_WINDOW_WIDTH650;
404 *height = LAPIZ_STATE_DEFAULT_WINDOW_HEIGHT500;
405}
406
407void
408lapiz_prefs_manager_set_window_size (gint width, gint height)
409{
410 g_return_if_fail (width > -1 && height > -1)do { if ((width > -1 && height > -1)) { } else {
g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__
)), "width > -1 && height > -1"); return; } } while
(0)
;
411
412 window_width = width;
413 window_height = height;
414
415 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
416 LAPIZ_STATE_WINDOW_WIDTH"width",
417 width);
418 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
419 LAPIZ_STATE_WINDOW_HEIGHT"height",
420 height);
421}
422
423gboolean
424lapiz_prefs_manager_window_size_can_set (void)
425{
426 return TRUE(!(0));
427}
428
429/* Side panel */
430gint
431lapiz_prefs_manager_get_side_panel_size (void)
432{
433 if (side_panel_size == -1)
434 {
435 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
436 LAPIZ_STATE_SIDE_PANEL_SIZE"side_panel_size",
437 LAPIZ_STATE_DEFAULT_SIDE_PANEL_SIZE200,
438 &side_panel_size);
439 }
440
441 return side_panel_size;
442}
443
444gint
445lapiz_prefs_manager_get_default_side_panel_size (void)
446{
447 return LAPIZ_STATE_DEFAULT_SIDE_PANEL_SIZE200;
448}
449
450void
451lapiz_prefs_manager_set_side_panel_size (gint ps)
452{
453 g_return_if_fail (ps > -1)do { if ((ps > -1)) { } else { g_return_if_fail_warning ((
(gchar*) 0), ((const char*) (__func__)), "ps > -1"); return
; } } while (0)
;
454
455 if (side_panel_size == ps)
456 return;
457
458 side_panel_size = ps;
459 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
460 LAPIZ_STATE_SIDE_PANEL_SIZE"side_panel_size",
461 ps);
462}
463
464gboolean
465lapiz_prefs_manager_side_panel_size_can_set (void)
466{
467 return TRUE(!(0));
468}
469
470gint
471lapiz_prefs_manager_get_side_panel_active_page (void)
472{
473 if (side_panel_active_page == -1)
474 {
475 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
476 LAPIZ_STATE_SIDE_PANEL_ACTIVE_PAGE"side_panel_active_page",
477 0,
478 &side_panel_active_page);
479 }
480
481 return side_panel_active_page;
482}
483
484void
485lapiz_prefs_manager_set_side_panel_active_page (gint id)
486{
487 if (side_panel_active_page == id)
488 return;
489
490 side_panel_active_page = id;
491 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
492 LAPIZ_STATE_SIDE_PANEL_ACTIVE_PAGE"side_panel_active_page",
493 id);
494}
495
496gboolean
497lapiz_prefs_manager_side_panel_active_page_can_set (void)
498{
499 return TRUE(!(0));
500}
501
502/* Bottom panel */
503gint
504lapiz_prefs_manager_get_bottom_panel_size (void)
505{
506 if (bottom_panel_size == -1)
507 {
508 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
509 LAPIZ_STATE_BOTTOM_PANEL_SIZE"bottom_panel_size",
510 LAPIZ_STATE_DEFAULT_BOTTOM_PANEL_SIZE140,
511 &bottom_panel_size);
512 }
513
514 return bottom_panel_size;
515}
516
517gint
518lapiz_prefs_manager_get_default_bottom_panel_size (void)
519{
520 return LAPIZ_STATE_DEFAULT_BOTTOM_PANEL_SIZE140;
521}
522
523void
524lapiz_prefs_manager_set_bottom_panel_size (gint ps)
525{
526 g_return_if_fail (ps > -1)do { if ((ps > -1)) { } else { g_return_if_fail_warning ((
(gchar*) 0), ((const char*) (__func__)), "ps > -1"); return
; } } while (0)
;
527
528 if (bottom_panel_size == ps)
529 return;
530
531 bottom_panel_size = ps;
532 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
533 LAPIZ_STATE_BOTTOM_PANEL_SIZE"bottom_panel_size",
534 ps);
535}
536
537gboolean
538lapiz_prefs_manager_bottom_panel_size_can_set (void)
539{
540 return TRUE(!(0));
541}
542
543gint
544lapiz_prefs_manager_get_bottom_panel_active_page (void)
545{
546 if (bottom_panel_active_page == -1)
547 {
548 lapiz_state_get_int (LAPIZ_STATE_WINDOW_GROUP"window",
549 LAPIZ_STATE_BOTTOM_PANEL_ACTIVE_PAGE"bottom_panel_active_page",
550 0,
551 &bottom_panel_active_page);
552 }
553
554 return bottom_panel_active_page;
555}
556
557void
558lapiz_prefs_manager_set_bottom_panel_active_page (gint id)
559{
560 if (bottom_panel_active_page == id)
561 return;
562
563 bottom_panel_active_page = id;
564 lapiz_state_set_int (LAPIZ_STATE_WINDOW_GROUP"window",
565 LAPIZ_STATE_BOTTOM_PANEL_ACTIVE_PAGE"bottom_panel_active_page",
566 id);
567}
568
569gboolean
570lapiz_prefs_manager_bottom_panel_active_page_can_set (void)
571{
572 return TRUE(!(0));
573}
574
575/* File filter */
576gint
577lapiz_prefs_manager_get_active_file_filter (void)
578{
579 if (active_file_filter == -1)
580 {
581 lapiz_state_get_int (LAPIZ_STATE_FILEFILTER_GROUP"filefilter",
582 LAPIZ_STATE_FILEFILTER_ID"id",
583 0,
584 &active_file_filter);
585 }
586
587 return active_file_filter;
588}
589
590void
591lapiz_prefs_manager_set_active_file_filter (gint id)
592{
593 g_return_if_fail (id >= 0)do { if ((id >= 0)) { } else { g_return_if_fail_warning ((
(gchar*) 0), ((const char*) (__func__)), "id >= 0"); return
; } } while (0)
;
594
595 if (active_file_filter == id)
596 return;
597
598 active_file_filter = id;
599 lapiz_state_set_int (LAPIZ_STATE_FILEFILTER_GROUP"filefilter",
600 LAPIZ_STATE_FILEFILTER_ID"id",
601 id);
602}
603
604gboolean
605lapiz_prefs_manager_active_file_filter_can_set (void)
606{
607 return TRUE(!(0));
608}
609
610/* Normal prefs are stored in GSettings */
611
612gboolean
613lapiz_prefs_manager_app_init (void)
614{
615 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 615, ((const char
*) (__func__))
);
616
617 g_return_val_if_fail (lapiz_prefs_manager == NULL, FALSE)do { if ((lapiz_prefs_manager == ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "lapiz_prefs_manager == NULL"
); return ((0)); } } while (0)
;
618
619 lapiz_prefs_manager_init ();
620
621 if (lapiz_prefs_manager != NULL((void*)0))
622 {
623 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"use-default-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
624 "changed::" GPM_USE_DEFAULT_FONT,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"use-default-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
625 G_CALLBACK (lapiz_prefs_manager_editor_font_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"use-default-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
626 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"use-default-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
627
628 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"editor-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
629 "changed::" GPM_EDITOR_FONT,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"editor-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
630 G_CALLBACK (lapiz_prefs_manager_editor_font_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"editor-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
631 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"editor-font"), (((GCallback) (lapiz_prefs_manager_editor_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
632
633 g_signal_connect (lapiz_prefs_manager->interface_settings,g_signal_connect_data ((lapiz_prefs_manager->interface_settings
), ("changed::" "monospace-font-name"), (((GCallback) (lapiz_prefs_manager_system_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
634 "changed::" GPM_SYSTEM_FONT,g_signal_connect_data ((lapiz_prefs_manager->interface_settings
), ("changed::" "monospace-font-name"), (((GCallback) (lapiz_prefs_manager_system_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
635 G_CALLBACK (lapiz_prefs_manager_system_font_changed),g_signal_connect_data ((lapiz_prefs_manager->interface_settings
), ("changed::" "monospace-font-name"), (((GCallback) (lapiz_prefs_manager_system_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
636 NULL)g_signal_connect_data ((lapiz_prefs_manager->interface_settings
), ("changed::" "monospace-font-name"), (((GCallback) (lapiz_prefs_manager_system_font_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
637
638 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"tabs-size"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
639 "changed::" GPM_TABS_SIZE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"tabs-size"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
640 G_CALLBACK (lapiz_prefs_manager_tabs_size_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"tabs-size"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
641 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"tabs-size"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
642
643 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"insert-spaces"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
644 "changed::" GPM_INSERT_SPACES,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"insert-spaces"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
645 G_CALLBACK (lapiz_prefs_manager_tabs_size_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"insert-spaces"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
646 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"insert-spaces"), (((GCallback) (lapiz_prefs_manager_tabs_size_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
647
648 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"wrap-mode"), (((GCallback) (lapiz_prefs_manager_wrap_mode_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
649 "changed::" GPM_WRAP_MODE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"wrap-mode"), (((GCallback) (lapiz_prefs_manager_wrap_mode_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
650 G_CALLBACK (lapiz_prefs_manager_wrap_mode_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"wrap-mode"), (((GCallback) (lapiz_prefs_manager_wrap_mode_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
651 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"wrap-mode"), (((GCallback) (lapiz_prefs_manager_wrap_mode_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
652
653 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-line-numbers"), (((GCallback) (lapiz_prefs_manager_line_numbers_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
654 "changed::" GPM_DISPLAY_LINE_NUMBERS,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-line-numbers"), (((GCallback) (lapiz_prefs_manager_line_numbers_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
655 G_CALLBACK (lapiz_prefs_manager_line_numbers_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-line-numbers"), (((GCallback) (lapiz_prefs_manager_line_numbers_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
656 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-line-numbers"), (((GCallback) (lapiz_prefs_manager_line_numbers_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
657
658 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-indent"), (((GCallback) (lapiz_prefs_manager_auto_indent_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
659 "changed::" GPM_AUTO_INDENT,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-indent"), (((GCallback) (lapiz_prefs_manager_auto_indent_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
660 G_CALLBACK (lapiz_prefs_manager_auto_indent_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-indent"), (((GCallback) (lapiz_prefs_manager_auto_indent_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
661 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-indent"), (((GCallback) (lapiz_prefs_manager_auto_indent_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
662
663 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-undo-actions"), (((GCallback) (lapiz_prefs_manager_undo_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
664 "changed::" GPM_UNDO_ACTIONS_LIMIT,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-undo-actions"), (((GCallback) (lapiz_prefs_manager_undo_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
665 G_CALLBACK (lapiz_prefs_manager_undo_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-undo-actions"), (((GCallback) (lapiz_prefs_manager_undo_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
666 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-undo-actions"), (((GCallback) (lapiz_prefs_manager_undo_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
667
668 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-right-margin"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
669 "changed::" GPM_DISPLAY_RIGHT_MARGIN,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-right-margin"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
670 G_CALLBACK (lapiz_prefs_manager_right_margin_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-right-margin"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
671 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"display-right-margin"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
672
673 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"right-margin-position"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
674 "changed::" GPM_RIGHT_MARGIN_POSITION,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"right-margin-position"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
675 G_CALLBACK (lapiz_prefs_manager_right_margin_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"right-margin-position"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
676 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"right-margin-position"), (((GCallback) (lapiz_prefs_manager_right_margin_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
677
678 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"smart-home-end"), (((GCallback) (lapiz_prefs_manager_smart_home_end_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
679 "changed::" GPM_SMART_HOME_END,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"smart-home-end"), (((GCallback) (lapiz_prefs_manager_smart_home_end_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
680 G_CALLBACK (lapiz_prefs_manager_smart_home_end_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"smart-home-end"), (((GCallback) (lapiz_prefs_manager_smart_home_end_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
681 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"smart-home-end"), (((GCallback) (lapiz_prefs_manager_smart_home_end_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
682
683 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"highlight-current-line"), (((GCallback) (lapiz_prefs_manager_hl_current_line_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
684 "changed::" GPM_HIGHLIGHT_CURRENT_LINE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"highlight-current-line"), (((GCallback) (lapiz_prefs_manager_hl_current_line_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
685 G_CALLBACK (lapiz_prefs_manager_hl_current_line_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"highlight-current-line"), (((GCallback) (lapiz_prefs_manager_hl_current_line_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
686 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"highlight-current-line"), (((GCallback) (lapiz_prefs_manager_hl_current_line_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
687
688 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"bracket-matching"), (((GCallback) (lapiz_prefs_manager_bracket_matching_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
689 "changed::" GPM_BRACKET_MATCHING,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"bracket-matching"), (((GCallback) (lapiz_prefs_manager_bracket_matching_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
690 G_CALLBACK (lapiz_prefs_manager_bracket_matching_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"bracket-matching"), (((GCallback) (lapiz_prefs_manager_bracket_matching_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
691 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"bracket-matching"), (((GCallback) (lapiz_prefs_manager_bracket_matching_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
692
693 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-syntax-highlighting"), (((GCallback) (lapiz_prefs_manager_syntax_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
694 "changed::" GPM_SYNTAX_HL_ENABLE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-syntax-highlighting"), (((GCallback) (lapiz_prefs_manager_syntax_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
695 G_CALLBACK (lapiz_prefs_manager_syntax_hl_enable_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-syntax-highlighting"), (((GCallback) (lapiz_prefs_manager_syntax_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
696 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-syntax-highlighting"), (((GCallback) (lapiz_prefs_manager_syntax_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
697
698 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-search-highlighting"), (((GCallback) (lapiz_prefs_manager_search_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
699 "changed::" GPM_SEARCH_HIGHLIGHTING_ENABLE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-search-highlighting"), (((GCallback) (lapiz_prefs_manager_search_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
700 G_CALLBACK (lapiz_prefs_manager_search_hl_enable_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-search-highlighting"), (((GCallback) (lapiz_prefs_manager_search_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
701 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-search-highlighting"), (((GCallback) (lapiz_prefs_manager_search_hl_enable_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
702
703 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"color-scheme"), (((GCallback) (lapiz_prefs_manager_source_style_scheme_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
704 "changed::" GPM_SOURCE_STYLE_SCHEME,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"color-scheme"), (((GCallback) (lapiz_prefs_manager_source_style_scheme_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
705 G_CALLBACK (lapiz_prefs_manager_source_style_scheme_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"color-scheme"), (((GCallback) (lapiz_prefs_manager_source_style_scheme_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
706 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"color-scheme"), (((GCallback) (lapiz_prefs_manager_source_style_scheme_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
707
708 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-recents"), (((GCallback) (lapiz_prefs_manager_max_recents_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
709 "changed::" GPM_MAX_RECENTS,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-recents"), (((GCallback) (lapiz_prefs_manager_max_recents_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
710 G_CALLBACK (lapiz_prefs_manager_max_recents_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-recents"), (((GCallback) (lapiz_prefs_manager_max_recents_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
711 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"max-recents"), (((GCallback) (lapiz_prefs_manager_max_recents_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
712
713 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"create-backup-copy"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
714 "changed::" GPM_CREATE_BACKUP_COPY,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"create-backup-copy"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
715 G_CALLBACK (lapiz_prefs_manager_auto_save_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"create-backup-copy"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
716 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"create-backup-copy"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
717
718 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-save-interval"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
719 "changed::" GPM_AUTO_SAVE_INTERVAL,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-save-interval"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
720 G_CALLBACK (lapiz_prefs_manager_auto_save_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-save-interval"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
721 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"auto-save-interval"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
722
723 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"writable-vfs-schemes"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
724 "changed::" GPM_WRITABLE_VFS_SCHEMES,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"writable-vfs-schemes"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
725 G_CALLBACK (lapiz_prefs_manager_auto_save_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"writable-vfs-schemes"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
726 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"writable-vfs-schemes"), (((GCallback) (lapiz_prefs_manager_auto_save_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
727
728 g_signal_connect (lapiz_prefs_manager->lockdown_settings,g_signal_connect_data ((lapiz_prefs_manager->lockdown_settings
), ("changed"), (((GCallback) (lapiz_prefs_manager_lockdown_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
729 "changed",g_signal_connect_data ((lapiz_prefs_manager->lockdown_settings
), ("changed"), (((GCallback) (lapiz_prefs_manager_lockdown_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
730 G_CALLBACK (lapiz_prefs_manager_lockdown_changed),g_signal_connect_data ((lapiz_prefs_manager->lockdown_settings
), ("changed"), (((GCallback) (lapiz_prefs_manager_lockdown_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
731 NULL)g_signal_connect_data ((lapiz_prefs_manager->lockdown_settings
), ("changed"), (((GCallback) (lapiz_prefs_manager_lockdown_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
732
733 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-space"), (((GCallback) (lapiz_prefs_manager_draw_spaces_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
734 "changed::" GPM_SPACE_DRAWER_SPACE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-space"), (((GCallback) (lapiz_prefs_manager_draw_spaces_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
735 G_CALLBACK (lapiz_prefs_manager_draw_spaces_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-space"), (((GCallback) (lapiz_prefs_manager_draw_spaces_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
736 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-space"), (((GCallback) (lapiz_prefs_manager_draw_spaces_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
737
738 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-tab"), (((GCallback) (lapiz_prefs_manager_draw_tabs_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
739 "changed::" GPM_SPACE_DRAWER_TAB,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-tab"), (((GCallback) (lapiz_prefs_manager_draw_tabs_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
740 G_CALLBACK (lapiz_prefs_manager_draw_tabs_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-tab"), (((GCallback) (lapiz_prefs_manager_draw_tabs_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
741 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-tab"), (((GCallback) (lapiz_prefs_manager_draw_tabs_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
742
743 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-newline"), (((GCallback) (lapiz_prefs_manager_draw_newlines_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
744 "changed::" GPM_SPACE_DRAWER_NEWLINE,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-newline"), (((GCallback) (lapiz_prefs_manager_draw_newlines_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
745 G_CALLBACK (lapiz_prefs_manager_draw_newlines_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-newline"), (((GCallback) (lapiz_prefs_manager_draw_newlines_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
746 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-newline"), (((GCallback) (lapiz_prefs_manager_draw_newlines_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
747
748 g_signal_connect (lapiz_prefs_manager->settings,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-nbsp"), (((GCallback) (lapiz_prefs_manager_draw_nbsp_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
749 "changed::" GPM_SPACE_DRAWER_NBSP,g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-nbsp"), (((GCallback) (lapiz_prefs_manager_draw_nbsp_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
750 G_CALLBACK (lapiz_prefs_manager_draw_nbsp_changed),g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-nbsp"), (((GCallback) (lapiz_prefs_manager_draw_nbsp_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
751 NULL)g_signal_connect_data ((lapiz_prefs_manager->settings), ("changed::"
"enable-space-drawer-nbsp"), (((GCallback) (lapiz_prefs_manager_draw_nbsp_changed
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
752
753 }
754
755 return lapiz_prefs_manager != NULL((void*)0);
756}
757
758/* This function must be called before exiting lapiz */
759void
760lapiz_prefs_manager_app_shutdown (void)
761{
762 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 762, ((const char
*) (__func__))
);
763
764 lapiz_prefs_manager_shutdown ();
765
766 lapiz_state_file_sync ();
767}
768
769
770static void
771lapiz_prefs_manager_editor_font_changed (GSettings *settings,
772 gchar *key,
773 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
774{
775 GList *views;
776 GList *l;
777 gchar *font = NULL((void*)0);
778 gboolean def = TRUE(!(0));
779 gint ts;
780
781 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 781, ((const char
*) (__func__))
);
782
783 if (strcmp (key, GPM_USE_DEFAULT_FONT"use-default-font") == 0)
784 {
785 def = g_settings_get_boolean (settings, key);
786
787 if (def)
788 font = lapiz_prefs_manager_get_system_font ();
789 else
790 font = lapiz_prefs_manager_get_editor_font ();
791 }
792 else if (strcmp (key, GPM_EDITOR_FONT"editor-font") == 0)
793 {
794 font = g_settings_get_string (settings, key);
795
796 def = lapiz_prefs_manager_get_use_default_font ();
Value stored to 'def' is never read
797 }
798 else
799 return;
800
801 g_return_if_fail (font != NULL)do { if ((font != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "font != NULL"); return
; } } while (0)
;
802
803 ts = lapiz_prefs_manager_get_tabs_size ();
804
805 views = lapiz_app_get_views (lapiz_app_get_default ());
806 l = views;
807
808 while (l != NULL((void*)0))
809 {
810 /* Note: we use def=FALSE to avoid LapizView to query GSettings */
811 lapiz_view_set_font (LAPIZ_VIEW (l->data)((((LapizView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_view_get_type ()))))))
, FALSE(0), font);
812 ctk_source_view_set_tab_width (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
, ts);
813
814 l = l->next;
815 }
816
817 g_list_free (views);
818 g_free (font);
819}
820
821static void
822lapiz_prefs_manager_system_font_changed (GSettings *settings,
823 gchar *key,
824 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
825{
826 GList *views;
827 GList *l;
828 gchar *font;
829 gint ts;
830
831 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 831, ((const char
*) (__func__))
);
832
833 if (strcmp (key, GPM_SYSTEM_FONT"monospace-font-name") != 0)
834 return;
835
836 if (!lapiz_prefs_manager_get_use_default_font ())
837 return;
838
839 font = g_settings_get_string (settings, key);
840
841 ts = lapiz_prefs_manager_get_tabs_size ();
842
843 views = lapiz_app_get_views (lapiz_app_get_default ());
844 l = views;
845
846 while (l != NULL((void*)0))
847 {
848 /* Note: we use def=FALSE to avoid LapizView to query GSettings */
849 lapiz_view_set_font (LAPIZ_VIEW (l->data)((((LapizView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_view_get_type ()))))))
, FALSE(0), font);
850
851 ctk_source_view_set_tab_width (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
, ts);
852 l = l->next;
853 }
854
855 g_list_free (views);
856 g_free (font);
857}
858
859static void
860lapiz_prefs_manager_tabs_size_changed (GSettings *settings,
861 gchar *key,
862 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
863{
864 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 864, ((const char
*) (__func__))
);
865
866 if (strcmp (key, GPM_TABS_SIZE"tabs-size") == 0)
867 {
868 gint tab_width;
869 GList *views;
870 GList *l;
871
872 tab_width = g_settings_get_int (settings, key);
873
874 tab_width = CLAMP (tab_width, 1, 24)(((tab_width) > (24)) ? (24) : (((tab_width) < (1)) ? (
1) : (tab_width)))
;
875
876 views = lapiz_app_get_views (lapiz_app_get_default ());
877 l = views;
878
879 while (l != NULL((void*)0))
880 {
881 ctk_source_view_set_tab_width (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
882 tab_width);
883
884 l = l->next;
885 }
886
887 g_list_free (views);
888 }
889 else if (strcmp (key, GPM_INSERT_SPACES"insert-spaces") == 0)
890 {
891 gboolean enable;
892 GList *views;
893 GList *l;
894
895 enable = g_settings_get_boolean (settings, key);
896
897 views = lapiz_app_get_views (lapiz_app_get_default ());
898 l = views;
899
900 while (l != NULL((void*)0))
901 {
902 ctk_source_view_set_insert_spaces_instead_of_tabs (
903 CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
904 enable);
905
906 l = l->next;
907 }
908
909 g_list_free (views);
910 }
911}
912
913static CtkWrapMode
914get_wrap_mode_from_string (const gchar* str)
915{
916 CtkWrapMode res;
917
918 g_return_val_if_fail (str != NULL, CTK_WRAP_WORD)do { if ((str != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "str != NULL"); return
(CTK_WRAP_WORD); } } while (0)
;
919
920 if (strcmp (str, "CTK_WRAP_NONE") == 0)
921 res = CTK_WRAP_NONE;
922 else
923 {
924 if (strcmp (str, "CTK_WRAP_CHAR") == 0)
925 res = CTK_WRAP_CHAR;
926 else
927 res = CTK_WRAP_WORD;
928 }
929
930 return res;
931}
932
933static void
934lapiz_prefs_manager_wrap_mode_changed (GSettings *settings,
935 gchar *key,
936 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
937{
938 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 938, ((const char
*) (__func__))
);
939
940 if (strcmp (key, GPM_WRAP_MODE"wrap-mode") == 0)
941 {
942 CtkWrapMode wrap_mode;
943 GList *views;
944 GList *l;
945
946 wrap_mode = get_wrap_mode_from_string (g_settings_get_string(settings, key));
947
948 views = lapiz_app_get_views (lapiz_app_get_default ());
949 l = views;
950
951 while (l != NULL((void*)0))
952 {
953 ctk_text_view_set_wrap_mode (CTK_TEXT_VIEW (l->data)((((CtkTextView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_text_view_get_type ()))))))
,
954 wrap_mode);
955
956 l = l->next;
957 }
958
959 g_list_free (views);
960 }
961}
962
963static void
964lapiz_prefs_manager_line_numbers_changed (GSettings *settings,
965 gchar *key,
966 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
967{
968 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 968, ((const char
*) (__func__))
);
969
970 if (strcmp (key, GPM_DISPLAY_LINE_NUMBERS"display-line-numbers") == 0)
971 {
972 gboolean dln;
973 GList *views;
974 GList *l;
975
976 dln = g_settings_get_boolean (settings, key);
977
978 views = lapiz_app_get_views (lapiz_app_get_default ());
979 l = views;
980
981 while (l != NULL((void*)0))
982 {
983 ctk_source_view_set_show_line_numbers (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
984 dln);
985
986 l = l->next;
987 }
988
989 g_list_free (views);
990 }
991}
992
993static void
994lapiz_prefs_manager_hl_current_line_changed (GSettings *settings,
995 gchar *key,
996 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
997{
998 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 998, ((const char
*) (__func__))
);
999
1000 if (strcmp (key, GPM_HIGHLIGHT_CURRENT_LINE"highlight-current-line") == 0)
1001 {
1002 gboolean hl;
1003 GList *views;
1004 GList *l;
1005
1006 hl = g_settings_get_boolean (settings, key);
1007
1008 views = lapiz_app_get_views (lapiz_app_get_default ());
1009 l = views;
1010
1011 while (l != NULL((void*)0))
1012 {
1013 ctk_source_view_set_highlight_current_line (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1014 hl);
1015
1016 l = l->next;
1017 }
1018
1019 g_list_free (views);
1020 }
1021}
1022
1023static void
1024lapiz_prefs_manager_bracket_matching_changed (GSettings *settings,
1025 gchar *key,
1026 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1027{
1028 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1028, ((const
char*) (__func__))
);
1029
1030 if (strcmp (key, GPM_BRACKET_MATCHING"bracket-matching") == 0)
1031 {
1032 gboolean enable;
1033 GList *docs;
1034 GList *l;
1035
1036 enable = g_settings_get_boolean (settings, key);
1037
1038 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1039 l = docs;
1040
1041 while (l != NULL((void*)0))
1042 {
1043 ctk_source_buffer_set_highlight_matching_brackets (CTK_SOURCE_BUFFER (l->data)((((CtkSourceBuffer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_buffer_get_type ()))))))
,
1044 enable);
1045
1046 l = l->next;
1047 }
1048
1049 g_list_free (docs);
1050 }
1051}
1052
1053static void
1054lapiz_prefs_manager_auto_indent_changed (GSettings *settings,
1055 gchar *key,
1056 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1057{
1058 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1058, ((const
char*) (__func__))
);
1059
1060 if (strcmp (key, GPM_AUTO_INDENT"auto-indent") == 0)
1061 {
1062 gboolean enable;
1063 GList *views;
1064 GList *l;
1065
1066 enable = g_settings_get_boolean (settings, key);
1067
1068 views = lapiz_app_get_views (lapiz_app_get_default ());
1069 l = views;
1070
1071 while (l != NULL((void*)0))
1072 {
1073 ctk_source_view_set_auto_indent (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1074 enable);
1075
1076 l = l->next;
1077 }
1078
1079 g_list_free (views);
1080 }
1081}
1082
1083static void
1084lapiz_prefs_manager_undo_changed (GSettings *settings,
1085 gchar *key,
1086 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1087{
1088 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1088, ((const
char*) (__func__))
);
1089
1090 if (strcmp (key, GPM_UNDO_ACTIONS_LIMIT"max-undo-actions") == 0)
1091 {
1092 gint ul;
1093 GList *docs;
1094 GList *l;
1095
1096 ul = g_settings_get_int (settings, key);
1097
1098 ul = CLAMP (ul, -1, 250)(((ul) > (250)) ? (250) : (((ul) < (-1)) ? (-1) : (ul))
)
;
1099
1100 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1101 l = docs;
1102
1103 while (l != NULL((void*)0))
1104 {
1105 ctk_source_buffer_set_max_undo_levels (CTK_SOURCE_BUFFER (l->data)((((CtkSourceBuffer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_buffer_get_type ()))))))
,
1106 ul);
1107
1108 l = l->next;
1109 }
1110
1111 g_list_free (docs);
1112 }
1113}
1114
1115static void
1116lapiz_prefs_manager_right_margin_changed (GSettings *settings,
1117 gchar *key,
1118 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1119{
1120 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1120, ((const
char*) (__func__))
);
1121
1122 if (strcmp (key, GPM_RIGHT_MARGIN_POSITION"right-margin-position") == 0)
1123 {
1124 gint pos;
1125 GList *views;
1126 GList *l;
1127
1128 pos = g_settings_get_int (settings, key);
1129
1130 pos = CLAMP (pos, 1, 160)(((pos) > (160)) ? (160) : (((pos) < (1)) ? (1) : (pos)
))
;
1131
1132 views = lapiz_app_get_views (lapiz_app_get_default ());
1133 l = views;
1134
1135 while (l != NULL((void*)0))
1136 {
1137 ctk_source_view_set_right_margin_position (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1138 pos);
1139
1140 l = l->next;
1141 }
1142
1143 g_list_free (views);
1144 }
1145 else if (strcmp (key, GPM_DISPLAY_RIGHT_MARGIN"display-right-margin") == 0)
1146 {
1147 gboolean display;
1148 GList *views;
1149 GList *l;
1150
1151 display = g_settings_get_boolean (settings, key);
1152
1153 views = lapiz_app_get_views (lapiz_app_get_default ());
1154 l = views;
1155
1156 while (l != NULL((void*)0))
1157 {
1158 ctk_source_view_set_show_right_margin (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1159 display);
1160
1161 l = l->next;
1162 }
1163
1164 g_list_free (views);
1165 }
1166}
1167
1168static CtkSourceSmartHomeEndType
1169get_smart_home_end_from_string (const gchar *str)
1170{
1171 CtkSourceSmartHomeEndType res;
1172
1173 g_return_val_if_fail (str != NULL, CTK_SOURCE_SMART_HOME_END_AFTER)do { if ((str != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "str != NULL"); return
(CTK_SOURCE_SMART_HOME_END_AFTER); } } while (0)
;
1174
1175 if (strcmp (str, "DISABLED") == 0)
1176 res = CTK_SOURCE_SMART_HOME_END_DISABLED;
1177 else if (strcmp (str, "BEFORE") == 0)
1178 res = CTK_SOURCE_SMART_HOME_END_BEFORE;
1179 else if (strcmp (str, "ALWAYS") == 0)
1180 res = CTK_SOURCE_SMART_HOME_END_ALWAYS;
1181 else
1182 res = CTK_SOURCE_SMART_HOME_END_AFTER;
1183
1184 return res;
1185}
1186
1187static void
1188lapiz_prefs_manager_smart_home_end_changed (GSettings *settings,
1189 gchar *key,
1190 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1191{
1192 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1192, ((const
char*) (__func__))
);
1193
1194 if (strcmp (key, GPM_SMART_HOME_END"smart-home-end") == 0)
1195 {
1196 CtkSourceSmartHomeEndType smart_he;
1197 GList *views;
1198 GList *l;
1199
1200 smart_he = get_smart_home_end_from_string (g_settings_get_string (settings, key));
1201
1202 views = lapiz_app_get_views (lapiz_app_get_default ());
1203 l = views;
1204
1205 while (l != NULL((void*)0))
1206 {
1207 ctk_source_view_set_smart_home_end (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1208 smart_he);
1209
1210 l = l->next;
1211 }
1212
1213 g_list_free (views);
1214 }
1215}
1216
1217static void
1218lapiz_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
1219 gchar *key,
1220 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1221{
1222 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1222, ((const
char*) (__func__))
);
1223
1224 if (strcmp (key, GPM_SYNTAX_HL_ENABLE"enable-syntax-highlighting") == 0)
1225 {
1226 gboolean enable;
1227 GList *docs;
1228 GList *l;
1229 const GList *windows;
1230
1231 enable = g_settings_get_boolean (settings, key);
1232
1233 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1234 l = docs;
1235
1236 while (l != NULL((void*)0))
1237 {
1238 g_return_if_fail (CTK_SOURCE_IS_BUFFER (l->data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((l->data)); GType __t = ((ctk_source_buffer_get_type (
))); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0
), ((const char*) (__func__)), "CTK_SOURCE_IS_BUFFER (l->data)"
); return; } } while (0)
;
1239
1240 ctk_source_buffer_set_highlight_syntax (CTK_SOURCE_BUFFER (l->data)((((CtkSourceBuffer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_buffer_get_type ()))))))
,
1241 enable);
1242
1243 l = l->next;
1244 }
1245
1246 g_list_free (docs);
1247
1248 /* update the sensitivity of the Higlight Mode menu item */
1249 windows = lapiz_app_get_windows (lapiz_app_get_default ());
1250 while (windows != NULL((void*)0))
1251 {
1252 CtkUIManager *ui;
1253 CtkAction *a;
1254
1255 ui = lapiz_window_get_ui_manager (LAPIZ_WINDOW (windows->data)((((LapizWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((windows->data)), ((lapiz_window_get_type()))))))
);
1256
1257 a = ctk_ui_manager_get_action (ui,
1258 "/MenuBar/ViewMenu/ViewHighlightModeMenu");
1259
1260 ctk_action_set_sensitive (a, enable);
1261
1262 windows = g_list_next (windows)((windows) ? (((GList *)(windows))->next) : ((void*)0));
1263 }
1264 }
1265}
1266
1267static void
1268lapiz_prefs_manager_search_hl_enable_changed (GSettings *settings,
1269 gchar *key,
1270 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1271{
1272 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1272, ((const
char*) (__func__))
);
1273
1274 if (strcmp (key, GPM_SEARCH_HIGHLIGHTING_ENABLE"enable-search-highlighting") == 0)
1275 {
1276 gboolean enable;
1277 GList *docs;
1278 GList *l;
1279
1280 enable = g_settings_get_boolean (settings, key);
1281
1282 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1283 l = docs;
1284
1285 while (l != NULL((void*)0))
1286 {
1287 g_return_if_fail (LAPIZ_IS_DOCUMENT (l->data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((l->data)); GType __t = ((lapiz_document_get_type()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
)))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "LAPIZ_IS_DOCUMENT (l->data)"); return
; } } while (0)
;
1288
1289 lapiz_document_set_enable_search_highlighting (LAPIZ_DOCUMENT (l->data)((((LapizDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_document_get_type()))))))
,
1290 enable);
1291
1292 l = l->next;
1293 }
1294
1295 g_list_free (docs);
1296 }
1297}
1298
1299static void
1300lapiz_prefs_manager_source_style_scheme_changed (GSettings *settings,
1301 gchar *key,
1302 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1303{
1304 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1304, ((const
char*) (__func__))
);
1305
1306 if (strcmp (key, GPM_SOURCE_STYLE_SCHEME"color-scheme") == 0)
1307 {
1308 static gchar *old_scheme = NULL((void*)0);
1309 gchar *scheme;
1310 CtkSourceStyleScheme *style;
1311 GList *docs;
1312 GList *l;
1313
1314 scheme = g_settings_get_string (settings, key);
1315
1316 if (old_scheme != NULL((void*)0) && (strcmp (scheme, old_scheme) == 0))
1317 return;
1318
1319 g_free (old_scheme);
1320 old_scheme = scheme;
1321
1322 style = ctk_source_style_scheme_manager_get_scheme (
1323 lapiz_get_style_scheme_manager (),
1324 scheme);
1325
1326 if (style == NULL((void*)0))
1327 {
1328 g_warning ("Default style scheme '%s' not found, falling back to 'classic'", scheme);
1329
1330 style = ctk_source_style_scheme_manager_get_scheme (
1331 lapiz_get_style_scheme_manager (),
1332 "classic");
1333
1334 if (style == NULL((void*)0))
1335 {
1336 g_warning ("Style scheme 'classic' cannot be found, check your CtkSourceView installation.");
1337 return;
1338 }
1339 }
1340
1341 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1342 for (l = docs; l != NULL((void*)0); l = l->next)
1343 {
1344 g_return_if_fail (CTK_SOURCE_IS_BUFFER (l->data))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((l->data)); GType __t = ((ctk_source_buffer_get_type (
))); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0
), ((const char*) (__func__)), "CTK_SOURCE_IS_BUFFER (l->data)"
); return; } } while (0)
;
1345
1346 ctk_source_buffer_set_style_scheme (CTK_SOURCE_BUFFER (l->data)((((CtkSourceBuffer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_buffer_get_type ()))))))
,
1347 style);
1348 }
1349
1350 g_list_free (docs);
1351 }
1352}
1353
1354static void
1355lapiz_prefs_manager_max_recents_changed (GSettings *settings,
1356 gchar *key,
1357 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1358{
1359 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1359, ((const
char*) (__func__))
);
1360
1361 if (strcmp (key, GPM_MAX_RECENTS"max-recents") == 0)
1362 {
1363 const GList *windows;
1364 gint max;
1365
1366 max = g_settings_get_int (settings, key);
1367
1368 if (max < 0) {
1369 max = GPM_DEFAULT_MAX_RECENTS5;
1370 }
1371
1372 windows = lapiz_app_get_windows (lapiz_app_get_default ());
1373 while (windows != NULL((void*)0))
1374 {
1375 LapizWindow *w = windows->data;
1376
1377 ctk_recent_chooser_set_limit (CTK_RECENT_CHOOSER (w->priv->toolbar_recent_menu)((((CtkRecentChooser*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((w->priv->toolbar_recent_menu)), ((ctk_recent_chooser_get_type
()))))))
,
1378 max);
1379
1380 windows = g_list_next (windows)((windows) ? (((GList *)(windows))->next) : ((void*)0));
1381 }
1382
1383 /* FIXME: we have no way at the moment to trigger the
1384 * update of the inline recents in the File menu */
1385 }
1386}
1387
1388static void
1389lapiz_prefs_manager_auto_save_changed (GSettings *settings,
1390 gchar *key,
1391 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1392{
1393 GList *docs;
1394 GList *l;
1395
1396 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1396, ((const
char*) (__func__))
);
1397
1398 if (strcmp (key, GPM_AUTO_SAVE"auto-save") == 0)
1399 {
1400 gboolean auto_save;
1401
1402 auto_save = g_settings_get_boolean (settings, key);
1403
1404 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1405 l = docs;
1406
1407 while (l != NULL((void*)0))
1408 {
1409 LapizDocument *doc = LAPIZ_DOCUMENT (l->data)((((LapizDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_document_get_type()))))))
;
1410 LapizTab *tab = lapiz_tab_get_from_document (doc);
1411
1412 lapiz_tab_set_auto_save_enabled (tab, auto_save);
1413
1414 l = l->next;
1415 }
1416
1417 g_list_free (docs);
1418 }
1419 else if (strcmp (key, GPM_AUTO_SAVE_INTERVAL"auto-save-interval") == 0)
1420 {
1421 gint auto_save_interval;
1422
1423 auto_save_interval = g_settings_get_int (settings, key);
1424
1425 if (auto_save_interval <= 0)
1426 auto_save_interval = GPM_DEFAULT_AUTO_SAVE_INTERVAL10;
1427
1428 docs = lapiz_app_get_documents (lapiz_app_get_default ());
1429 l = docs;
1430
1431 while (l != NULL((void*)0))
1432 {
1433 LapizDocument *doc = LAPIZ_DOCUMENT (l->data)((((LapizDocument*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_document_get_type()))))))
;
1434 LapizTab *tab = lapiz_tab_get_from_document (doc);
1435
1436 lapiz_tab_set_auto_save_interval (tab, auto_save_interval);
1437
1438 l = l->next;
1439 }
1440
1441 g_list_free (docs);
1442 }
1443}
1444
1445static void
1446lapiz_prefs_manager_lockdown_changed (GSettings *settings,
1447 gchar *key,
1448 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1449{
1450 LapizApp *app;
1451 gboolean locked;
1452
1453 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1453, ((const
char*) (__func__))
);
1454
1455 locked = g_settings_get_boolean (settings, key);
1456
1457 app = lapiz_app_get_default ();
1458
1459 if (strcmp (key, GPM_LOCKDOWN_COMMAND_LINE"disable-command-line") == 0)
1460 _lapiz_app_set_lockdown_bit (app,
1461 LAPIZ_LOCKDOWN_COMMAND_LINE,
1462 locked);
1463
1464 else if (strcmp (key, GPM_LOCKDOWN_PRINTING"disable-printing") == 0)
1465 _lapiz_app_set_lockdown_bit (app,
1466 LAPIZ_LOCKDOWN_PRINTING,
1467 locked);
1468
1469 else if (strcmp (key, GPM_LOCKDOWN_PRINT_SETUP"disable-print-setup") == 0)
1470 _lapiz_app_set_lockdown_bit (app,
1471 LAPIZ_LOCKDOWN_PRINT_SETUP,
1472 locked);
1473
1474 else if (strcmp (key, GPM_LOCKDOWN_SAVE_TO_DISK"disable-save-to-disk") == 0)
1475 _lapiz_app_set_lockdown_bit (app,
1476 LAPIZ_LOCKDOWN_SAVE_TO_DISK,
1477 locked);
1478}
1479
1480#ifdef CTK_SOURCE_VERSION_3_24(((3) << 16 | (24) << 8))
1481static void
1482lapiz_prefs_manager_space_drawer_generic (GSettings *settings G_GNUC_UNUSED__attribute__ ((__unused__)),
1483 gint level,
1484 CtkSourceSpaceTypeFlags type)
1485{
1486
1487 GList *views;
1488 GList *l;
1489
1490 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1490, ((const
char*) (__func__))
);
1491
1492 views = lapiz_app_get_views (lapiz_app_get_default ());
1493 l = views;
1494
1495 while (l != NULL((void*)0))
1496 {
1497 lapiz_set_source_space_drawer_by_level (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1498 level, type);
1499 l = l->next;
1500 }
1501
1502 g_list_free (views);
1503}
1504#else
1505static void
1506lapiz_prefs_manager_draw_generic (GSettings *settings,
1507 gint level,
1508 CtkSourceDrawSpacesFlags type)
1509{
1510
1511 GList *views;
1512 GList *l;
1513
1514 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1514, ((const
char*) (__func__))
);
1515
1516 views = lapiz_app_get_views (lapiz_app_get_default ());
1517 l = views;
1518
1519 while (l != NULL((void*)0))
1520 {
1521 CtkSourceDrawSpacesFlags value;
1522
1523 value = ctk_source_view_get_draw_spaces (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
);
1524 if (level > 0)
1525 value |= type;
1526 else
1527 value &= ~type;
1528 ctk_source_view_set_draw_spaces (CTK_SOURCE_VIEW (l->data)((((CtkSourceView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((ctk_source_view_get_type ()))))))
,
1529 value);
1530 l = l->next;
1531 }
1532
1533 g_list_free (views);
1534}
1535#endif
1536
1537static void
1538lapiz_prefs_manager_draw_spaces_changed (GSettings *settings,
1539 gchar *key,
1540 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1541{
1542 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1542, ((const
char*) (__func__))
);
1543
1544 if (strcmp (key, GPM_SPACE_DRAWER_SPACE"enable-space-drawer-space"))
1545 return;
1546
1547#ifdef CTK_SOURCE_VERSION_3_24(((3) << 16 | (24) << 8))
1548 lapiz_prefs_manager_space_drawer_generic (settings,
1549 g_settings_get_enum (settings, key),
1550 CTK_SOURCE_SPACE_TYPE_SPACE);
1551#else
1552 lapiz_prefs_manager_draw_generic (settings,
1553 g_settings_get_enum (settings, key),
1554 CTK_SOURCE_DRAW_SPACES_SPACE);
1555#endif
1556}
1557
1558static void
1559lapiz_prefs_manager_draw_tabs_changed (GSettings *settings,
1560 gchar *key,
1561 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1562{
1563 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1563, ((const
char*) (__func__))
);
1564
1565 if (strcmp (key, GPM_SPACE_DRAWER_TAB"enable-space-drawer-tab"))
1566 return;
1567
1568#ifdef CTK_SOURCE_VERSION_3_24(((3) << 16 | (24) << 8))
1569 lapiz_prefs_manager_space_drawer_generic (settings,
1570 g_settings_get_enum (settings, key),
1571 CTK_SOURCE_SPACE_TYPE_TAB);
1572#else
1573 lapiz_prefs_manager_draw_generic (settings,
1574 g_settings_get_enum (settings, key),
1575 CTK_SOURCE_DRAW_SPACES_TAB);
1576#endif
1577}
1578
1579static void
1580lapiz_prefs_manager_draw_newlines_changed (GSettings *settings,
1581 gchar *key,
1582 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1583{
1584 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1584, ((const
char*) (__func__))
);
1585
1586 if (strcmp (key, GPM_SPACE_DRAWER_NEWLINE"enable-space-drawer-newline"))
1587 return;
1588
1589#ifdef CTK_SOURCE_VERSION_3_24(((3) << 16 | (24) << 8))
1590 lapiz_prefs_manager_space_drawer_generic (settings,
1591 g_settings_get_boolean (settings, key) ? 1 : 0,
1592 CTK_SOURCE_SPACE_TYPE_NEWLINE);
1593#else
1594 lapiz_prefs_manager_draw_generic (settings,
1595 g_settings_get_boolean (settings, key) ? 1 : 0,
1596 CTK_SOURCE_DRAW_SPACES_NEWLINE);
1597#endif
1598}
1599
1600static void
1601lapiz_prefs_manager_draw_nbsp_changed (GSettings *settings,
1602 gchar *key,
1603 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
1604{
1605 lapiz_debug (DEBUG_PREFSLAPIZ_DEBUG_PREFS, "lapiz-prefs-manager-app.c", 1605, ((const
char*) (__func__))
);
1606
1607 if (strcmp (key, GPM_SPACE_DRAWER_NBSP"enable-space-drawer-nbsp"))
1608 return;
1609
1610#ifdef CTK_SOURCE_VERSION_3_24(((3) << 16 | (24) << 8))
1611 lapiz_prefs_manager_space_drawer_generic (settings,
1612 g_settings_get_enum (settings, key),
1613 CTK_SOURCE_SPACE_TYPE_NBSP);
1614#else
1615 lapiz_prefs_manager_draw_generic (settings,
1616 g_settings_get_enum (settings, key),
1617 CTK_SOURCE_DRAW_SPACES_NBSP);
1618#endif
1619}