Index: data/evince.schemas.in
===================================================================
RCS file: /cvs/gnome/evince/data/evince.schemas.in,v
retrieving revision 1.6
diff -u -p -r1.6 evince.schemas.in
--- data/evince.schemas.in	22 Apr 2005 17:15:21 -0000	1.6
+++ data/evince.schemas.in	27 Jul 2005 04:19:28 -0000
@@ -1,48 +1,4 @@
 <gconfschemafile>
   <schemalist>
-    <schema>
-      <key>/schemas/apps/evince/show_toolbar</key>
-      <applyto>/apps/evince/show_toolbar</applyto>
-      <owner>evince</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show toolbar by default</short>
-        <long>Toolbar is the top bar that contains navigation and zoom controls.  Two boolean options, true makes toolbar visible by default while false makes toolbar not visible by default.</long>
-      </locale>
-    </schema>
-    <schema>
-      <key>/schemas/apps/evince/show_sidebar</key>
-      <applyto>/apps/evince/show_sidebar</applyto>
-      <owner>evince</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show sidebar by default</short>
-        <long>Sidebar is the side item that contains the Index and Thumbnail lists.  Two boolean options, true makes sidebar visible by default while false makes sidebar not visible by default </long>
-      </locale>
-    </schema>
-    <schema>
-      <key>/schemas/apps/evince/show_statusbar</key>
-      <applyto>/apps/evince/show_statusbar</applyto>
-      <owner>evince</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show statusbar by default</short>
-        <long>Statusbar is the standard bottom bar that display additional information about links and other actions.  Two boolean options, true makes the statusbar visible by default while false makes sidebar not visible by default.</long>
-      </locale>
-    </schema>
-    <schema>
-      <key>/schemas/apps/evince/sidebar_size</key>
-      <applyto>/apps/evince/sidebar_size</applyto>
-      <owner>evince</owner>
-      <type>int</type>
-      <default>132</default>
-      <locale name="C">
-        <short>Default sidebar size</short>
-        <long>Sidebar is the side item that contains the Index and Thumbnail lists.  The default size sets the sidebar's width in pixels based from the side of the window.  Any integer will be accepted.  The sidebar will never shrink smaller than the size of the text required to display Thumbnails or Index.  Large values will cause the sidebar to take up as much of the page display area as possible relative to the window's size.</long>
-      </locale>
-    </schema>
   </schemalist>
 </gconfschemafile>
Index: shell/ev-window.c
===================================================================
RCS file: /cvs/gnome/evince/shell/ev-window.c,v
retrieving revision 1.198
diff -u -p -r1.198 ev-window.c
--- shell/ev-window.c	25 Jul 2005 20:25:15 -0000	1.198
+++ shell/ev-window.c	27 Jul 2005 04:19:28 -0000
@@ -146,15 +146,6 @@ static const GtkTargetEntry ev_drop_type
 #define EV_WINDOW_GET_PRIVATE(object) \
 	(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
 
-#define PAGE_SELECTOR_ACTION	"PageSelector"
-#define ZOOM_CONTROL_ACTION	"ViewZoom"
-
-#define GCONF_CHROME_TOOLBAR	"/apps/evince/show_toolbar"
-#define GCONF_CHROME_SIDEBAR	"/apps/evince/show_sidebar"
-#define GCONF_CHROME_STATUSBAR	"/apps/evince/show_statusbar"
-
-#define GCONF_SIDEBAR_SIZE      "/apps/evince/sidebar_size"
-
 #define SIDEBAR_DEFAULT_SIZE    132
 
 static void     ev_window_update_fullscreen_popup       (EvWindow         *window);
@@ -184,6 +175,7 @@ static void     ev_window_stop_presentat
 static void     ev_window_cmd_view_presentation         (GtkAction        *action,
 							 EvWindow         *window);
 static void     show_fullscreen_popup                   (EvWindow         *window);
+static void	set_chrome_actions 			(EvWindow *window);
 
 
 G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
@@ -284,8 +276,8 @@ update_action_sensitivity (EvWindow *ev_
 	}
 
 	/* Toolbar-specific actions: */
-	set_action_sensitive (ev_window, PAGE_SELECTOR_ACTION, has_pages);
-	set_action_sensitive (ev_window, ZOOM_CONTROL_ACTION,  has_pages);
+	set_action_sensitive (ev_window, "PageSelector", has_pages);
+	set_action_sensitive (ev_window, "ViewZoom",  has_pages);
 
 	if (has_pages && ev_view_get_sizing_mode (view) == EV_SIZING_FREE) {
 		GtkAction *action;
@@ -293,7 +285,7 @@ update_action_sensitivity (EvWindow *ev_
 		float      real_zoom;
 
 		action = gtk_action_group_get_action (ev_window->priv->action_group, 
-						      ZOOM_CONTROL_ACTION);
+						      "ViewZoom");
 
 		real_zoom = ev_view_get_zoom (EV_VIEW (ev_window->priv->view));
 		zoom = ephy_zoom_get_nearest_zoom_level (real_zoom);
@@ -356,7 +348,6 @@ static void
 update_chrome_flag (EvWindow *window, EvChrome flag, const char *pref, gboolean active)
 {
 	EvWindowPrivate *priv = window->priv;
-	GConfClient *client;
 	
 	if (active) {
 		priv->chrome |= flag;
@@ -365,10 +356,8 @@ update_chrome_flag (EvWindow *window, Ev
 		priv->chrome &= ~flag;
 	}
 
-	if (pref != NULL) {
-		client = gconf_client_get_default ();
-		gconf_client_set_bool (client, pref, active, NULL);
-		g_object_unref (client);
+	if (pref != NULL && window->priv->uri) {
+          	ev_metadata_manager_set_boolean (window->priv->uri, pref, active);
 	}
 
 	update_chrome_visibility (window);
@@ -383,7 +372,7 @@ ev_window_cmd_focus_page_selector (GtkAc
 	set_action_sensitive (window, "ViewToolbar", FALSE);
 	
 	action = gtk_action_group_get_action (window->priv->action_group,
-				     	      PAGE_SELECTOR_ACTION);
+				     	      "PageSelector");
 	ev_page_action_grab_focus (EV_PAGE_ACTION (action));
 }
 
@@ -496,7 +485,7 @@ update_sizing_buttons (EvWindow *window)
 		(action, G_CALLBACK (ev_window_cmd_view_page_width), window);
 
 	action = gtk_action_group_get_action (window->priv->action_group, 
-					      ZOOM_CONTROL_ACTION);	
+					      "ViewZoom");	
 	if (best_fit) {
 		ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), 
 						 EPHY_ZOOM_BEST_FIT);
@@ -675,7 +662,7 @@ ev_window_setup_document (EvWindow *ev_w
 	}
 
 	update_window_title (document, NULL, ev_window);
-	action = gtk_action_group_get_action (ev_window->priv->action_group, PAGE_SELECTOR_ACTION);
+	action = gtk_action_group_get_action (ev_window->priv->action_group, "PageSelector");
 	ev_page_action_set_document (EV_PAGE_ACTION (action), document);
 	update_action_sensitivity (ev_window);
 
@@ -941,6 +928,10 @@ setup_view_from_metadata (EvWindow *wind
 	GValue dual_page = { 0, };
 	GValue presentation = { 0, };
 	GValue fullscreen = { 0, };
+	GValue show_toolbar = { 0, };
+	GValue show_statusbar = { 0, };
+	GValue show_sidebar = { 0, };
+	GValue sidebar_size = { 0, };
 
 	/* Window size */
 	if (!GTK_WIDGET_VISIBLE (window)) {
@@ -1003,6 +994,36 @@ setup_view_from_metadata (EvWindow *wind
 			ev_window_run_fullscreen (window);
 		}
 	}
+
+	/* Toolbar visibility */
+	if (ev_metadata_manager_get (uri, "show_toolbar", &show_toolbar)) {
+		if (!g_value_get_boolean (&show_toolbar)) {
+			window->priv->chrome &= ~EV_CHROME_TOOLBAR;
+		}
+	}
+
+	/* Sidebar visibility */
+	if (ev_metadata_manager_get (uri, "show_sidebar", &show_sidebar)) {
+		if (!g_value_get_boolean (&show_sidebar)) {
+			window->priv->chrome &= ~EV_CHROME_SIDEBAR;
+		}
+	}
+
+	/* Statusbar visibility */
+	if (ev_metadata_manager_get (uri, "show_statusbar", &show_statusbar)) {
+		if (!g_value_get_boolean (&show_statusbar)) {
+			window->priv->chrome &= ~EV_CHROME_STATUSBAR;
+		}
+	}
+
+	/* Sidebar size */
+	if (ev_metadata_manager_get (uri, "sidebar_size", &sidebar_size)) {
+		gtk_paned_set_position (GTK_PANED (window->priv->hpaned), 
+					g_value_get_int (&sidebar_size));
+	}
+	
+	update_chrome_visibility (window);
+	set_chrome_actions (window);
 }
 
 void
@@ -1550,14 +1571,13 @@ static void
 ev_window_sidebar_position_change_cb (GObject *object, GParamSpec *pspec,
 				      EvWindow *ev_window)
 {
-	GConfClient *client;
 	int sidebar_size;
-
+	
+	if (!ev_window->priv->uri)
+		return;
+    
 	sidebar_size = gtk_paned_get_position (GTK_PANED (object));
-
-	client = gconf_client_get_default ();
-	gconf_client_set_int (client, GCONF_SIDEBAR_SIZE, sidebar_size, NULL);
-	g_object_unref (client);
+	ev_metadata_manager_set_int (ev_window->priv->uri, "sidebar_size", sidebar_size);
 }
 
 static void
@@ -2414,7 +2434,7 @@ static void
 ev_window_view_toolbar_cb (GtkAction *action, EvWindow *ev_window)
 {
 	update_chrome_flag (ev_window, EV_CHROME_TOOLBAR,
-			    GCONF_CHROME_TOOLBAR,
+			    "show_toolbar",
 			    gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
@@ -2422,7 +2442,7 @@ static void
 ev_window_view_statusbar_cb (GtkAction *action, EvWindow *ev_window)
 {
 	update_chrome_flag (ev_window, EV_CHROME_STATUSBAR,
-			    GCONF_CHROME_STATUSBAR,
+			    "show_statusbar",
 			    gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
@@ -2430,7 +2450,7 @@ static void
 ev_window_view_sidebar_cb (GtkAction *action, EvWindow *ev_window)
 {
 	update_chrome_flag (ev_window, EV_CHROME_SIDEBAR,
-			    GCONF_CHROME_SIDEBAR,
+			    "show_sidebar",
 			    gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
@@ -2462,7 +2482,7 @@ ev_window_sidebar_visibility_changed_cb 
 		(action, G_CALLBACK (ev_window_view_sidebar_cb), ev_window);
 
 	update_chrome_flag (ev_window, EV_CHROME_SIDEBAR,
-			    GCONF_CHROME_SIDEBAR, visible);
+			    "show_sidebar", visible);
 }
 
 static void
@@ -2967,7 +2987,7 @@ register_custom_actions (EvWindow *windo
 	GtkAction *action;
 
 	action = g_object_new (EV_TYPE_PAGE_ACTION,
-			       "name", PAGE_SELECTOR_ACTION,
+			       "name", "PageSelector",
 			       "label", _("Page"),
 			       "tooltip", _("Select Page"),
 			       "visible_overflown", FALSE,
@@ -2980,7 +3000,7 @@ register_custom_actions (EvWindow *windo
 	g_object_unref (action);
 
 	action = g_object_new (EPHY_TYPE_ZOOM_ACTION,
-			       "name", ZOOM_CONTROL_ACTION,
+			       "name", "ViewZoom",
 			       "label", _("Zoom"),
 			       "stock_id", GTK_STOCK_ZOOM_IN,
 			       "tooltip", _("Adjust the zoom level"),
@@ -3063,44 +3083,6 @@ set_chrome_actions (EvWindow *window)
 		(action, G_CALLBACK (ev_window_view_statusbar_cb), window);
 }
 
-static EvChrome
-load_chrome (void)
-{
-	EvChrome chrome = EV_CHROME_NORMAL;
-	GConfClient *client;
-	GConfValue *value;
-
-	client = gconf_client_get_default ();
-
-	value = gconf_client_get (client, GCONF_CHROME_TOOLBAR, NULL);
-	if (value != NULL) {
-		if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
-			chrome &= ~EV_CHROME_TOOLBAR;
-		}
-		gconf_value_free (value);
-	}
-
-	value = gconf_client_get (client, GCONF_CHROME_SIDEBAR, NULL);
-	if (value != NULL) {
-		if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
-			chrome &= ~EV_CHROME_SIDEBAR;
-		}
-		gconf_value_free (value);
-	}
-
-	value = gconf_client_get (client, GCONF_CHROME_STATUSBAR, NULL);
-	if (value != NULL) {
-		if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
-			chrome &= ~EV_CHROME_STATUSBAR;
-		}
-		gconf_value_free (value);
-	}
-
-	g_object_unref (client);
-
-	return chrome;
-}
-
 static void
 sidebar_widget_model_set (EvSidebarLinks *ev_sidebar_links,
 			  GParamSpec     *pspec,
@@ -3113,7 +3095,7 @@ sidebar_widget_model_set (EvSidebarLinks
 		      "model", &model,
 		      NULL);
 
-	action = gtk_action_group_get_action (ev_window->priv->action_group, PAGE_SELECTOR_ACTION);
+	action = gtk_action_group_get_action (ev_window->priv->action_group, "PageSelector");
 	ev_page_action_set_model (EV_PAGE_ACTION (action), model);
 	g_object_unref (model);
 }
@@ -3220,9 +3202,6 @@ ev_window_init (EvWindow *ev_window)
 	GtkAccelGroup *accel_group;
 	GError *error = NULL;
 	GtkWidget *sidebar_widget, *toolbar_dock;
-	GConfValue *value;
-	GConfClient *client;
-	int sidebar_size;
 
 	g_signal_connect (ev_window, "configure_event",
 			  G_CALLBACK (window_configure_event_cb), NULL);
@@ -3301,18 +3280,8 @@ ev_window_init (EvWindow *ev_window)
 			  "notify::position",
 			  G_CALLBACK (ev_window_sidebar_position_change_cb),
 			  ev_window);
-	
-	sidebar_size = SIDEBAR_DEFAULT_SIZE;
-	client = gconf_client_get_default ();
-	value = gconf_client_get (client, GCONF_SIDEBAR_SIZE, NULL);
-	if (value != NULL) {
-		if (value->type == GCONF_VALUE_INT) {
-			sidebar_size = gconf_value_get_int (value);
-		}
-		gconf_value_free (value);
-	}
-	g_object_unref (client);
-	gtk_paned_set_position (GTK_PANED (ev_window->priv->hpaned), sidebar_size);
+
+	gtk_paned_set_position (GTK_PANED (ev_window->priv->hpaned), SIDEBAR_DEFAULT_SIZE);
 	gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), ev_window->priv->hpaned,
 			    TRUE, TRUE, 0);
 	gtk_widget_show (ev_window->priv->hpaned);
@@ -3414,7 +3383,7 @@ ev_window_init (EvWindow *ev_window)
 			  FALSE, TRUE, 0);
 
 	ev_window_setup_recent (ev_window);
-	ev_window->priv->chrome = load_chrome ();
+	ev_window->priv->chrome = EV_CHROME_NORMAL;
 	set_chrome_actions (ev_window);
 	update_chrome_visibility (ev_window);
 
