Mercurial > geeqie.yaz
comparison src/rcfile.c @ 380:5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
data.
Specific data is now in ViewDirInfoList and ViewDirInfoTree.
Type of directory view can be specified with enum DirViewType.
This is saved to rc file as layout.dir_view_type, which replace
layout.view_as_tree.
Code was modified to reflect these changes.
This is a first to move to merge common code of view_dir_list.c
and view_dir_tree.c and ease the introduction of new types
of directory view.
author | zas_ |
---|---|
date | Wed, 16 Apr 2008 14:45:22 +0000 |
parents | 9efefd85684a |
children | 2649a28d31b6 |
comparison
equal
deleted
inserted
replaced
379:a430eb2e3c95 | 380:5afe77bb563a |
---|---|
165 { | 165 { |
166 *n = strtol(value, NULL, 10); | 166 *n = strtol(value, NULL, 10); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 static void write_uint_option(SecureSaveInfo *ssi, gchar *label, guint n) | |
171 { | |
172 secure_fprintf(ssi, "%s: %u\n", label, n); | |
173 } | |
174 | |
170 static void read_uint_option(FILE *f, gchar *option, gchar *label, gchar *value, guint *n) | 175 static void read_uint_option(FILE *f, gchar *option, gchar *label, gchar *value, guint *n) |
171 { | 176 { |
172 if (n && strcasecmp(option, label) == 0) | 177 if (n && strcasecmp(option, label) == 0) |
173 { | 178 { |
174 *n = strtoul(value, NULL, 10); | 179 *n = strtoul(value, NULL, 10); |
278 return; | 283 return; |
279 } | 284 } |
280 | 285 |
281 #define WRITE_BOOL(_name_) write_bool_option(ssi, #_name_, options->_name_) | 286 #define WRITE_BOOL(_name_) write_bool_option(ssi, #_name_, options->_name_) |
282 #define WRITE_INT(_name_) write_int_option(ssi, #_name_, options->_name_) | 287 #define WRITE_INT(_name_) write_int_option(ssi, #_name_, options->_name_) |
288 #define WRITE_UINT(_name_) write_uint_option(ssi, #_name_, options->_name_) | |
283 #define WRITE_INT_UNIT(_name_, _unit_) write_int_unit_option(ssi, #_name_, options->_name_, _unit_) | 289 #define WRITE_INT_UNIT(_name_, _unit_) write_int_unit_option(ssi, #_name_, options->_name_, _unit_) |
284 #define WRITE_CHAR(_name_) write_char_option(ssi, #_name_, options->_name_) | 290 #define WRITE_CHAR(_name_) write_char_option(ssi, #_name_, options->_name_) |
285 #define WRITE_COLOR(_name_) write_color_option(ssi, #_name_, &options->_name_) | 291 #define WRITE_COLOR(_name_) write_color_option(ssi, #_name_, &options->_name_) |
286 | 292 |
287 #define WRITE_SEPARATOR() secure_fputc(ssi, '\n') | 293 #define WRITE_SEPARATOR() secure_fputc(ssi, '\n') |
333 WRITE_SUBTITLE("Layout Options"); | 339 WRITE_SUBTITLE("Layout Options"); |
334 | 340 |
335 WRITE_INT(layout.style); | 341 WRITE_INT(layout.style); |
336 WRITE_CHAR(layout.order); | 342 WRITE_CHAR(layout.order); |
337 WRITE_BOOL(layout.view_as_icons); | 343 WRITE_BOOL(layout.view_as_icons); |
338 WRITE_BOOL(layout.view_as_tree); | 344 WRITE_UINT(layout.dir_view_type); |
339 WRITE_BOOL(layout.show_thumbnails); | 345 WRITE_BOOL(layout.show_thumbnails); |
340 WRITE_SEPARATOR(); | 346 WRITE_SEPARATOR(); |
341 | 347 |
342 WRITE_BOOL(layout.save_window_positions); | 348 WRITE_BOOL(layout.save_window_positions); |
343 WRITE_SEPARATOR(); | 349 WRITE_SEPARATOR(); |
617 /* layout options */ | 623 /* layout options */ |
618 | 624 |
619 READ_INT(layout.style); | 625 READ_INT(layout.style); |
620 READ_CHAR(layout.order); | 626 READ_CHAR(layout.order); |
621 READ_BOOL(layout.view_as_icons); | 627 READ_BOOL(layout.view_as_icons); |
622 READ_BOOL(layout.view_as_tree); | 628 READ_UINT(layout.dir_view_type); |
623 READ_BOOL(layout.show_thumbnails); | 629 READ_BOOL(layout.show_thumbnails); |
624 | 630 |
625 /* window positions */ | 631 /* window positions */ |
626 | 632 |
627 READ_BOOL(layout.save_window_positions); | 633 READ_BOOL(layout.save_window_positions); |