? epiphany-lockdown.patch
Index: data/epiphany-lockdown.schemas.in
===================================================================
RCS file: /cvs/gnome/epiphany/data/epiphany-lockdown.schemas.in,v
retrieving revision 1.6
diff -u -p -r1.6 epiphany-lockdown.schemas.in
--- data/epiphany-lockdown.schemas.in	22 Jan 2004 18:53:32 -0000	1.6
+++ data/epiphany-lockdown.schemas.in	22 Jan 2004 20:49:55 -0000
@@ -91,5 +91,38 @@
         <long>Disable all historical information by disabling the back button, not allowing the history dialog and hiding the most used bookmarks list.</long>
         </locale>
       </schema>
+      <schema>
+        <key>/schemas/apps/epiphany/lockdown/disable_quit</key>
+        <applyto>/apps/epiphany/lockdown/disable_quit</applyto>
+        <owner>epiphany</owner>
+        <type>bool</type>
+        <default>0</default>
+        <locale name="C">
+        <short>Disable Quit</short>
+        <long>Makes it so the first window opened can't be closed.</long>
+        </locale>
+      </schema>
+      <schema>
+        <key>/schemas/apps/epiphany/lockdown/first_window_fullscreen</key>
+        <applyto>/apps/epiphany/lockdown/first_window_fullscreen</applyto>
+        <owner>epiphany</owner>
+        <type>bool</type>
+        <default>0</default>
+        <locale name="C">
+        <short>Makes The first window be fullscreen</short>
+        <long>Makes it so the first window opened is fullscreen.  If this window is closed, the earliest window to be opened will become fullscreen.</long>
+        </locale>
+      </schema>
+      <schema>
+        <key>/schemas/apps/epiphany/lockdown/disable_new_window</key>
+        <applyto>/apps/epiphany/lockdown/disable_new_window</applyto>
+        <owner>epiphany</owner>
+        <type>bool</type>
+        <default>0</default>
+        <locale name="C">
+        <short>Disable New Window</short>
+        <long>Makes it so no new windows can be opened, either by the New Window command or by javascript (popups will show up in tabs.)  You can still open a new window using the command line.</long>
+        </locale>
+      </schema>
     </schemalist>
 </gconfschemafile>
Index: lib/ephy-prefs.h
===================================================================
RCS file: /cvs/gnome/epiphany/lib/ephy-prefs.h,v
retrieving revision 1.27
diff -u -p -r1.27 ephy-prefs.h
--- lib/ephy-prefs.h	19 Jan 2004 00:11:34 -0000	1.27
+++ lib/ephy-prefs.h	22 Jan 2004 20:49:55 -0000
@@ -48,8 +48,11 @@ G_BEGIN_DECLS
 #define CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING  "/apps/epiphany/lockdown/disable_bookmark_editing"
 #define CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING	"/apps/epiphany/lockdown/disable_toolbar_editing"
 #define CONF_LOCKDOWN_DISABLE_HISTORY		"/apps/epiphany/lockdown/disable_history"
+#define CONF_LOCKDOWN_DISABLE_QUIT		"/apps/epiphany/lockdown/disable_quit"
+#define CONF_LOCKDOWN_FIRST_WINDOW_FULLSCREEN	"/apps/epiphany/lockdown/first_window_fullscreen"
+#define CONF_LOCKDOWN_DISABLE_NEW_WINDOW	"/apps/epiphany/lockdown/disable_new_window"
+
 #define CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK	"/desktop/gnome/lockdown/disable_save_to_disk"
-#define CONF_LOCKDOWN_DISABLE_HISTORY		"/apps/epiphany/lockdown/disable_history"
 #define CONF_LOCKDOWN_DISABLE_PRINTING		"/desktop/gnome/lockdown/disable_printing"
 #define CONF_LOCKDOWN_DISABLE_PRINT_SETUP	"/desktop/gnome/lockdown/disable_print_setup"
 #define CONF_LOCKDOWN_DISABLE_COMMAND_LINE	"/desktop/gnome/lockdown/disable_command_line"
Index: src/ephy-session.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-session.c,v
retrieving revision 1.7
diff -u -p -r1.7 ephy-session.c
--- src/ephy-session.c	10 Jan 2004 15:35:19 -0000	1.7
+++ src/ephy-session.c	22 Jan 2004 20:49:55 -0000
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  *  Copyright (C) 2002 Jorn Baayen
  *  Copyright (C) 2003 Marco Pesenti Gritti
@@ -54,6 +55,7 @@
 struct EphySessionPrivate
 {
 	GList *windows;
+	gboolean first_window_set;
 };
 
 #define BOOKMARKS_EDITOR_ID	"BookmarksEditor"
@@ -185,6 +187,12 @@ impl_attach_window (EphyExtension *exten
 
 	LOG ("impl_attach_window")
 
+	if (! session->priv->first_window_set)
+	{
+		g_object_set (G_OBJECT(window), "is-first-window", TRUE, NULL);
+		session->priv->first_window_set = TRUE;
+	}
+
 	session->priv->windows = g_list_prepend (session->priv->windows, window);
 	ephy_session_save (session, SESSION_CRASHED);
 
@@ -202,9 +210,36 @@ impl_detach_window (EphyExtension *exten
 		    EphyWindow *window)
 {
 	EphySession *session = EPHY_SESSION (extension);
+	gboolean is_first_window;
 
 	LOG ("impl_detach_window")
 
+	g_object_get (G_OBJECT(window), "is-first-window", &is_first_window, NULL);
+	if (is_first_window)
+	{
+		EphyWindow *first_window = NULL;
+		GList *window_search;
+		for (window_search = session->priv->windows; window_search; window_search = window_search->next)
+		{
+			if (window_search->data != window && EPHY_IS_WINDOW (window_search->data))
+			{
+				first_window = window_search->data;
+			}
+		}
+		if (first_window)
+		{
+			g_object_set (G_OBJECT (first_window), "is-first-window", TRUE, NULL);
+		}
+		else
+		{
+			session->priv->first_window_set = FALSE;
+		}
+	}
+	if (! session->priv->first_window_set)
+	{
+		session->priv->first_window_set = TRUE;
+	}
+
 	session->priv->windows = g_list_remove (session->priv->windows, window);
 	ephy_session_save (session, SESSION_CRASHED);
 
@@ -238,6 +273,7 @@ ephy_session_init (EphySession *session)
 	LOG ("EphySession initialising")
 
 	session->priv->windows = NULL;
+	session->priv->first_window_set = FALSE;
 
 	ensure_session_directory ();
 }
Index: src/ephy-tab.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-tab.c,v
retrieving revision 1.82
diff -u -p -r1.82 ephy-tab.c
--- src/ephy-tab.c	21 Jan 2004 14:01:43 -0000	1.82
+++ src/ephy-tab.c	22 Jan 2004 20:49:55 -0000
@@ -880,8 +880,15 @@ ephy_tab_new_window_cb (EphyEmbed *embed
 	EphyTab *new_tab;
 	EphyWindow *window;
 
-	window = ephy_window_new ();
-	ephy_window_request_chrome (window, chromemask);
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_NEW_WINDOW))
+	{
+		window = ephy_tab_get_window (tab);
+	}
+	else
+	{
+		window = ephy_window_new ();
+		ephy_window_request_chrome (window, chromemask);
+	}
 
 	new_tab = ephy_tab_new ();
         ephy_window_add_tab (window, new_tab, EPHY_NOTEBOOK_INSERT_GROUPED, FALSE);
Index: src/ephy-window.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-window.c,v
retrieving revision 1.165
diff -u -p -r1.165 ephy-window.c
--- src/ephy-window.c	21 Jan 2004 23:39:43 -0000	1.165
+++ src/ephy-window.c	22 Jan 2004 20:49:55 -0000
@@ -323,9 +323,12 @@ struct EphyWindowPrivate
 	EmbedChromeMask requested_chrome_mask;
 	EmbedChromeMask actual_chrome_mask;
 	gboolean closing;
+	gboolean fullscreen_requested;
+	gboolean fullscreen_tried;
 	gboolean is_fullscreen;
 	gboolean is_ppview;
 	gboolean has_size;
+	gboolean is_first_window;
 	guint num_tabs;
 	guint tab_message_cid;
 	guint help_message_cid;
@@ -339,6 +342,9 @@ struct EphyWindowPrivate
 	guint disable_bookmark_editing_notifier_id;
 	guint disable_toolbar_editing_notifier_id;
 	guint disable_history_notifier_id;
+	guint disable_quit_notifier_id;
+	guint first_window_fullscreen_notifier_id;
+	guint disable_new_window_notifier_id;
 	guint disable_printing_notifier_id;
 	guint disable_print_setup_notifier_id;
 	guint disable_save_to_disk_notifier_id;
@@ -349,7 +355,8 @@ struct EphyWindowPrivate
 enum
 {
 	PROP_0,
-	PROP_ACTIVE_TAB
+	PROP_ACTIVE_TAB,
+	PROP_IS_FIRST_WINDOW
 };
 
 static GObjectClass *parent_class = NULL;
@@ -431,39 +438,6 @@ add_widget (GtkUIManager *merge, GtkWidg
 }
 
 static void
-update_exit_fullscreen_popup_position (EphyWindow *window)
-{
-	GdkRectangle screen_rect;
-	int popup_height;
-
-	g_return_if_fail (window->priv->exit_fullscreen_popup != NULL);
-
-	gtk_window_get_size (GTK_WINDOW (window->priv->exit_fullscreen_popup),
-                             NULL, &popup_height);
-
-	gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
-                        gdk_screen_get_monitor_at_window
-                        (gdk_screen_get_default (),
-                         GTK_WIDGET (window)->window),
-                         &screen_rect);
-
-	gtk_window_move (GTK_WINDOW (window->priv->exit_fullscreen_popup),
-                        screen_rect.x, screen_rect.height - popup_height);
-}
-
-static void
-size_changed_cb (GdkScreen *screen, EphyWindow *window)
-{
-	update_exit_fullscreen_popup_position (window);
-}
-
-static void
-exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
-{
-	gtk_window_unfullscreen (GTK_WINDOW (window));
-}
-
-static void
 update_chromes_visibility (EphyWindow *window)
 {
 	GtkWidget *menubar;
@@ -571,42 +545,153 @@ update_chrome(EphyWindow *window)
 }
 
 static void
-ephy_window_fullscreen (EphyWindow *window)
+update_exit_fullscreen_popup_position (EphyWindow *window)
 {
-	GtkWidget *popup, *button, *icon, *label, *hbox;
+	GdkRectangle screen_rect;
+	int popup_height;
 
-	window->priv->is_fullscreen = TRUE;
+	g_return_if_fail (window->priv->exit_fullscreen_popup != NULL);
 
-	popup = gtk_window_new (GTK_WINDOW_POPUP);
-	window->priv->exit_fullscreen_popup = popup;
+	gtk_window_get_size (GTK_WINDOW (window->priv->exit_fullscreen_popup),
+			NULL, &popup_height);
 
-	button = gtk_button_new ();
-	g_signal_connect (button, "clicked",
-			  G_CALLBACK (exit_fullscreen_button_clicked_cb),
-			  window);
-	gtk_widget_show (button);
-	gtk_container_add (GTK_CONTAINER (popup), button);
+	gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
+                        gdk_screen_get_monitor_at_window
+                        (gdk_screen_get_default (),
+                         GTK_WIDGET (window)->window),
+                         &screen_rect);
 
-	hbox = gtk_hbox_new (FALSE, 2);
-	gtk_widget_show (hbox);
-	gtk_container_add (GTK_CONTAINER (button), hbox);
+	gtk_window_move (GTK_WINDOW (window->priv->exit_fullscreen_popup),
+        	        screen_rect.x, screen_rect.height - popup_height);
+}
 
-	icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
-	gtk_widget_show (icon);
-	gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+static void
+size_changed_cb (GdkScreen *screen, EphyWindow *window)
+{
+	update_exit_fullscreen_popup_position (window);
+}
 
-	label = gtk_label_new (_("Exit Fullscreen"));
-	gtk_widget_show (label);
-	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+static void
+exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
+{
+	ephy_window_request_unfullscreen (window);
+}
 
-	update_exit_fullscreen_popup_position (window);
+static void
+update_exit_fullscreen_popup (EphyWindow *window)
+{
+	gboolean show_popup;
 
-	gtk_widget_show (popup);
+	show_popup = window->priv->is_fullscreen && !eel_gconf_get_boolean (CONF_LOCKDOWN_FIRST_WINDOW_FULLSCREEN);
 
-	g_signal_connect (G_OBJECT (gdk_screen_get_default ()),
-                          "size-changed", G_CALLBACK (size_changed_cb),
-			  window);
+	if (window->priv->exit_fullscreen_popup == NULL && show_popup)
+	{
+		GtkWidget *popup, *button, *icon, *label, *hbox;
+
+		popup = gtk_window_new (GTK_WINDOW_POPUP);
+		window->priv->exit_fullscreen_popup = popup;
+
+		button = gtk_button_new ();
+		g_signal_connect (button, "clicked",
+				  G_CALLBACK (exit_fullscreen_button_clicked_cb),
+				  window);
+		gtk_widget_show (button);
+		gtk_container_add (GTK_CONTAINER (popup), button);
+
+		hbox = gtk_hbox_new (FALSE, 2);
+		gtk_widget_show (hbox);
+		gtk_container_add (GTK_CONTAINER (button), hbox);
+
+		icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
+		gtk_widget_show (icon);
+		gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
+
+		label = gtk_label_new (_("Exit Fullscreen"));
+		gtk_widget_show (label);
+		gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+		update_exit_fullscreen_popup_position (window);
+
+		gtk_widget_show (popup);
+
+		g_signal_connect (G_OBJECT (gdk_screen_get_default ()),
+				  "size-changed", G_CALLBACK (size_changed_cb),
+				  window);
+	}
+	else if (window->priv->exit_fullscreen_popup != NULL && !show_popup)
+	{
+		g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()),
+						      G_CALLBACK (size_changed_cb),
+						      window);
 
+		gtk_widget_destroy (window->priv->exit_fullscreen_popup);
+		window->priv->exit_fullscreen_popup = NULL;
+	}
+}
+
+static void
+update_fullscreen (EphyWindow *window)
+{
+	gboolean default_chrome;
+	gboolean fullscreen_needed;
+	GtkAction *action;
+
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME))
+	{
+		default_chrome = TRUE;
+	}
+	else
+	{
+		default_chrome = (window->priv->requested_chrome_mask & EMBED_CHROME_BOOKMARKSBAR_DEFAULT) ||
+			(window->priv->requested_chrome_mask & EMBED_CHROME_DEFAULT);
+	}
+
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_FIRST_WINDOW_FULLSCREEN))
+	{
+		fullscreen_needed = window->priv->is_first_window;
+	}
+	else
+	{
+		fullscreen_needed = window->priv->fullscreen_requested;
+	}
+
+	if (fullscreen_needed != window->priv->fullscreen_tried)
+	{
+		if (fullscreen_needed)
+		{
+			gtk_window_fullscreen (GTK_WINDOW (window));
+		}
+		else
+		{
+			gtk_window_unfullscreen (GTK_WINDOW (window));
+		}
+		window->priv->fullscreen_tried = fullscreen_needed;
+	}
+
+	action = gtk_action_group_get_action (window->priv->action_group, "ViewFullscreen");
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), window->priv->fullscreen_requested);
+}
+
+void
+ephy_window_request_fullscreen (EphyWindow *window)
+{
+	window->priv->fullscreen_requested = TRUE;
+	update_fullscreen (window);
+}
+
+void
+ephy_window_request_unfullscreen (EphyWindow *window)
+{
+	window->priv->fullscreen_requested = FALSE;
+	update_fullscreen (window);
+}
+
+static void
+ephy_window_fullscreen (EphyWindow *window)
+{
+	window->priv->is_fullscreen = TRUE;
+
+	update_exit_fullscreen_popup (window);
 	update_chromes_visibility (window);
 }
 
@@ -615,13 +700,7 @@ ephy_window_unfullscreen (EphyWindow *wi
 {
 	window->priv->is_fullscreen = FALSE;
 
-	g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()),
-                                              G_CALLBACK (size_changed_cb),
-					      window);
-
-	gtk_widget_destroy (window->priv->exit_fullscreen_popup);
-	window->priv->exit_fullscreen_popup = NULL;
-
+	update_exit_fullscreen_popup (window);
 	update_chromes_visibility (window);
 }
 
@@ -647,9 +726,6 @@ ephy_window_state_event_cb (GtkWidget *w
 
 		action_group = window->priv->action_group;
 
-		action = gtk_action_group_get_action (action_group, "ViewFullscreen");
-		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
-
 		action = gtk_action_group_get_action (action_group, "EditToolbar");
 		g_object_set (action, "sensitive", !fullscreen, NULL);
 	}
@@ -718,6 +794,10 @@ ephy_window_delete_event_cb (GtkWidget *
 	GList *tabs, *l;
 	gboolean modified = FALSE;
 
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) &&
+	    window->priv->is_first_window)
+		return TRUE;
+
 	tabs = ephy_window_get_tabs (window);
 	for (l = tabs; l != NULL; l = l->next)
 	{
@@ -1545,6 +1625,19 @@ ephy_window_set_active_tab (EphyWindow *
 	}
 }
 
+static gboolean
+window_can_close (EphyWindow *window)
+{
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) &&
+	    window->priv->is_first_window)
+	{
+		int num = gtk_notebook_get_n_pages (window->priv->notebook);
+		if (num <= 1)
+			return FALSE;
+	}
+	return TRUE;
+}
+
 static void
 update_tabs_menu_sensitivity (EphyWindow *window)
 {
@@ -1574,6 +1667,8 @@ update_tabs_menu_sensitivity (EphyWindow
 	g_object_set (action, "sensitive", move_right, NULL);
 	action = gtk_action_group_get_action (action_group, "TabsDetach");
 	g_object_set (action, "sensitive", detach, NULL);
+	action = gtk_action_group_get_action (action_group, "FileCloseWindow");
+	g_object_set (action, "sensitive", window_can_close(window), NULL);
 }
 
 static void
@@ -1645,6 +1740,11 @@ tab_delete_cb (EphyNotebook *notebook, G
 {
 	g_return_val_if_fail (EPHY_IS_EMBED (child), FALSE);
 
+	if (!window_can_close (window))
+	{
+		return TRUE;
+	}
+
 	if (ephy_embed_has_modified_forms (EPHY_EMBED (child)))
 	{
 		return !confirm_close_with_modified_forms (window);
@@ -1683,6 +1783,82 @@ setup_notebook (EphyWindow *window)
 }
 
 static void
+update_actions (EphyWindow *window)
+{
+	GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group);
+	GtkActionGroup *popups_action_group = GTK_ACTION_GROUP (window->priv->popups_action_group);
+	GtkAction *action;
+	gboolean bookmarks_editable, save_to_disk;
+	gboolean printing, print_setup;
+
+	action = gtk_action_group_get_action (action_group, "ViewToolbar");
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS));
+	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS), NULL);
+
+	action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR));
+	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_BOOKMARKS_BAR), NULL);
+
+	action = gtk_action_group_get_action (action_group, "ViewStatusbar");
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR));
+	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR), NULL);
+
+	action = gtk_action_group_get_action (action_group, "GoLocation");
+	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL), NULL);
+
+	action = gtk_action_group_get_action (action_group, "GoHistory");
+	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY), NULL);
+
+	action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground");
+	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE), NULL);
+
+	action = gtk_action_group_get_action (action_group, "EditToolbar");
+	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING), NULL);
+
+	action = gtk_action_group_get_action (action_group, "ViewFullscreen");
+	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_FIRST_WINDOW_FULLSCREEN), NULL);
+
+	bookmarks_editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
+	action = gtk_action_group_get_action (action_group, "GoBookmarks");
+	g_object_set (action, "sensitive", bookmarks_editable, NULL);
+	action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
+	g_object_set (action, "sensitive", bookmarks_editable, NULL);
+	action = gtk_action_group_get_action (popups_action_group, "ContextBookmarkPage");
+	g_object_set (action, "sensitive", bookmarks_editable, NULL);
+	action = gtk_action_group_get_action (popups_action_group, "BookmarkLink");
+	g_object_set (action, "sensitive", bookmarks_editable, NULL);
+
+	save_to_disk = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK);
+	action = gtk_action_group_get_action (action_group, "FileSaveAs");
+	g_object_set (action, "sensitive", save_to_disk, NULL);
+	action = gtk_action_group_get_action (popups_action_group, "DownloadLink");
+	g_object_set (action, "sensitive", save_to_disk, NULL);
+	action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs");
+	g_object_set (action, "sensitive", save_to_disk, NULL);
+	action = gtk_action_group_get_action (popups_action_group, "SaveImageAs");
+	g_object_set (action, "sensitive", save_to_disk, NULL);
+
+	printing = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING);
+	print_setup = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) &&
+		!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE);
+	action = gtk_action_group_get_action (action_group, "FilePrintSetup");
+	g_object_set (action, "sensitive", printing && print_setup, NULL);
+	action = gtk_action_group_get_action (action_group, "FilePrintPreview");
+	g_object_set (action, "sensitive", printing && print_setup, NULL);
+	action = gtk_action_group_get_action (action_group, "FilePrint");
+	g_object_set (action, "sensitive", printing, NULL);
+
+	action = gtk_action_group_get_action (action_group, "FileCloseWindow");
+	g_object_set (action, "sensitive", window_can_close(window), NULL);
+
+	action = gtk_action_group_get_action (action_group, "FileNewWindow");
+	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_NEW_WINDOW), NULL);
+}
+
+static void
 ephy_window_set_property (GObject *object,
 			  guint prop_id,
 			  const GValue *value,
@@ -1695,6 +1871,12 @@ ephy_window_set_property (GObject *objec
 		case PROP_ACTIVE_TAB:
 			ephy_window_set_active_tab (window, g_value_get_object (value));
 			break;
+		case PROP_IS_FIRST_WINDOW:
+			window->priv->is_first_window = g_value_get_boolean (value);
+			update_fullscreen(window);
+			update_actions (window);
+			g_object_notify (G_OBJECT (window), "is-first-window");
+			break;
 	}
 }
 
@@ -1711,6 +1893,9 @@ ephy_window_get_property (GObject *objec
 		case PROP_ACTIVE_TAB:
 			g_value_set_object (value, window->priv->active_tab);
 			break;
+		case PROP_IS_FIRST_WINDOW:
+			g_value_set_boolean (value, window->priv->is_first_window);
+			break;
 	}
 }
 
@@ -1739,6 +1924,14 @@ ephy_window_class_init (EphyWindowClass 
 							      EPHY_TYPE_TAB,
 							      G_PARAM_READWRITE));
 
+	g_object_class_install_property (object_class,
+					 PROP_IS_FIRST_WINDOW,
+					 g_param_spec_boolean ("is-first-window",
+							       "Is first window",
+							       "Is first window",
+							       FALSE,
+							       G_PARAM_READWRITE));
+
 	g_type_class_add_private (object_class, sizeof(EphyWindowPrivate));
 }
 
@@ -1777,73 +1970,6 @@ ensure_default_icon (void)
 }
 
 static void
-update_actions (EphyWindow *window)
-{
-	GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group);
-	GtkActionGroup *popups_action_group = GTK_ACTION_GROUP (window->priv->popups_action_group);
-	GtkAction *action;
-	gboolean bookmarks_editable, save_to_disk;
-	gboolean printing, print_setup;
-
-	action = gtk_action_group_get_action (action_group, "ViewToolbar");
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS));
-	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS), NULL);
-
-	action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR));
-	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_BOOKMARKS_BAR), NULL);
-
-	action = gtk_action_group_get_action (action_group, "ViewStatusbar");
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				      eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR));
-	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR), NULL);
-
-	action = gtk_action_group_get_action (action_group, "GoLocation");
-	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL), NULL);
-
-	action = gtk_action_group_get_action (action_group, "GoHistory");
-	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY), NULL);
-
-	bookmarks_editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
-	action = gtk_action_group_get_action (action_group, "GoBookmarks");
-	g_object_set (action, "sensitive", bookmarks_editable, NULL);
-	action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
-	g_object_set (action, "sensitive", bookmarks_editable, NULL);
-	action = gtk_action_group_get_action (popups_action_group, "ContextBookmarkPage");
-	g_object_set (action, "sensitive", bookmarks_editable, NULL);
-	action = gtk_action_group_get_action (popups_action_group, "BookmarkLink");
-	g_object_set (action, "sensitive", bookmarks_editable, NULL);
-
-	save_to_disk = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK);
-	action = gtk_action_group_get_action (action_group, "FileSaveAs");
-	g_object_set (action, "sensitive", save_to_disk, NULL);
-	action = gtk_action_group_get_action (popups_action_group, "DownloadLink");
-	g_object_set (action, "sensitive", save_to_disk, NULL);
-	action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs");
-	g_object_set (action, "sensitive", save_to_disk, NULL);
-	action = gtk_action_group_get_action (popups_action_group, "SaveImageAs");
-	g_object_set (action, "sensitive", save_to_disk, NULL);
-
-	printing = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING);
-	print_setup = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) &&
-		!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE);
-	action = gtk_action_group_get_action (action_group, "FilePrintSetup");
-	g_object_set (action, "sensitive", printing && print_setup, NULL);
-	action = gtk_action_group_get_action (action_group, "FilePrintPreview");
-	g_object_set (action, "sensitive", printing && print_setup, NULL);
-	action = gtk_action_group_get_action (action_group, "FilePrint");
-	g_object_set (action, "sensitive", printing, NULL);
-
-	action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground");
-	g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE), NULL);
-
-	action = gtk_action_group_get_action (action_group, "EditToolbar");
-	g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING), NULL);
-}
-
-static void
 update_navigation (EphyWindow *window)
 {
 	if (window->priv->active_tab)
@@ -1882,6 +2008,17 @@ navigation_notifier (GConfClient *client
 }
 
 static void
+fullscreen_notifier (GConfClient *client,
+		     guint cnxn_id,
+		     GConfEntry *entry,
+		     EphyWindow *window)
+{
+	update_fullscreen(window);
+	update_exit_fullscreen_popup (window);
+	update_actions(window);
+}
+
+static void
 browse_with_caret_notifier (GConfClient *client,
 			    guint cnxn_id,
 			    GConfEntry *entry,
@@ -1911,6 +2048,8 @@ ephy_window_init (EphyWindow *window)
 	window->priv->ppview_toolbar = NULL;
 	window->priv->exit_fullscreen_popup = NULL;
 	window->priv->num_tabs = 0;
+	window->priv->fullscreen_requested = FALSE;
+	window->priv->fullscreen_tried = FALSE;
 	window->priv->is_fullscreen = FALSE;
 	window->priv->is_ppview = FALSE;
 	window->priv->has_size = FALSE;
@@ -2006,6 +2145,18 @@ ephy_window_init (EphyWindow *window)
 		(CONF_LOCKDOWN_DISABLE_HISTORY,
 		 (GConfClientNotifyFunc)navigation_notifier, window);
 
+	window->priv->disable_quit_notifier_id = eel_gconf_notification_add
+		(CONF_LOCKDOWN_DISABLE_QUIT,
+		 (GConfClientNotifyFunc)actions_notifier, window);
+
+	window->priv->first_window_fullscreen_notifier_id = eel_gconf_notification_add
+		(CONF_LOCKDOWN_FIRST_WINDOW_FULLSCREEN,
+		 (GConfClientNotifyFunc)fullscreen_notifier, window);
+
+	window->priv->disable_new_window_notifier_id = eel_gconf_notification_add
+		(CONF_LOCKDOWN_DISABLE_NEW_WINDOW,
+		 (GConfClientNotifyFunc)actions_notifier, window);
+
 	window->priv->disable_printing_notifier_id = eel_gconf_notification_add
 		(CONF_LOCKDOWN_DISABLE_PRINTING,
 		 (GConfClientNotifyFunc)actions_notifier, window);
@@ -2048,6 +2199,9 @@ ephy_window_finalize (GObject *object)
 	eel_gconf_notification_remove (window->priv->disable_bookmark_editing_notifier_id);
 	eel_gconf_notification_remove (window->priv->disable_toolbar_editing_notifier_id);
 	eel_gconf_notification_remove (window->priv->disable_history_notifier_id);
+	eel_gconf_notification_remove (window->priv->disable_quit_notifier_id);
+	eel_gconf_notification_remove (window->priv->first_window_fullscreen_notifier_id);
+	eel_gconf_notification_remove (window->priv->disable_new_window_notifier_id);
 	eel_gconf_notification_remove (window->priv->disable_printing_notifier_id);
 	eel_gconf_notification_remove (window->priv->disable_print_setup_notifier_id);
 	eel_gconf_notification_remove (window->priv->disable_save_to_disk_notifier_id);
@@ -2096,6 +2250,7 @@ ephy_window_request_chrome (EphyWindow *
 {
 	window->priv->requested_chrome_mask = flags;
 	update_chrome (window);
+	update_fullscreen (window);
 }
 
 void
@@ -2190,6 +2345,11 @@ ephy_window_remove_tab (EphyWindow *wind
 	EphyEmbed *embed;
 	gboolean modified;
 
+	if (!window_can_close(window))
+	{
+		return;
+	}
+
 	g_return_if_fail (EPHY_IS_WINDOW (window));
 	g_return_if_fail (EPHY_IS_TAB (tab));
 
@@ -2243,8 +2403,9 @@ ephy_window_show (GtkWidget *widget)
 {
 	EphyWindow *window = EPHY_WINDOW(widget);
 
-	update_chrome (window);
-	update_actions(window);
+	update_chrome     (window);
+	update_actions    (window);
+	update_fullscreen (window);
 
 	if (!window->priv->has_size)
 	{
Index: src/ephy-window.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-window.h,v
retrieving revision 1.22
diff -u -p -r1.22 ephy-window.h
--- src/ephy-window.h	25 Dec 2003 14:55:12 -0000	1.22
+++ src/ephy-window.h	22 Jan 2004 20:49:55 -0000
@@ -67,50 +67,52 @@ typedef enum
 /* Include the header down here to resolve circular dependency */
 #include "ephy-tab.h"
 
-GType		  ephy_window_get_type		  (void);
+GType		  ephy_window_get_type		   (void);
 
-EphyWindow	 *ephy_window_new		  (void);
+EphyWindow	 *ephy_window_new		   (void);
 
-void		  ephy_window_request_chrome	  (EphyWindow *window,
-						   EmbedChromeMask chrome_flags);
+void		  ephy_window_request_chrome	   (EphyWindow *window,
+						    EmbedChromeMask chrome_flags);
+void		  ephy_window_request_fullscreen   (EphyWindow *window);
+void		  ephy_window_request_unfullscreen (EphyWindow *window);
 
-void		  ephy_window_set_print_preview	  (EphyWindow *window,
-						   gboolean enabled);
+void		  ephy_window_set_print_preview	   (EphyWindow *window,
+						    gboolean enabled);
 
-GtkWidget	 *ephy_window_get_toolbar	  (EphyWindow *window);
+GtkWidget	 *ephy_window_get_toolbar	   (EphyWindow *window);
 
-GtkWidget	 *ephy_window_get_notebook	  (EphyWindow *window);
+GtkWidget	 *ephy_window_get_notebook	   (EphyWindow *window);
 
-GtkWidget	 *ephy_window_get_statusbar	  (EphyWindow *window);
+GtkWidget	 *ephy_window_get_statusbar	   (EphyWindow *window);
 
-void		  ephy_window_add_tab		  (EphyWindow *window,
-						   EphyTab *tab,
-						   gint position,
-						   gboolean jump_to);
+void		  ephy_window_add_tab		   (EphyWindow *window,
+						    EphyTab *tab,
+						    gint position,
+						    gboolean jump_to);
 
-void		  ephy_window_remove_tab	  (EphyWindow *window,
-						   EphyTab *tab);
+void		  ephy_window_remove_tab	   (EphyWindow *window,
+						    EphyTab *tab);
 
-void		  ephy_window_jump_to_tab	  (EphyWindow *window,
-						   EphyTab *tab);
+void		  ephy_window_jump_to_tab	   (EphyWindow *window,
+						    EphyTab *tab);
 
-void		  ephy_window_load_url		  (EphyWindow *window,
-						   const char *url);
+void		  ephy_window_load_url		   (EphyWindow *window,
+						    const char *url);
 
-void		  ephy_window_set_zoom		  (EphyWindow *window,
-						   float zoom);
+void		  ephy_window_set_zoom		   (EphyWindow *window,
+						    float zoom);
 
-void		  ephy_window_activate_location	  (EphyWindow *window);
+void		  ephy_window_activate_location	   (EphyWindow *window);
 
-EphyTab		 *ephy_window_get_active_tab	  (EphyWindow *window);
+EphyTab		 *ephy_window_get_active_tab	   (EphyWindow *window);
 
-EphyEmbed	 *ephy_window_get_active_embed	  (EphyWindow *window);
+EphyEmbed	 *ephy_window_get_active_embed	   (EphyWindow *window);
 
-GList		 *ephy_window_get_tabs		  (EphyWindow *window);
+GList		 *ephy_window_get_tabs		   (EphyWindow *window);
 
-void		  ephy_window_find		  (EphyWindow *window);
+void		  ephy_window_find		   (EphyWindow *window);
 
-void		  ephy_window_print		  (EphyWindow *window);
+void		  ephy_window_print		   (EphyWindow *window);
 
 G_END_DECLS
 
Index: src/window-commands.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/window-commands.c,v
retrieving revision 1.105
diff -u -p -r1.105 window-commands.c
--- src/window-commands.c	22 Jan 2004 19:23:06 -0000	1.105
+++ src/window-commands.c	22 Jan 2004 20:49:55 -0000
@@ -279,6 +279,11 @@ window_cmd_file_new_window (GtkAction *a
 {
 	EphyTab *tab;
 
+	if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_NEW_WINDOW))
+	{
+		return;
+	}
+
 	tab = ephy_window_get_active_tab (window);
 	g_return_if_fail (tab != NULL);
 
@@ -617,11 +622,11 @@ window_cmd_view_fullscreen (GtkAction *a
 {
 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
 	{
-		gtk_window_fullscreen (GTK_WINDOW (window));
+		ephy_window_request_fullscreen (window);
 	}
 	else
 	{
-		gtk_window_unfullscreen (GTK_WINDOW (window));
+		ephy_window_request_unfullscreen (window);
 	}
 }
 
