changeset 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 8355da717c68
children a3d3208b0c50
files src/collect.c src/layout.c src/layout.h src/layout_util.c src/options.c src/options.h src/preferences.c src/preferences.h src/rcfile.c src/typedefs.h src/view_dir_list.c
diffstat 11 files changed, 282 insertions(+), 194 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/collect.c	Sat Mar 14 23:26:42 2009 +0000
@@ -1185,7 +1185,7 @@
 				      GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
 
 
-	if (options->layout.save_window_positions && path && collection_load_only_geometry(cw->cd, path))
+	if (options->save_window_positions && path && collection_load_only_geometry(cw->cd, path))
 		{
 		/* FIXME: x, y is not implemented */
 		gtk_window_set_default_size(GTK_WINDOW(cw->window), cw->cd->window_w, cw->cd->window_h);
--- a/src/layout.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/layout.c	Sat Mar 14 23:26:42 2009 +0000
@@ -36,6 +36,7 @@
 #include "rcfile.h"
 #include "bar.h"
 #include "bar_sort.h"
+#include "preferences.h"
 
 #ifdef HAVE_LIRC
 #include "lirc.h"
@@ -1346,8 +1347,8 @@
 
 static void layout_tools_geometry_sync(LayoutWindow *lw)
 {
-	layout_geometry_get_tools(lw, &options->layout.float_window.x, &options->layout.float_window.x,
-				  &options->layout.float_window.w, &options->layout.float_window.h, &lw->options.float_window.vdivider_pos);
+	layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.x,
+				  &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos);
 }
 
 static void layout_tools_hide(LayoutWindow *lw, gboolean hide)
@@ -1410,7 +1411,7 @@
 				 G_CALLBACK(layout_tools_delete_cb), lw);
 		layout_keyboard_init(lw, lw->tools);
 
-		if (options->layout.save_window_positions)
+		if (options->save_window_positions)
 			{
 			hints = GDK_HINT_USER_POS;
 			}
@@ -1466,10 +1467,10 @@
 
 	if (new_window)
 		{
-		if (options->layout.save_window_positions)
+		if (options->save_window_positions)
 			{
-			gtk_window_set_default_size(GTK_WINDOW(lw->tools), options->layout.float_window.w, options->layout.float_window.h);
-			gtk_window_move(GTK_WINDOW(lw->tools), options->layout.float_window.x, options->layout.float_window.y);
+			gtk_window_set_default_size(GTK_WINDOW(lw->tools), lw->options.float_window.w, lw->options.float_window.h);
+			gtk_window_move(GTK_WINDOW(lw->tools), lw->options.float_window.x, lw->options.float_window.y);
 			}
 		else
 			{
@@ -1486,7 +1487,7 @@
 			}
 		}
 
-	if (!options->layout.save_window_positions)
+	if (!options->save_window_positions)
 		{
 		if (vertical)
 			{
@@ -1787,20 +1788,6 @@
 	file_data_unref(dir_fd);
 }
 
-void layout_styles_update(void)
-{
-	GList *work;
-
-	work = layout_window_list;
-	while (work)
-		{
-		LayoutWindow *lw = work->data;
-		work = work->next;
-
-		layout_style_set(lw, options->layout.style, options->layout.order);
-		}
-}
-
 void layout_colors_update(void)
 {
 	GList *work;
@@ -1925,6 +1912,180 @@
 
 /*
  *-----------------------------------------------------------------------------
+ * configuration
+ *-----------------------------------------------------------------------------
+ */
+
+#define CONFIG_WINDOW_DEF_WIDTH		600
+#define CONFIG_WINDOW_DEF_HEIGHT	400
+
+typedef struct _LayoutConfig LayoutConfig;
+struct _LayoutConfig
+{
+	LayoutWindow *lw;
+
+	GtkWidget *configwindow;
+	GtkWidget *home_path_entry;
+	GtkWidget *layout_widget;
+	
+	LayoutOptions options;
+};
+
+static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data);
+
+static void layout_config_close_cb(GtkWidget *widget, gpointer data)
+{
+	LayoutConfig *lc = data;
+	
+	gtk_widget_destroy(lc->configwindow);
+	free_layout_options_content(&lc->options);
+	g_free(lc);
+}
+
+static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
+{
+	layout_config_close_cb(w, data);
+	return TRUE;
+}
+
+static void layout_config_apply_cb(GtkWidget *widget, gpointer data)
+{
+	LayoutConfig *lc = data;
+	
+	g_free(lc->options.order);
+	lc->options.order = layout_config_get(lc->layout_widget, &lc->options.style);
+
+	config_entry_to_option(lc->home_path_entry, &lc->options.home_path, remove_trailing_slash);
+
+	layout_apply_options(lc->lw, &lc->options);
+}
+
+static void layout_config_ok_cb(GtkWidget *widget, gpointer data)
+{
+	LayoutConfig *lc = data;
+	layout_config_apply_cb(widget, lc);
+	layout_config_close_cb(widget, lc);
+}
+
+static void home_path_set_current_cb(GtkWidget *widget, gpointer data)
+{
+	LayoutConfig *lc = data;
+	gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry), layout_get_path(lc->lw));
+}
+
+/*
+static void layout_config_save_cb(GtkWidget *widget, gpointer data)
+{
+	layout_config_apply();
+	save_options(options);
+}
+*/
+
+void layout_show_config_window(LayoutWindow *lw)
+{
+	LayoutConfig *lc;
+	GtkWidget *win_vbox;
+	GtkWidget *hbox;
+	GtkWidget *vbox;
+	GtkWidget *button;
+	GtkWidget *ct_button;
+	GtkWidget *group;
+	GtkWidget *frame;
+	GtkWidget *tabcomp;
+
+	lc = g_new0(LayoutConfig, 1);
+	lc->lw = lw;
+	layout_sync_options_with_current_state(lw);
+	copy_layout_options(&lc->options, &lw->options);
+
+	lc->configwindow = window_new(GTK_WINDOW_TOPLEVEL, "Layout", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Window options and layout"));
+	gtk_window_set_type_hint(GTK_WINDOW(lc->configwindow), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+	g_signal_connect(G_OBJECT(lc->configwindow), "delete_event",
+			 G_CALLBACK(layout_config_delete_cb), lc);
+
+	gtk_window_set_default_size(GTK_WINDOW(lc->configwindow), CONFIG_WINDOW_DEF_WIDTH, CONFIG_WINDOW_DEF_HEIGHT);
+	gtk_window_set_resizable(GTK_WINDOW(lc->configwindow), TRUE);
+	gtk_container_set_border_width(GTK_CONTAINER(lc->configwindow), PREF_PAD_BORDER);
+
+	win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
+	gtk_container_add(GTK_CONTAINER(lc->configwindow), win_vbox);
+	gtk_widget_show(win_vbox);
+
+	hbox = gtk_hbutton_box_new();
+	gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
+	gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP);
+	gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0);
+	gtk_widget_show(hbox);
+
+	button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
+				 G_CALLBACK(layout_config_ok_cb), lc);
+	gtk_container_add(GTK_CONTAINER(hbox), button);
+	GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+	gtk_widget_grab_default(button);
+	gtk_widget_show(button);
+
+	ct_button = button;
+/*
+	button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE,
+				 G_CALLBACK(layout_config_save_cb), NULL);
+	gtk_container_add(GTK_CONTAINER(hbox), button);
+	GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+	gtk_widget_show(button);
+*/	
+	button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
+				 G_CALLBACK(layout_config_apply_cb), lc);
+	gtk_container_add(GTK_CONTAINER(hbox), button);
+	GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+	gtk_widget_show(button);
+
+	button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE,
+				 G_CALLBACK(layout_config_close_cb), lc);
+	gtk_container_add(GTK_CONTAINER(hbox), button);
+	GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+	gtk_widget_show(button);
+
+	if (!generic_dialog_get_alternative_button_order(lc->configwindow))
+		{
+		gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1);
+		}
+
+	frame = pref_frame_new(win_vbox, TRUE, NULL, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+	
+	vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
+	gtk_container_add(GTK_CONTAINER(frame), vbox);
+	gtk_widget_show(vbox);
+
+	group = pref_group_new(vbox, FALSE, _("General options"), GTK_ORIENTATION_VERTICAL);
+
+	pref_label_new(group, _("Home button path (empty to use your home directory)"));
+	hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
+
+	tabcomp = tab_completion_new(&lc->home_path_entry, lc->options.home_path, NULL, NULL);
+	tab_completion_add_select_button(lc->home_path_entry, NULL, TRUE);
+	gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
+	gtk_widget_show(tabcomp);
+
+	button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
+				 G_CALLBACK(home_path_set_current_cb), lc);
+
+	group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL);
+
+	pref_checkbox_new_int(group, _("Show date in directories list view"),
+			      lc->options.show_directory_date, &lc->options.show_directory_date);
+
+	group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL);
+
+	lc->layout_widget = layout_config_new();
+	layout_config_set(lc->layout_widget, lw->options.style, lw->options.order);
+	gtk_box_pack_start(GTK_BOX(group), lc->layout_widget, TRUE, TRUE, 0);
+
+	gtk_widget_show(lc->layout_widget);
+	gtk_widget_show(lc->configwindow);
+}
+
+/*
+ *-----------------------------------------------------------------------------
  * base
  *-----------------------------------------------------------------------------
  */
@@ -1961,6 +2122,23 @@
 //		}
 }
 
+void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
+{
+	gint refresh_style;
+	gint refresh_lists;
+
+	if (!layout_valid(&lw)) return;
+/* FIXME: add other options too */
+
+	refresh_style = (lop->style != lw->options.style || strcmp(lop->order, lw->options.order) != 0);
+	refresh_lists = (lop->show_directory_date != lw->options.show_directory_date);
+
+	copy_layout_options(&lw->options, lop);
+
+	if (refresh_style) layout_style_set(lw, lw->options.style, lw->options.order);
+	if (refresh_lists) layout_refresh(lw);
+}
+
 
 void layout_close(LayoutWindow *lw)
 {
@@ -2027,7 +2205,7 @@
 	if (lop)
 		copy_layout_options(&lw->options, lop);
 	else
-		copy_layout_options(&lw->options, &options->layout);
+		init_layout_options(&lw->options);
 
 	lw->sort_method = SORT_NAME;
 	lw->sort_ascend = TRUE;
@@ -2046,7 +2224,7 @@
 
 	/* divider positions */
 
-	if (!lw->options.save_window_positions)
+	if (!options->save_window_positions)
 		{
 		lw->options.main_window.hdivider_pos = MAIN_WINDOW_DIV_HPOS;
 		lw->options.main_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS;
@@ -2059,7 +2237,7 @@
 	gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE);
 	gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0);
 
-	if (lw->options.save_window_positions)
+	if (options->save_window_positions)
 		{
 		hint_mask = GDK_HINT_USER_POS;
 		}
@@ -2075,7 +2253,7 @@
 	gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint,
 				      GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask);
 
-	if (lw->options.save_window_positions)
+	if (options->save_window_positions)
 		{
 		gtk_window_set_default_size(GTK_WINDOW(lw->window), lw->options.main_window.w, lw->options.main_window.h);
 //		if (!layout_window_list)
@@ -2160,7 +2338,6 @@
 	WRITE_CHAR(*layout, home_path);
 	WRITE_SEPARATOR();
 
-	WRITE_BOOL(*layout, save_window_positions);
 	WRITE_INT(*layout, main_window.x);
 	WRITE_INT(*layout, main_window.y);
 	WRITE_INT(*layout, main_window.w);
@@ -2183,7 +2360,6 @@
 
 	WRITE_BOOL(*layout, tools_float);
 	WRITE_BOOL(*layout, tools_hidden);
-	WRITE_BOOL(*layout, tools_restore_state);
 	WRITE_SEPARATOR();
 
 	WRITE_BOOL(*layout, toolbar_hidden);
@@ -2232,8 +2408,6 @@
 
 		/* window positions */
 
-		if (READ_BOOL(*layout, save_window_positions)) continue;
-
 		if (READ_INT(*layout, main_window.x)) continue;
 		if (READ_INT(*layout, main_window.y)) continue;
 		if (READ_INT(*layout, main_window.w)) continue;
@@ -2253,7 +2427,6 @@
 
 		if (READ_BOOL(*layout, tools_float)) continue;
 		if (READ_BOOL(*layout, tools_hidden)) continue;
-		if (READ_BOOL(*layout, tools_restore_state)) continue;
 		if (READ_BOOL(*layout, toolbar_hidden)) continue;
 		if (READ_BOOL(*layout, info_pixel_hidden)) continue;
 
@@ -2306,8 +2479,7 @@
 	LayoutWindow *lw;
 	gchar *path = NULL;
 	
-	memset(&lop, 0, sizeof(LayoutOptions));
-	copy_layout_options(&lop, &options->layout);
+	init_layout_options(&lop);
 
 	if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
 	
--- a/src/layout.h	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/layout.h	Sat Mar 14 23:26:42 2009 +0000
@@ -27,6 +27,10 @@
 
 gboolean layout_valid(LayoutWindow **lw);
 
+void layout_show_config_window(LayoutWindow *lw);
+
+void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop);
+
 void layout_sync_options_with_current_state(LayoutWindow *lw);
 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values);
 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent);
--- a/src/layout_util.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/layout_util.c	Sat Mar 14 23:26:42 2009 +0000
@@ -194,12 +194,16 @@
 {
 	LayoutWindow *lw = data;
 	LayoutWindow *nw;
-
+	gboolean tmp = options->save_window_positions;
+	options->save_window_positions = FALSE; /* let the windowmanager decide for the first time */
+	
 	layout_exit_fullscreen(lw);
 
-	nw = layout_new(NULL, NULL);
+	layout_sync_options_with_current_state(lw);
+	nw = layout_new(NULL, &lw->options);
 	layout_sort_set(nw, options->file_sort.method, options->file_sort.ascending);
 	layout_set_fd(nw, lw->dir_fd);
+	options->save_window_positions = tmp;
 }
 
 static void layout_menu_new_cb(GtkAction *action, gpointer data)
@@ -361,6 +365,14 @@
 	show_config_window();
 }
 
+static void layout_menu_layout_config_cb(GtkAction *action, gpointer data)
+{
+	LayoutWindow *lw = data;
+
+	layout_exit_fullscreen(lw);
+	layout_show_config_window(lw);
+}
+
 static void layout_menu_remove_thumb_cb(GtkAction *action, gpointer data)
 {
 	LayoutWindow *lw = data;
@@ -918,16 +930,16 @@
 
 static void layout_menu_home_cb(GtkAction *action, gpointer data)
 {
+	LayoutWindow *lw = data;
 	const gchar *path;
 	
-	if (options->layout.home_path && *options->layout.home_path)
-		path = options->layout.home_path;
+	if (lw->options.home_path && *lw->options.home_path)
+		path = lw->options.home_path;
 	else
 		path = homedir();
 
 	if (path)
 		{
-		LayoutWindow *lw = data;
 		FileData *dir_fd = file_data_new_simple(path);
 		layout_set_fd(lw, dir_fd);
 		file_data_unref(dir_fd);
@@ -1205,6 +1217,7 @@
   { "SelectInvert",	NULL,		N_("_Invert Selection"), "<control><shift>I",	NULL,	CB(layout_menu_invert_selection_cb) },
 
   { "Preferences",GTK_STOCK_PREFERENCES,N_("P_references..."),	"<control>O",	NULL,	CB(layout_menu_config_cb) },
+  { "LayoutConfig",GTK_STOCK_PREFERENCES,N_("_Configure this window..."),	NULL,	NULL,	CB(layout_menu_layout_config_cb) },
   { "Maintenance",	NULL,		N_("_Thumbnail maintenance..."),NULL,	NULL,	CB(layout_menu_remove_thumb_cb) },
   { "Wallpaper",	NULL,		N_("Set as _wallpaper"),NULL,		NULL,	CB(layout_menu_wallpaper_cb) },
 
@@ -1362,6 +1375,7 @@
 "      <placeholder name='PropertiesSection'/>"
 "      <separator/>"
 "      <menuitem action='Preferences'/>"
+"      <menuitem action='LayoutConfig'/>"
 "      <menuitem action='Maintenance'/>"
 "      <placeholder name='PreferencesSection'/>"
 "      <separator/>"
--- a/src/options.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/options.c	Sat Mar 14 23:26:42 2009 +0000
@@ -43,6 +43,9 @@
 	options->file_filter.show_dot_directory = FALSE;
 	options->file_filter.show_hidden_files = FALSE;
 
+	options->save_window_positions = TRUE;
+	options->tools_restore_state = TRUE;
+
 	options->file_ops.confirm_delete = TRUE;
 	options->file_ops.enable_delete_key = TRUE;
 	options->file_ops.enable_in_place_rename = TRUE;
@@ -84,36 +87,6 @@
 	options->image_overlay.x = 10;
 	options->image_overlay.y = -10;
 
-	options->layout.dir_view_type = DIRVIEW_LIST;
-	options->layout.file_view_type = FILEVIEW_LIST;
-	options->layout.float_window.h = 450;
-	options->layout.float_window.vdivider_pos = -1;
-	options->layout.float_window.w = 260;
-	options->layout.float_window.x = 0;
-	options->layout.float_window.y = 0;
-	options->layout.home_path = NULL;
-	options->layout.main_window.h = 540;
-	options->layout.main_window.hdivider_pos = -1;
-	options->layout.main_window.maximized = FALSE;
-	options->layout.main_window.vdivider_pos = 200;
-	options->layout.main_window.w = 720;
-	options->layout.main_window.x = 0;
-	options->layout.main_window.y = 0;
-	options->layout.order = NULL;
-	options->layout.save_window_positions = TRUE;
-	options->layout.show_directory_date = FALSE;
-	options->layout.show_marks = FALSE;
-	options->layout.show_thumbnails = FALSE;
-	options->layout.style = 0;
-	options->layout.info_pixel_hidden = TRUE;
-	options->layout.toolbar_hidden = FALSE;
-	options->layout.tools_float = FALSE;
-	options->layout.tools_hidden = FALSE;
-	options->layout.tools_restore_state = TRUE;
-	options->layout.image_overlay.histogram_channel = HCHAN_RGB;
-	options->layout.image_overlay.histogram_mode = 1;
-	options->layout.image_overlay.state = OSD_SHOW_NOTHING;
-	
 	options->lazy_image_sync = FALSE;
 	options->mousewheel_scrolls = FALSE;
 	options->open_recent_list_maxsize = 10;
@@ -182,7 +155,6 @@
 
 	set_default_image_overlay_template_string(&options->image_overlay.template_string);
 	options->sidecar.ext = g_strdup(".jpg;%raw;.xmp");
-	options->layout.order = g_strdup("123");
 
 	options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH);
 	options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
@@ -208,6 +180,40 @@
 	if (dest->home_path) g_free(dest->home_path);
 }
 
+LayoutOptions *init_layout_options(LayoutOptions *options)
+{
+	memset(options, 0, sizeof(LayoutOptions));
+
+	options->dir_view_type = DIRVIEW_LIST;
+	options->file_view_type = FILEVIEW_LIST;
+	options->float_window.h = 450;
+	options->float_window.vdivider_pos = -1;
+	options->float_window.w = 260;
+	options->float_window.x = 0;
+	options->float_window.y = 0;
+	options->home_path = NULL;
+	options->main_window.h = 540;
+	options->main_window.hdivider_pos = -1;
+	options->main_window.maximized = FALSE;
+	options->main_window.vdivider_pos = 200;
+	options->main_window.w = 720;
+	options->main_window.x = 0;
+	options->main_window.y = 0;
+	options->order = g_strdup("123");
+	options->show_directory_date = FALSE;
+	options->show_marks = FALSE;
+	options->show_thumbnails = FALSE;
+	options->style = 0;
+	options->info_pixel_hidden = TRUE;
+	options->toolbar_hidden = FALSE;
+	options->tools_float = FALSE;
+	options->tools_hidden = FALSE;
+	options->image_overlay.histogram_channel = HCHAN_RGB;
+	options->image_overlay.histogram_mode = 1;
+	options->image_overlay.state = OSD_SHOW_NOTHING;
+	return options;
+}
+
 static void sync_options_with_current_state(ConfOptions *options)
 {
 	LayoutWindow *lw = NULL;
@@ -215,11 +221,8 @@
 	if (layout_valid(&lw))
 		{
 		layout_sync_options_with_current_state(lw);
-		copy_layout_options(&options->layout, &lw->options);
 		layout_sort_get(lw, &options->file_sort.method, &options->file_sort.ascending);
 
-	
-
 		options->color_profile.enabled = layout_image_color_profile_get_use(lw);
 		layout_image_color_profile_get(lw,
 					       &options->color_profile.input_type,
--- a/src/options.h	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/options.h	Sat Mar 14 23:26:42 2009 +0000
@@ -34,6 +34,8 @@
 	gint open_recent_list_maxsize;
 	gint dnd_icon_size;
 
+	gboolean save_window_positions;
+	gboolean tools_restore_state;
 
 	/* start up */
 	struct {
@@ -145,13 +147,6 @@
 		gint y;
 	} image_overlay;
 
-	/* layout */
-	/* FIXME: this is here for 2 reasons:
-	   - I don't want to break preferences dialog now
-	   - it might be useful as defaults for new windows (I am not sure about this)
-	*/
-	LayoutOptions layout;
-
 	/* properties dialog */
 	struct {
 		gchar *tabs_order;
@@ -208,7 +203,7 @@
 
 void copy_layout_options(LayoutOptions *dest, const LayoutOptions *src);
 void free_layout_options_content(LayoutOptions *dest);
-
+LayoutOptions *init_layout_options(LayoutOptions *options);
 
 #endif /* OPTIONS_H */
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/preferences.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/preferences.c	Sat Mar 14 23:26:42 2009 +0000
@@ -97,11 +97,8 @@
 
 static GtkWidget *configwindow = NULL;
 static GtkWidget *startup_path_entry;
-static GtkWidget *home_path_entry;
 static GtkListStore *filter_store = NULL;
 
-static GtkWidget *layout_widget;
-
 static GtkWidget *safe_delete_path_entry;
 
 static GtkWidget *color_profile_input_file_entry[COLOR_PROFILE_INPUTS];
@@ -125,11 +122,6 @@
 	gtk_entry_set_text(GTK_ENTRY(startup_path_entry), layout_get_path(NULL));
 }
 
-static void home_path_set_current(GtkWidget *widget, gpointer data)
-{
-	gtk_entry_set_text(GTK_ENTRY(home_path_entry), layout_get_path(NULL));
-}
-
 static void zoom_mode_cb(GtkWidget *widget, gpointer data)
 {
 	if (GTK_TOGGLE_BUTTON (widget)->active)
@@ -159,7 +151,7 @@
  *-----------------------------------------------------------------------------
  */
 
-static void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(const gchar *))
+void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(const gchar *))
 {
 	const gchar *buf;
 
@@ -226,7 +218,6 @@
 
 static void config_window_apply(void)
 {
-	gint new_style;
 	gint i;
 	gint refresh = FALSE;
 
@@ -243,14 +234,13 @@
 	options->startup.restore_path = c_options->startup.restore_path;
 	options->startup.use_last_path = c_options->startup.use_last_path;
 	config_entry_to_option(startup_path_entry, &options->startup.path, remove_trailing_slash);
-	config_entry_to_option(home_path_entry, &options->layout.home_path, remove_trailing_slash);
 
 	options->file_ops.confirm_delete = c_options->file_ops.confirm_delete;
 	options->file_ops.enable_delete_key = c_options->file_ops.enable_delete_key;
 	options->file_ops.safe_delete_enable = c_options->file_ops.safe_delete_enable;
 	options->file_ops.safe_delete_folder_maxsize = c_options->file_ops.safe_delete_folder_maxsize;
-	options->layout.tools_restore_state = c_options->layout.tools_restore_state;
-	options->layout.save_window_positions = c_options->layout.save_window_positions;
+	options->tools_restore_state = c_options->tools_restore_state;
+	options->save_window_positions = c_options->save_window_positions;
 	options->image.zoom_mode = c_options->image.zoom_mode;
 	options->image.scroll_reset_method = c_options->image.scroll_reset_method;
 	options->image.zoom_2pass = c_options->image.zoom_2pass;
@@ -368,35 +358,6 @@
 		}
 
 #endif
-	{
-	gchar *layout_order = layout_config_get(layout_widget, &new_style);
-
-	if (new_style != options->layout.style ||
-	    (layout_order == NULL) != (options->layout.order == NULL) ||
-	    !options->layout.order ||
-	    strcmp(layout_order, options->layout.order) != 0)
-		{
-		if (refresh) filter_rebuild();
-		refresh = FALSE;
-
-		g_free(options->layout.order);
-		options->layout.order = layout_order;
-		layout_order = NULL; /* g_free() later */
-
-		options->layout.style = new_style;
-
-		layout_styles_update();
-		}
-
-	g_free(layout_order);
-	}
-
-	if (options->layout.show_directory_date != c_options->layout.show_directory_date)
-		{
-		options->layout.show_directory_date = c_options->layout.show_directory_date;
-		refresh = TRUE;
-		}
-
 	image_options_sync();
 
 	if (refresh)
@@ -448,40 +409,6 @@
  *-----------------------------------------------------------------------------
  */
 
-static void exif_item_cb(GtkWidget *combo, gpointer data)
-{
-	gint *option = data;
-	*option = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
-}
-
-static void exif_item(GtkWidget *table, gint column, gint row,
-		      const gchar *text, gint option, gint *option_c)
-{
-	GtkWidget *combo;
-
-	*option_c = option;
-
-	pref_table_label(table, column, row, text, 0.0);
-
-	combo = gtk_combo_box_new_text();
-
-	/* note: the order is important, it must match the values of
-	 * EXIF_UI_OFF, _IFSET, _ON */
-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Never"));
-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("If set"));
-	gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Always"));
-
-	gtk_combo_box_set_active(GTK_COMBO_BOX(combo), option);
-
-	g_signal_connect(G_OBJECT(combo), "changed",
-			 G_CALLBACK(exif_item_cb), option_c);
-
-	gtk_table_attach(GTK_TABLE(table), combo,
-			 column + 1, column + 2, row, row + 1,
-			 GTK_EXPAND | GTK_FILL, 0, 0, 0);
-	gtk_widget_show(combo);
-}
-
 static void quality_menu_cb(GtkWidget *combo, gpointer data)
 {
 	gint *option = data;
@@ -1198,9 +1125,9 @@
 	group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL);
 
 	pref_checkbox_new_int(group, _("Remember window positions"),
-			      options->layout.save_window_positions, &c_options->layout.save_window_positions);
+			      options->save_window_positions, &c_options->save_window_positions);
 	pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"),
-			      options->layout.tools_restore_state, &c_options->layout.tools_restore_state);
+			      options->tools_restore_state, &c_options->tools_restore_state);
 
 	group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL);
 
@@ -1214,13 +1141,6 @@
 				 10, 150, 1,
 				 options->image.max_window_size, &c_options->image.max_window_size);
 	pref_checkbox_link_sensitivity(ct_button, spin);
-
-	group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL);
-
-	layout_widget = layout_config_new();
-	layout_config_set(layout_widget, options->layout.style, options->layout.order);
-	gtk_box_pack_start(GTK_BOX(group), layout_widget, FALSE, FALSE, 0);
-	gtk_widget_show(layout_widget);
 }
 
 static GtkTreeModel *create_class_model(void)
@@ -1634,9 +1554,6 @@
 	pref_checkbox_new_int(group, _("Descend folders in tree view"),
 			      options->tree_descend_subdirs, &c_options->tree_descend_subdirs);
 
-	pref_checkbox_new_int(group, _("Show date in directories list view"),
-			      options->layout.show_directory_date, &c_options->layout.show_directory_date);
-
 	pref_checkbox_new_int(group, _("In place renaming"),
 			      options->file_ops.enable_in_place_rename, &c_options->file_ops.enable_in_place_rename);
 
@@ -1656,18 +1573,6 @@
 	pref_checkbox_new_int(group, _("Mouse wheel scrolls image"),
 			      options->mousewheel_scrolls, &c_options->mousewheel_scrolls);
 
-	pref_label_new(group, _("Home button path (empty to use your home directory)"));
-	hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
-
-	tabcomp = tab_completion_new(&home_path_entry, options->layout.home_path, NULL, NULL);
-	tab_completion_add_select_button(home_path_entry, NULL, TRUE);
-	gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
-	gtk_widget_show(tabcomp);
-
-	button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
-				 G_CALLBACK(home_path_set_current), NULL);
-
-
 	group = pref_group_new(vbox, FALSE, _("Metadata"), GTK_ORIENTATION_VERTICAL);
 
 	pref_checkbox_new_int(group, _("Store metadata and cache files in source image's directory"),
--- a/src/preferences.h	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/preferences.h	Sat Mar 14 23:26:42 2009 +0000
@@ -18,6 +18,9 @@
 void show_config_window(void);
 void show_about_window(void);
 
+/* reusable helper functions */
+void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(const gchar *));
+
 
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/rcfile.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/rcfile.c	Sat Mar 14 23:26:42 2009 +0000
@@ -285,6 +285,8 @@
 	WRITE_INT(*options, dnd_icon_size);
 	WRITE_BOOL(*options, place_dialogs_under_mouse);
 
+	WRITE_BOOL(*options, save_window_positions);
+	WRITE_BOOL(*options, tools_restore_state);
 
 //	WRITE_SUBTITLE("Startup Options");
 
@@ -534,10 +536,6 @@
 	filter_write_list(outstr, indent);
 
 	WRITE_SEPARATOR();
-	WRITE_SUBTITLE("Layout Options - defaults");
-	WRITE_STRING("<layout\n");
-	layout_write_attributes(&options->layout, outstr, indent + 1);
-	WRITE_STRING("/>\n");
 	keyword_tree_write_config(outstr, indent);
 	indent--;
 	WRITE_STRING("</global>\n");
@@ -602,6 +600,9 @@
 		if (READ_INT(*options, dnd_icon_size)) continue;
 		if (READ_BOOL(*options, place_dialogs_under_mouse)) continue;
 
+		if (READ_BOOL(*options, save_window_positions)) continue;
+		if (READ_BOOL(*options, tools_restore_state)) continue;
+
 		/* startup options */
 		
 		if (READ_BOOL(*options, startup.restore_path)) continue;
@@ -877,11 +878,6 @@
 		if (!keyword_tree) keyword_tree_new();
 		options_parse_func_push(parser_data, options_parse_keyword_tree, NULL, NULL);
 		}
-	else if (g_ascii_strcasecmp(element_name, "layout") == 0)
-		{
-		layout_load_attributes(&options->layout, attribute_names, attribute_values);
-		options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
-		}
 	else
 		{
 		DEBUG_1("unexpected global: %s", element_name);
--- a/src/typedefs.h	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/typedefs.h	Sat Mar 14 23:26:42 2009 +0000
@@ -520,12 +520,8 @@
 		gint histogram_mode;
 	} image_overlay;
 
-	gboolean save_window_positions;
-
 	gboolean tools_float;
 	gboolean tools_hidden;
-	gboolean tools_restore_state;
-
 	gboolean toolbar_hidden;
 	gboolean info_pixel_hidden;
 
--- a/src/view_dir_list.c	Sat Mar 14 21:12:55 2009 +0000
+++ b/src/view_dir_list.c	Sat Mar 14 23:26:42 2009 +0000
@@ -203,7 +203,7 @@
 			else
 				{
 				pixbuf = vd->pf->close;
-				if (options->layout.show_directory_date)
+				if (vd->layout && vd->layout->options.show_directory_date)
 					date = text_from_time(fd->date);
 				}
 			}