? shell/gpdf-prefs.c
? shell/gpdf-prefs.h
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gpdf/ChangeLog,v
retrieving revision 1.400
diff -u -r1.400 ChangeLog
--- ChangeLog	2 Aug 2004 22:46:16 -0000	1.400
+++ ChangeLog	3 Aug 2004 21:17:39 -0000
@@ -1,3 +1,14 @@
+2004-08-03  Vincent Noel  <vnoel@cox.net>
+
+	* shell/gpdf.c (main): Load preferences. Set the window default
+	size from saved values.
+	(gpdf_window_close): Save preferred window size if the window is
+	the last one.
+
+	* shell/gpdf-prefs.h: new file.
+	* shell/gpdf-prefs.c: new file. Stores and reads the preferences
+	from gconf. Only the window size is implemented right now.
+
 2004-08-02  Martin Kretzschmar  <m_kretzschmar@gmx.net>
 
 	* configure.in, NEWS: Version 2.7.90.
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/gpdf/shell/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- shell/Makefile.am	20 Jan 2004 22:38:36 -0000	1.12
+++ shell/Makefile.am	3 Aug 2004 21:17:42 -0000
@@ -31,6 +31,8 @@
 	gpdf-uri-input.h		\
 	gpdf-recent-facade.c		\
 	gpdf-recent-facade.h		\
+	gpdf-prefs.c			\
+	gpdf-prefs.h			\
 	gpdf-recent-view-toolitem.c	\
 	gpdf-recent-view-toolitem.h	\
 	mock-recent-facade.c
@@ -38,4 +40,4 @@
 uidir = $(datadir)/gnome-2.0/ui
 ui_DATA = gpdf-window-ui.xml
 
-EXTRA_DIST = $(ui_DATA)
\ No newline at end of file
+EXTRA_DIST = $(ui_DATA)
Index: shell/gpdf.c
===================================================================
RCS file: /cvs/gnome/gpdf/shell/gpdf.c,v
retrieving revision 1.125
diff -u -r1.125 gpdf.c
--- shell/gpdf.c	2 Aug 2004 16:40:55 -0000	1.125
+++ shell/gpdf.c	3 Aug 2004 21:17:42 -0000
@@ -8,6 +8,7 @@
 #include <aconf.h>
 #include "gpdf-window.h"
 #include "gpdf-uri-input.h"
+#include "gpdf-prefs.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -126,6 +127,7 @@
 	GnomeClient *client;
 	GValue value = { 0 };
 	poptContext ctx;
+	GtkWidget *gpdf_window;
 
 #ifdef ENABLE_NLS
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -153,6 +155,8 @@
 
 	g_idle_add (handle_cmdline_args, ctx);
 
+	gpdf_prefs_load();
+
 	uri_in = g_object_new (GPDF_TYPE_URI_INPUT, NULL);
 	recent_facade = g_object_new (GPDF_TYPE_RECENT_FACADE, NULL);
 	gpdf_uri_input_set_recent_facade (uri_in, recent_facade);
@@ -160,8 +164,11 @@
 			       G_CALLBACK (open_request_logger), NULL));
 	g_signal_connect (G_OBJECT (uri_in), "open_request",
 			  G_CALLBACK (open_request_handler), NULL);
-	gtk_widget_show (gpdf_window_new ());
-
+	gpdf_window = gpdf_window_new ();
+	gtk_window_set_default_size (GTK_WINDOW(gpdf_window), gpdf_default_width, gpdf_default_height);
+	gtk_window_set_resizable (GTK_WINDOW(gpdf_window), TRUE);
+	gtk_widget_show (gpdf_window);
+	
 	bonobo_main ();
 
 	return 0;
@@ -366,6 +373,7 @@
 void
 gpdf_window_close (GPdfWindow *gpdf_window)
 {
+	gint w, h;
 	g_return_if_fail (GPDF_IS_NON_NULL_WINDOW (gpdf_window));
 
 	bonobo_control_frame_set_autoactivate
@@ -373,10 +381,24 @@
 	   FALSE);
 	bonobo_control_frame_control_deactivate
 	  (bonobo_widget_get_control_frame (gpdf_window->priv->bonobo_widget));
+	gtk_window_get_size (GTK_WINDOW(gpdf_window), &w, &h);
 	gtk_widget_destroy (GTK_WIDGET (gpdf_window));
 
 	if (window_list == NULL)
-		bonobo_main_quit ();
+		{
+			if (w > 1 && h > 1) 
+				{
+					GConfClient *gconf_client = gpdf_prefs_gconf_client();
+					gpdf_default_width = w;
+					gpdf_default_height = h;
+					gconf_client_set_int(gconf_client, "/apps/gpdf/layout/windowwidth",
+							     gpdf_default_width, NULL);
+					gconf_client_set_int(gconf_client, "/apps/gpdf/layout/windowheight",
+							     gpdf_default_height, NULL);
+				}
+
+			bonobo_main_quit ();
+		}
 }
 
 static void
