annotate src/options.c @ 1436:d7a6fb7a90dd

completely separated global and layout window options layout window configuration is available under separate menu entry
author nadvornik
date Sat, 14 Mar 2009 23:26:42 +0000
parents df58e511d90e
children 6e020d3ab168
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
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1272
diff changeset
3 * Copyright (C) 2008 - 2009 The Geeqie Team
508
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 "layout.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
21 #include "layout_image.h"
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
22 #include "rcfile.h"
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
23 #include "ui_bookmark.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
24 #include "ui_fileops.h"
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
25 #include "window.h"
612
21864cc96369 Preserve last histogram modes.
zas_
parents: 594
diff changeset
26
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
27 ConfOptions *init_options(ConfOptions *options)
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
28 {
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
29 if (!options) options = g_new0(ConfOptions, 1);
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
30
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
31 options->collections.rectangular_selection = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
32
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
33 options->color_profile.enabled = TRUE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
34 options->color_profile.input_type = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
35 options->color_profile.screen_file = NULL;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
36 options->color_profile.screen_type = 0;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
37 options->color_profile.use_image = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
38
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
39 options->dnd_icon_size = 48;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
40 options->duplicates_similarity_threshold = 99;
594
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
41
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
42 options->file_filter.disable = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
43 options->file_filter.show_dot_directory = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
44 options->file_filter.show_hidden_files = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
45
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
46 options->save_window_positions = TRUE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
47 options->tools_restore_state = TRUE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
48
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
49 options->file_ops.confirm_delete = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
50 options->file_ops.enable_delete_key = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
51 options->file_ops.enable_in_place_rename = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
52 options->file_ops.safe_delete_enable = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
53 options->file_ops.safe_delete_folder_maxsize = 128;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
54 options->file_ops.safe_delete_path = NULL;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
55
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
56 options->file_sort.ascending = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
57 options->file_sort.case_sensitive = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
58 options->file_sort.method = SORT_NAME;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
59
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
60 options->fullscreen.above = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
61 options->fullscreen.clean_flip = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
62 options->fullscreen.disable_saver = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
63 options->fullscreen.screen = -1;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
64
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
65 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
66 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
67 options->image.enable_read_ahead = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
68 options->image.exif_rotate_enable = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
69 options->image.fit_window_to_image = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
70 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
71 options->image.limit_autofit_size = FALSE;
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
72 options->image.limit_window_size = TRUE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
73 options->image.max_autofit_size = 100;
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
74 options->image.max_window_size = 90;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
75 options->image.read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1034
diff changeset
76 options->image.scroll_reset_method = SCROLL_RESET_NOCHANGE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
77 options->image.tile_cache_max = 10;
848
e1d158ac6d36 cache size made configurable
nadvornik
parents: 825
diff changeset
78 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
79 options->image.use_custom_border_color = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
80 options->image.zoom_2pass = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
81 options->image.zoom_increment = 5;
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
82 options->image.zoom_mode = ZOOM_RESET_NONE;
870
3dd2cb78d0f9 Make better matching between options types in options.h and the rest of the code.
zas_
parents: 848
diff changeset
83 options->image.zoom_quality = GDK_INTERP_BILINEAR;
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
84 options->image.zoom_to_fit_allow_expand = FALSE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
85
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1329
diff changeset
86 options->image_overlay.template_string = NULL;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1329
diff changeset
87 options->image_overlay.x = 10;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1329
diff changeset
88 options->image_overlay.y = -10;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
89
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
90 options->lazy_image_sync = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
91 options->mousewheel_scrolls = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
92 options->open_recent_list_maxsize = 10;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
93 options->place_dialogs_under_mouse = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
94
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
95 options->progressive_key_scrolling = TRUE;
594
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
96
1208
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
97 options->metadata.enable_metadata_dirs = FALSE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
98 options->metadata.save_in_image_file = FALSE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
99 options->metadata.save_legacy_IPTC = FALSE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
100 options->metadata.warn_on_write_problems = TRUE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
101 options->metadata.save_legacy_format = FALSE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
102 options->metadata.sync_grouped_files = TRUE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
103 options->metadata.confirm_write = TRUE;
1244
b2d98b7c26c1 improved metadata preferences
nadvornik
parents: 1229
diff changeset
104 options->metadata.confirm_after_timeout = FALSE;
b2d98b7c26c1 improved metadata preferences
nadvornik
parents: 1229
diff changeset
105 options->metadata.confirm_timeout = 10;
1208
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
106 options->metadata.confirm_on_image_change = FALSE;
c45cc5cf3c4d added options for metadata - not yet used
nadvornik
parents: 1145
diff changeset
107 options->metadata.confirm_on_dir_change = TRUE;
594
4cfce4ed35e0 Use a dedicated option to enable keywords and comment saving as XMP tags
zas_
parents: 556
diff changeset
108
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
109 options->show_copy_path = TRUE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
110 options->show_icon_names = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
111
1034
210c86b914ce adjusted default options
nadvornik
parents: 1019
diff changeset
112 options->slideshow.delay = 50;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
113 options->slideshow.random = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
114 options->slideshow.repeat = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
115
630
83d3ded39e49 An option to save and restore the last path used was added.
zas_
parents: 629
diff changeset
116 options->startup.path = NULL;
629
1fa2cb6d9d65 Rename options:
zas_
parents: 619
diff changeset
117 options->startup.restore_path = FALSE;
630
83d3ded39e49 An option to save and restore the last path used was added.
zas_
parents: 629
diff changeset
118 options->startup.use_last_path = FALSE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
119
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
120 options->thumbnails.cache_into_dirs = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
121 options->thumbnails.enable_caching = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
122 options->thumbnails.fast = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
123 options->thumbnails.max_height = DEFAULT_THUMB_HEIGHT;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
124 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
125 options->thumbnails.quality = GDK_INTERP_TILES;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
126 options->thumbnails.spec_standard = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
127 options->thumbnails.use_xvpics = TRUE;
1060
1e2de04c6fc4 added option to use exif thumbnails
nadvornik
parents: 1055
diff changeset
128 options->thumbnails.use_exif = FALSE;
508
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
129
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
130 options->tree_descend_subdirs = FALSE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
131 options->update_on_time_change = TRUE;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
132
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
133 return options;
011a6be611c8 Move options stuff to options.{c,h} and remove globals.c
zas_
parents:
diff changeset
134 }
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
135
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
136 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
137 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
138 gchar *path;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
139 gint i;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
140
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
141 bookmark_add_default(_("Home"), homedir());
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
142 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
143 bookmark_add_default(_("Desktop"), path);
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
144 g_free(path);
1145
3a7af6a8cd5f Use functions to return directories instead of constants.
zas_
parents: 1060
diff changeset
145 bookmark_add_default(_("Collections"), get_collections_dir());
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
146
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
147 g_free(options->file_ops.safe_delete_path);
1145
3a7af6a8cd5f Use functions to return directories instead of constants.
zas_
parents: 1060
diff changeset
148 options->file_ops.safe_delete_path = g_strdup(get_trash_dir());
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
149
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
150 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
151 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
152 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
153 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
154 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
155
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1329
diff changeset
156 set_default_image_overlay_template_string(&options->image_overlay.template_string);
1229
878718372aca sidecar files grouping was made case-insensitive
nadvornik
parents: 1208
diff changeset
157 options->sidecar.ext = g_strdup(".jpg;%raw;.xmp");
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
158
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
159 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
160 options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1336
diff changeset
161
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1336
diff changeset
162 #if 0
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
163 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
164 ExifUIList[i].current = ExifUIList[i].default_value;
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1336
diff changeset
165 #endif
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
166 }
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
167
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
168 void copy_layout_options(LayoutOptions *dest, const LayoutOptions *src)
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
169 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
170 free_layout_options_content(dest);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
171
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
172 *dest = *src;
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
173 dest->order = g_strdup(src->order);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
174 dest->home_path = g_strdup(src->home_path);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
175 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
176
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
177 void free_layout_options_content(LayoutOptions *dest)
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
178 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
179 if (dest->order) g_free(dest->order);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
180 if (dest->home_path) g_free(dest->home_path);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
181 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
182
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
183 LayoutOptions *init_layout_options(LayoutOptions *options)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
184 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
185 memset(options, 0, sizeof(LayoutOptions));
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
186
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
187 options->dir_view_type = DIRVIEW_LIST;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
188 options->file_view_type = FILEVIEW_LIST;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
189 options->float_window.h = 450;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
190 options->float_window.vdivider_pos = -1;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
191 options->float_window.w = 260;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
192 options->float_window.x = 0;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
193 options->float_window.y = 0;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
194 options->home_path = NULL;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
195 options->main_window.h = 540;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
196 options->main_window.hdivider_pos = -1;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
197 options->main_window.maximized = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
198 options->main_window.vdivider_pos = 200;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
199 options->main_window.w = 720;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
200 options->main_window.x = 0;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
201 options->main_window.y = 0;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
202 options->order = g_strdup("123");
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
203 options->show_directory_date = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
204 options->show_marks = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
205 options->show_thumbnails = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
206 options->style = 0;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
207 options->info_pixel_hidden = TRUE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
208 options->toolbar_hidden = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
209 options->tools_float = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
210 options->tools_hidden = FALSE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
211 options->image_overlay.histogram_channel = HCHAN_RGB;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
212 options->image_overlay.histogram_mode = 1;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
213 options->image_overlay.state = OSD_SHOW_NOTHING;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
214 return options;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
215 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1375
diff changeset
216
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
217 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
218 {
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
219 LayoutWindow *lw = NULL;
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
220
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
221 if (layout_valid(&lw))
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
222 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
223 layout_sync_options_with_current_state(lw);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
224 layout_sort_get(lw, &options->file_sort.method, &options->file_sort.ascending);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
225
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
226 options->color_profile.enabled = layout_image_color_profile_get_use(lw);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
227 layout_image_color_profile_get(lw,
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
228 &options->color_profile.input_type,
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
229 &options->color_profile.screen_type,
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
230 &options->color_profile.use_image);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
231
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
232 if (options->startup.restore_path && options->startup.use_last_path)
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
233 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
234 g_free(options->startup.path);
55ea4962887a config file format changed to XML
nadvornik
parents: 1292
diff changeset
235 options->startup.path = g_strdup(layout_get_path(lw));
740
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
236 }
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
9b0ac8d58c89 Move setup_default_options() and sync_options_with_current_state() to options.[ch].
zas_
parents: 638
diff changeset
239 }
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
240
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
241 void save_options(ConfOptions *options)
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
242 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
243 gchar *rc_path;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
244
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
245 sync_options_with_current_state(options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
246
1145
3a7af6a8cd5f Use functions to return directories instead of constants.
zas_
parents: 1060
diff changeset
247 rc_path = g_build_filename(get_rc_dir(), RC_FILE_NAME, NULL);
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
248 save_options_to(rc_path, options);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
249 g_free(rc_path);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
250 }
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
251
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
252 gboolean load_options(ConfOptions *options)
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
253 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
254 gboolean success;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
255 gchar *rc_path;
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
256
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
257 if (isdir(GQ_SYSTEM_WIDE_DIR))
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
258 {
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
259 rc_path = g_build_filename(GQ_SYSTEM_WIDE_DIR, RC_FILE_NAME, NULL);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
260 success = load_options_from(rc_path, options, TRUE);
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
261 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
262 g_free(rc_path);
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
263 }
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
264
1145
3a7af6a8cd5f Use functions to return directories instead of constants.
zas_
parents: 1060
diff changeset
265 rc_path = g_build_filename(get_rc_dir(), RC_FILE_NAME, NULL);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
266 success = load_options_from(rc_path, options, TRUE);
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
267 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
268 g_free(rc_path);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
269 return(success);
1019
4aa1a6235458 Move save/load_options() to options.[ch].
zas_
parents: 1013
diff changeset
270 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1037
diff changeset
271 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */