diff 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
line wrap: on
line diff
--- a/src/rcfile.c	Tue Apr 15 21:49:28 2008 +0000
+++ b/src/rcfile.c	Wed Apr 16 14:45:22 2008 +0000
@@ -167,6 +167,11 @@
 		}
 }
 
+static void write_uint_option(SecureSaveInfo *ssi, gchar *label, guint n)
+{
+	secure_fprintf(ssi, "%s: %u\n", label, n);
+}
+
 static void read_uint_option(FILE *f, gchar *option, gchar *label, gchar *value, guint *n)
 {
 	if (n && strcasecmp(option, label) == 0)
@@ -280,6 +285,7 @@
 	
 #define WRITE_BOOL(_name_) write_bool_option(ssi, #_name_, options->_name_)
 #define WRITE_INT(_name_) write_int_option(ssi, #_name_, options->_name_)
+#define WRITE_UINT(_name_) write_uint_option(ssi, #_name_, options->_name_)
 #define WRITE_INT_UNIT(_name_, _unit_) write_int_unit_option(ssi, #_name_, options->_name_, _unit_)
 #define WRITE_CHAR(_name_) write_char_option(ssi, #_name_, options->_name_)
 #define WRITE_COLOR(_name_) write_color_option(ssi, #_name_, &options->_name_)
@@ -335,7 +341,7 @@
 	WRITE_INT(layout.style);
 	WRITE_CHAR(layout.order);
 	WRITE_BOOL(layout.view_as_icons);
-	WRITE_BOOL(layout.view_as_tree);
+	WRITE_UINT(layout.dir_view_type);
 	WRITE_BOOL(layout.show_thumbnails);
 	WRITE_SEPARATOR();
 
@@ -619,7 +625,7 @@
 		READ_INT(layout.style);
 		READ_CHAR(layout.order);
 		READ_BOOL(layout.view_as_icons);
-		READ_BOOL(layout.view_as_tree);
+		READ_UINT(layout.dir_view_type);
 		READ_BOOL(layout.show_thumbnails);
 
 		/* window positions */