changeset 764:ae618ebec3e9

Save properties window width and height to rc file and restore them on next session if layout.save_window_positions is set to TRUE.
author zas_
date Thu, 29 May 2008 07:52:05 +0000
parents 81f9e8dbb4bf
children 339db85846da
files src/info.c src/info.h src/options.c src/options.h src/rcfile.c
diffstat 5 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/info.c	Wed May 28 22:12:10 2008 +0000
+++ b/src/info.c	Thu May 29 07:52:05 2008 +0000
@@ -33,8 +33,6 @@
 #define IMAGE_SIZE_W 200
 #define IMAGE_SIZE_H 200
 
-#define DEF_PROPERTY_WIDTH  600
-#define DEF_PROPERTY_HEIGHT 400
 
 typedef struct _TabData TabData;
 struct _TabData
@@ -716,9 +714,6 @@
  *-------------------------------------------------------------------
  */
 
-static gint info_window_last_width = DEF_PROPERTY_WIDTH;
-static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
-
 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
 {
 	InfoData *id = data;
@@ -798,9 +793,9 @@
 
 static void info_window_close(InfoData *id)
 {
-	gdk_drawable_get_size(id->window->window, &info_window_last_width, &info_window_last_height);
-	info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH);
-	info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT);
+	gdk_drawable_get_size(id->window->window, &options->layout.properties_window.w, &options->layout.properties_window.h);
+	options->layout.properties_window.w = MAX(options->layout.properties_window.w, DEF_PROPERTY_WIDTH);
+	options->layout.properties_window.h = MAX(options->layout.properties_window.h, DEF_PROPERTY_HEIGHT);
 
 	gtk_widget_destroy(id->window);
 }
@@ -871,8 +866,11 @@
 	gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
 				      GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
 
+	if (options->layout.save_window_positions)
+		gtk_window_set_default_size(GTK_WINDOW(id->window), options->layout.properties_window.w, options->layout.properties_window.h);
+	else
+		gtk_window_set_default_size(GTK_WINDOW(id->window), DEF_PROPERTY_WIDTH, DEF_PROPERTY_HEIGHT);
 
-	gtk_window_set_default_size(GTK_WINDOW(id->window), info_window_last_width, info_window_last_height);
 	gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
 
 	g_signal_connect(G_OBJECT(id->window), "delete_event",
--- a/src/info.h	Wed May 28 22:12:10 2008 +0000
+++ b/src/info.h	Thu May 29 07:52:05 2008 +0000
@@ -14,6 +14,9 @@
 #ifndef INFO_H
 #define INFO_H
 
+#define DEF_PROPERTY_WIDTH  600
+#define DEF_PROPERTY_HEIGHT 400
+
 
 typedef struct _InfoData InfoData;
 struct _InfoData
--- a/src/options.c	Wed May 28 22:12:10 2008 +0000
+++ b/src/options.c	Thu May 29 07:52:05 2008 +0000
@@ -102,6 +102,8 @@
 	options->layout.main_window.x = 0;
 	options->layout.main_window.y = 0;
 	options->layout.order = NULL;
+	options->layout.properties_window.w = DEF_PROPERTY_WIDTH;
+	options->layout.properties_window.h = DEF_PROPERTY_HEIGHT;
 	options->layout.save_window_positions = FALSE;
 	options->layout.show_marks = FALSE;
 	options->layout.show_thumbnails = FALSE;
--- a/src/options.h	Wed May 28 22:12:10 2008 +0000
+++ b/src/options.h	Thu May 29 07:52:05 2008 +0000
@@ -182,6 +182,11 @@
 			gint vdivider_pos;
 		} float_window;
 
+		struct {
+			gint w;
+			gint h;
+		} properties_window;
+
 		gint save_window_positions;
 
 		gint tools_float;
--- a/src/rcfile.c	Wed May 28 22:12:10 2008 +0000
+++ b/src/rcfile.c	Thu May 29 07:52:05 2008 +0000
@@ -396,6 +396,10 @@
 	WRITE_INT(layout.float_window.vdivider_pos);
 	WRITE_SEPARATOR();
 
+	WRITE_INT(layout.properties_window.w);
+	WRITE_INT(layout.properties_window.h);
+	WRITE_SEPARATOR();
+
 	WRITE_BOOL(layout.tools_float);
 	WRITE_BOOL(layout.tools_hidden);
 	WRITE_BOOL(layout.tools_restore_state);
@@ -733,13 +737,18 @@
 		READ_INT(layout.main_window.w);
 		READ_INT(layout.main_window.h);
 		READ_BOOL(layout.main_window.maximized);
+		READ_INT(layout.main_window.hdivider_pos);
+		READ_INT(layout.main_window.vdivider_pos);
+
 		READ_INT(layout.float_window.x);
 		READ_INT(layout.float_window.y);
 		READ_INT(layout.float_window.w);
 		READ_INT(layout.float_window.h);
 		READ_INT(layout.float_window.vdivider_pos);
-		READ_INT(layout.main_window.hdivider_pos);
-		READ_INT(layout.main_window.vdivider_pos);
+	
+		READ_INT(layout.properties_window.w);
+		READ_INT(layout.properties_window.h);
+
 		READ_BOOL(layout.tools_float);
 		READ_BOOL(layout.tools_hidden);
 		READ_BOOL(layout.tools_restore_state);