annotate src/options.c @ 1019:4aa1a6235458

Move save/load_options() to options.[ch].
author zas_
date Sun, 31 Aug 2008 09:13:42 +0000
parents 88ebc61e33ae
children 210c86b914ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
1 /*
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
2 * Geeqie
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
3 * Copyright (C) 2008 The Geeqie Team
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
4 *
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
5 * Authors: Vladimir Nadvornik, Laurent Monin
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
6 *
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
8 * Please read the included file COPYING for more information.
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
10 */
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
11
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
12 #include "main.h"
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
13 #include "options.h"
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
14
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
15 #include "bar_exif.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
16 #include "editors.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
17 #include "filefilter.h"
612
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
18 #include "histogram.h" /* HCHAN_RGB */
619
2ccc7d856d55 Initialize to correct value (OSD_SHOW_NOTHING instead of FALSE).
zas_
parents: 612
diff changeset
19 #include "image-overlay.h" /* OSD_SHOW_NOTHING */
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
20 #include "info.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
21 #include "layout.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
22 #include "layout_image.h"
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
23 #include "rcfile.h"
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
24 #include "ui_bookmark.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
25 #include "ui_fileops.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
26 #include "window.h"
612
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
27
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
28 ConfOptions *init_options(ConfOptions *options)
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
29 {
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
30 if (!options) options = g_new0(ConfOptions, 1);
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
31
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
32 options->collections.rectangular_selection = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
33
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
34 options->color_profile.enabled = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
35 options->color_profile.input_type = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
36 options->color_profile.screen_file = NULL;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
37 options->color_profile.screen_type = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
38 options->color_profile.use_image = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
39
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
40 options->dnd_icon_size = 48;
1013
88ebc61e33ae Allow to override documentation paths through options:
zas_
parents: 980
diff changeset
41 options->documentation.htmldir = NULL;
88ebc61e33ae Allow to override documentation paths through options:
zas_
parents: 980
diff changeset
42 options->documentation.helpdir = NULL;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
43 options->duplicates_similarity_threshold = 99;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
44 options->enable_metadata_dirs = FALSE;
594
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
45
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
46 options->file_filter.disable = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
47 options->file_filter.show_dot_directory = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
48 options->file_filter.show_hidden_files = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
49
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
50 options->file_ops.confirm_delete = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
51 options->file_ops.enable_delete_key = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
52 options->file_ops.enable_in_place_rename = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
53 options->file_ops.safe_delete_enable = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
54 options->file_ops.safe_delete_folder_maxsize = 128;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
55 options->file_ops.safe_delete_path = NULL;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
56
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
57 options->file_sort.ascending = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
58 options->file_sort.case_sensitive = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
59 options->file_sort.method = SORT_NAME;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
60
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
61 options->fullscreen.above = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
62 options->fullscreen.clean_flip = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
63 options->fullscreen.disable_saver = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
64 options->fullscreen.screen = -1;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
65
612
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
66 options->histogram.last_channel_mode = HCHAN_RGB;
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
67 options->histogram.last_log_mode = 1;
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
68
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
69 memset(&options->image.border_color, 0, sizeof(options->image.border_color));
870
3dd2cb78d0f9 Make better matching between options types in options.h and the rest of the code.
zas_
parents: 848
diff changeset
70 options->image.dither_quality = GDK_RGB_DITHER_NORMAL;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
71 options->image.enable_read_ahead = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
72 options->image.exif_rotate_enable = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
73 options->image.fit_window_to_image = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
74 options->image.idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
75 options->image.limit_autofit_size = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
76 options->image.limit_window_size = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
77 options->image.max_autofit_size = 100;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
78 options->image.max_window_size = 100;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
79 options->image.read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
80 options->image.scroll_reset_method = SCROLL_RESET_TOPLEFT;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
81 options->image.tile_cache_max = 10;
848
e1d158ac6d36 cache size made configurable
nadvornik
parents: 825
diff changeset
82 options->image.image_cache_max = 128; /* 4 x 10MPix */
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
83 options->image.use_custom_border_color = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
84 options->image.zoom_2pass = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
85 options->image.zoom_increment = 5;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
86 options->image.zoom_mode = ZOOM_RESET_ORIGINAL;
870
3dd2cb78d0f9 Make better matching between options types in options.h and the rest of the code.
zas_
parents: 848
diff changeset
87 options->image.zoom_quality = GDK_INTERP_BILINEAR;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
88 options->image.zoom_to_fit_allow_expand = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
89
870
3dd2cb78d0f9 Make better matching between options types in options.h and the rest of the code.
zas_
parents: 848
diff changeset
90 options->image_overlay.common.state = OSD_SHOW_NOTHING;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
91 options->image_overlay.common.show_at_startup = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
92 options->image_overlay.common.template_string = NULL;
822
df541dc41707 Allow to set image overlay info position through options:
zas_
parents: 768
diff changeset
93 options->image_overlay.common.x = 10;
df541dc41707 Allow to set image overlay info position through options:
zas_
parents: 768
diff changeset
94 options->image_overlay.common.y = -10;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
95
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
96 options->layout.dir_view_type = DIRVIEW_LIST;
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 508
diff changeset
97 options->layout.file_view_type = FILEVIEW_LIST;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
98 options->layout.float_window.h = 450;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
99 options->layout.float_window.vdivider_pos = -1;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
100 options->layout.float_window.w = 260;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
101 options->layout.float_window.x = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
102 options->layout.float_window.y = 0;
980
a4a38ea9fbaa Add an option named layout.home_path which modifies the behavior of the Home button.
zas_
parents: 870
diff changeset
103 options->layout.home_path = NULL;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
104 options->layout.main_window.h = 400;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
105 options->layout.main_window.hdivider_pos = -1;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
106 options->layout.main_window.maximized = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
107 options->layout.main_window.vdivider_pos = 200;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
108 options->layout.main_window.w = 500;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
109 options->layout.main_window.x = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
110 options->layout.main_window.y = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
111 options->layout.order = NULL;
764
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 740
diff changeset
112 options->layout.properties_window.w = DEF_PROPERTY_WIDTH;
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 740
diff changeset
113 options->layout.properties_window.h = DEF_PROPERTY_HEIGHT;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
114 options->layout.save_window_positions = FALSE;
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 822
diff changeset
115 options->layout.show_directory_date = FALSE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
116 options->layout.show_marks = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
117 options->layout.show_thumbnails = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
118 options->layout.style = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
119 options->layout.toolbar_hidden = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
120 options->layout.tools_float = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
121 options->layout.tools_hidden = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
122 options->layout.tools_restore_state = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
123
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
124 options->lazy_image_sync = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
125 options->mousewheel_scrolls = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
126 options->open_recent_list_maxsize = 10;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
127 options->place_dialogs_under_mouse = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
128
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
129 options->panels.exif.enabled = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
130 options->panels.exif.width = PANEL_DEFAULT_WIDTH;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
131 options->panels.info.enabled = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
132 options->panels.info.width = PANEL_DEFAULT_WIDTH;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
133 options->panels.sort.action_state = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
134 options->panels.sort.enabled = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
135 options->panels.sort.mode_state = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
136 options->panels.sort.selection_state = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
137
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
138 options->progressive_key_scrolling = FALSE;
594
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
139
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
140 options->save_metadata_in_image_file = FALSE;
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
141
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
142 options->show_copy_path = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
143 options->show_icon_names = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
144
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
145 options->slideshow.delay = 150;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
146 options->slideshow.random = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
147 options->slideshow.repeat = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
148
630
83d3ded39e49 An option to save and restore the last path used was added.
zas_
parents: 629
diff changeset
149 options->startup.path = NULL;
629
1fa2cb6d9d65 Rename options:
zas_
parents: 619
diff changeset
150 options->startup.restore_path = FALSE;
630
83d3ded39e49 An option to save and restore the last path used was added.
zas_
parents: 629
diff changeset
151 options->startup.use_last_path = FALSE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
152
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
153 options->thumbnails.cache_into_dirs = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
154 options->thumbnails.enable_caching = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
155 options->thumbnails.fast = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
156 options->thumbnails.max_height = DEFAULT_THUMB_HEIGHT;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
157 options->thumbnails.max_width = DEFAULT_THUMB_WIDTH;
870
3dd2cb78d0f9 Make better matching between options types in options.h and the rest of the code.
zas_
parents: 848
diff changeset
158 options->thumbnails.quality = GDK_INTERP_TILES;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
159 options->thumbnails.spec_standard = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
160 options->thumbnails.use_xvpics = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
161
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
162 options->tree_descend_subdirs = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
163 options->update_on_time_change = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
164
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
165 return options;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
166 }
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
167
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
168 void setup_default_options(ConfOptions *options)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
169 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
170 gchar *path;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
171 gint i;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
172
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
173 for (i = 0; i < GQ_EDITOR_SLOTS; i++)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
174 {
768
ff51413f098d Use functions to set editors name and command and ensure they are
zas_
parents: 764
diff changeset
175 editor_set_name(i, NULL);
ff51413f098d Use functions to set editors name and command and ensure they are
zas_
parents: 764
diff changeset
176 editor_set_command(i, NULL);
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
177 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
178
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
179 editor_reset_defaults();
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
180
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
181 bookmark_add_default(_("Home"), homedir());
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
182 path = g_build_filename(homedir(), "Desktop", NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
183 bookmark_add_default(_("Desktop"), path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
184 g_free(path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
185 path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
186 bookmark_add_default(_("Collections"), path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
187 g_free(path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
188
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
189 g_free(options->file_ops.safe_delete_path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
190 options->file_ops.safe_delete_path = g_build_filename(homedir(), GQ_RC_DIR_TRASH, NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
191
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
192 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
193 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
194 options->color_profile.input_file[i] = NULL;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
195 options->color_profile.input_name[i] = NULL;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
196 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
197
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
198 set_default_image_overlay_template_string(&options->image_overlay.common.template_string);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
199 sidecar_ext_add_defaults();
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
200 options->layout.order = g_strdup("123");
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
201 options->properties.tabs_order = g_strdup(info_tab_default_order());
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
202
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
203 options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
204 options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
1013
88ebc61e33ae Allow to override documentation paths through options:
zas_
parents: 980
diff changeset
205
88ebc61e33ae Allow to override documentation paths through options:
zas_
parents: 980
diff changeset
206 options->documentation.htmldir = g_strdup(GQ_HTMLDIR);
88ebc61e33ae Allow to override documentation paths through options:
zas_
parents: 980
diff changeset
207 options->documentation.helpdir = g_strdup(GQ_HELPDIR);
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
208
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
209 for (i = 0; ExifUIList[i].key; i++)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
210 ExifUIList[i].current = ExifUIList[i].default_value;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
211 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
212
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
213 static void sync_options_with_current_state(ConfOptions *options)
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
214 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
215 LayoutWindow *lw = NULL;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
216
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
217 if (layout_valid(&lw))
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
218 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
219 options->layout.main_window.maximized = window_maximized(lw->window);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
220 if (!options->layout.main_window.maximized)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
221 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
222 layout_geometry_get(NULL, &options->layout.main_window.x, &options->layout.main_window.y,
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
223 &options->layout.main_window.w, &options->layout.main_window.h);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
224 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
225
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
226 options->image_overlay.common.state = image_osd_get(lw->image);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
227 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
228
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
229 layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
230
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
231 layout_views_get(NULL, &options->layout.dir_view_type, &options->layout.file_view_type);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
232
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
233 options->layout.show_thumbnails = layout_thumb_get(NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
234 options->layout.show_marks = layout_marks_get(NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
235
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
236 layout_sort_get(NULL, &options->file_sort.method, &options->file_sort.ascending);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
237
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
238 layout_geometry_get_tools(NULL, &options->layout.float_window.x, &options->layout.float_window.y,
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
239 &options->layout.float_window.w, &options->layout.float_window.h, &options->layout.float_window.vdivider_pos);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
240 layout_tools_float_get(NULL, &options->layout.tools_float, &options->layout.tools_hidden);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
241 options->layout.toolbar_hidden = layout_toolbar_hidden(NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
242
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
243 options->color_profile.enabled = layout_image_color_profile_get_use(NULL);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
244 layout_image_color_profile_get(NULL,
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
245 &options->color_profile.input_type,
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
246 &options->color_profile.screen_type,
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
247 &options->color_profile.use_image);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
248
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
249 if (options->startup.restore_path && options->startup.use_last_path)
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
250 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
251 g_free(options->startup.path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
252 options->startup.path = g_strdup(layout_get_path(NULL));
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
253 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
254 }
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
255
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
256 void save_options(ConfOptions *options)
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
257 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
258 gchar *rc_path;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
259
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
260 sync_options_with_current_state(options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
261
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
262 rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
263 save_options_to(rc_path, options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
264 g_free(rc_path);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
265 }
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
266
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
267 void load_options(ConfOptions *options)
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
268 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
269 gboolean success;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
270 gchar *rc_path;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
271
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
272 if (isdir(GQ_SYSTEM_WIDE_DIR))
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
273 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
274 rc_path = g_build_filename(GQ_SYSTEM_WIDE_DIR, RC_FILE_NAME, NULL);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
275 success = load_options_from(rc_path, options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
276 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed");
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
277 g_free(rc_path);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
278 }
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
279
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
280 rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
281 success = load_options_from(rc_path, options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
282 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed");
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
283 g_free(rc_path);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
284 }