Index: embed/ephy-embed-popup-control.c
===================================================================
RCS file: /cvs/gnome/epiphany/embed/ephy-embed-popup-control.c,v
retrieving revision 1.8
diff -u -r1.8 ephy-embed-popup-control.c
--- embed/ephy-embed-popup-control.c	28 Oct 2003 23:22:20 -0000	1.8
+++ embed/ephy-embed-popup-control.c	3 Nov 2003 13:17:54 -0000
@@ -496,7 +496,7 @@
 	ephy_embed_persist_set_flags
 		(persist, ask_dest ? EMBED_PERSIST_ASK_DESTINATION : 0);
 	ephy_embed_persist_set_persist_key
-		(persist, CONF_STATE_DOWNLOADING_DIR);
+		(persist, CONF_STATE_DOWNLOAD_DIR);
 	ephy_embed_persist_set_source (persist, location);
 
 	ephy_embed_persist_save (persist);
Index: idl/EphyAutomation.idl
===================================================================
RCS file: /cvs/gnome/epiphany/idl/EphyAutomation.idl,v
retrieving revision 1.6
diff -u -r1.6 EphyAutomation.idl
--- idl/EphyAutomation.idl	24 Sep 2003 19:15:32 -0000	1.6
+++ idl/EphyAutomation.idl	3 Nov 2003 13:17:56 -0000
@@ -4,11 +4,12 @@
 
 	interface EphyAutomation : Bonobo::Unknown {
 		void loadurl  (in string  url, 
-				  in boolean fullscreen,
-				  in boolean open_in_existing_tab,
-				  in boolean open_in_new_tab,
-				  in boolean open_in_new_window,
-				  in boolean raise);
+			       in string display_name,
+			       in boolean fullscreen,
+			       in boolean open_in_existing_tab,
+			       in boolean open_in_new_tab,
+			       in boolean open_in_new_window,
+			       in boolean raise);
 
 		void addBookmark (in string url);
 
@@ -24,7 +25,7 @@
 		
 		void loadSession (in string filename);
 
-		void openBookmarksEditor ();
+		void openBookmarksEditor (in string displayname);
 	};
 };
 
Index: lib/ephy-prefs.h
===================================================================
RCS file: /cvs/gnome/epiphany/lib/ephy-prefs.h,v
retrieving revision 1.16
diff -u -r1.16 ephy-prefs.h
--- lib/ephy-prefs.h	28 Oct 2003 23:24:25 -0000	1.16
+++ lib/ephy-prefs.h	3 Nov 2003 13:17:56 -0000
@@ -35,7 +35,7 @@
 #define CONF_STATE_SAVE_DIR           "/apps/epiphany/directories/save"
 #define CONF_STATE_SAVE_IMAGE_DIR     "/apps/epiphany/directories/saveimage"
 #define CONF_STATE_OPEN_DIR           "/apps/epiphany/directories/open"
-#define CONF_STATE_DOWNLOADING_DIR    "/apps/epiphany/directories/download"
+#define CONF_STATE_DOWNLOAD_DIR       "/apps/epiphany/directories/download"
 #define CONF_STATE_UPLOAD_DIR	      "/apps/epiphany/directories/upload"
 
 /* System prefs */
Index: src/ephy-automation.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-automation.c,v
retrieving revision 1.13
diff -u -r1.13 ephy-automation.c
--- src/ephy-automation.c	24 Sep 2003 19:15:32 -0000	1.13
+++ src/ephy-automation.c	3 Nov 2003 13:17:58 -0000
@@ -89,15 +89,57 @@
 	return factory;
 }
 
+static GdkDisplay *
+get_display (const char *display_name)
+{
+	GSList *displays, *l;
+	GdkDisplay *display = NULL;
+
+	displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+	for (l = displays; l != NULL; l = l->next)
+	{
+		const char *name;
+
+		name = gdk_display_get_name (l->data);
+
+		if (strcmp (name, display_name) != 0) display = l->data;
+	}
+
+	if (display == NULL)
+	{
+		display = gdk_display_open (display_name);
+	}
+
+	g_slist_free (displays);
+
+	return display;
+}
+
+static GdkScreen *
+get_screen (const char *display_name)
+{
+	GdkDisplay *display;
+
+	display = gdk_display_get_default ();
+
+	if (strcmp (gdk_display_get_name (display), display_name) != 0)
+	{
+		display = get_display (display_name);
+	}
+
+	return gdk_display_get_default_screen (display);
+}
+
 static void
 impl_ephy_automation_loadurl (PortableServer_Servant _servant,
-			      const CORBA_char * url,
+			      const CORBA_char *url,
+			      const CORBA_char *display,
 			      const CORBA_boolean fullscreen,
 			      const CORBA_boolean open_in_existing_tab,
 			      const CORBA_boolean open_in_new_window,
 			      const CORBA_boolean open_in_new_tab,
 			      const CORBA_boolean raise,
-                              CORBA_Environment * ev)
+                              CORBA_Environment *ev)
 {
 	EphyNewTabFlags flags = 0;
 	EphyWindow *window;
@@ -146,8 +188,8 @@
 		flags |= EPHY_NEW_TAB_FULLSCREEN_MODE;
 	}
 
-	ephy_shell_new_tab (ephy_shell, window, NULL, url,
-			    flags);
+	ephy_shell_new_tab (ephy_shell, get_screen (display),
+			    window, NULL, url, flags);
 }
 
 static void
@@ -192,9 +234,10 @@
 
 static void
 impl_ephy_automation_open_bookmarks_editor (PortableServer_Servant _servant,
-					    CORBA_Environment * ev)
+					    const CORBA_char *display,
+					    CORBA_Environment *ev)
 {
-	ephy_shell_show_bookmarks_editor (ephy_shell, NULL);
+	ephy_shell_show_bookmarks_editor (ephy_shell, NULL, get_screen (display));
 }
 
 static void
Index: src/ephy-history-window.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-history-window.c,v
retrieving revision 1.59
diff -u -r1.59 ephy-history-window.c
--- src/ephy-history-window.c	20 Oct 2003 07:55:06 -0000	1.59
+++ src/ephy-history-window.c	3 Nov 2003 13:18:04 -0000
@@ -376,8 +376,9 @@
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_PAGE_PROP_LOCATION);
 
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
-			EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+		ephy_shell_new_tab (ephy_shell, NULL, window, NULL, location,
+			            EPHY_NEW_TAB_OPEN_PAGE |
+				    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 	}
 
 	g_list_free (selection);
@@ -398,11 +399,13 @@
 	{
 		EphyNode *node = l->data;
 		const char *location;
+		GdkScreen *screen;
 
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_PAGE_PROP_LOCATION);
 
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
+		screen = gtk_window_get_screen (GTK_WINDOW (window));
+		ephy_shell_new_tab (ephy_shell, screen, window, NULL, location,
 				    EPHY_NEW_TAB_OPEN_PAGE |
 				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
@@ -659,16 +662,18 @@
 
 static void
 ephy_history_window_node_activated_cb (GtkWidget *view,
-				         EphyNode *node,
-					 EphyHistoryWindow *editor)
+				       EphyNode *node,
+				       EphyHistoryWindow *editor)
 {
 	const char *location;
+	GdkScreen *screen;
 
 	location = ephy_node_get_property_string
 		(node, EPHY_NODE_PAGE_PROP_LOCATION);
 	g_return_if_fail (location != NULL);
 
-	ephy_shell_new_tab (ephy_shell, NULL, NULL, location,
+	screen = gtk_window_get_screen (GTK_WINDOW (editor));
+	ephy_shell_new_tab (ephy_shell, screen, NULL, NULL, location,
 			    EPHY_NEW_TAB_OPEN_PAGE);
 }
 
Index: src/ephy-main.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-main.c,v
retrieving revision 1.14
diff -u -r1.14 ephy-main.c
--- src/ephy-main.c	17 Oct 2003 09:52:06 -0000	1.14
+++ src/ephy-main.c	3 Nov 2003 13:18:05 -0000
@@ -162,6 +162,9 @@
 {
 	GNOME_EphyAutomation gaserver;
 	int i;
+	const char *display;
+
+	display = gdk_display_get_name (gdk_display_get_default ());
 
 	CORBA_exception_init (&corba_env);
 
@@ -189,7 +192,7 @@
 	else if (open_as_bookmarks_editor)
 	{
 		GNOME_EphyAutomation_openBookmarksEditor
-			(gaserver, &corba_env);
+			(gaserver, display, &corba_env);
 	}
 	/* load the session if requested */
 	else if (session_filename)
@@ -222,6 +225,7 @@
 		{
 			GNOME_EphyAutomation_loadurl
 				(gaserver, url[i],
+				 display,
 				 open_fullscreen,
 				 open_in_existing,
 				 open_in_new_window,
Index: src/ephy-notebook.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-notebook.c,v
retrieving revision 1.24
diff -u -r1.24 ephy-notebook.c
--- src/ephy-notebook.c	6 Oct 2003 13:53:56 -0000	1.24
+++ src/ephy-notebook.c	3 Nov 2003 13:18:09 -0000
@@ -673,7 +673,10 @@
 		}
 		else
 		{
-			tab = ephy_shell_new_tab (ephy_shell, window,
+			GdkScreen *screen;
+
+			screen = gtk_window_get_screen (GTK_WINDOW (window));
+			tab = ephy_shell_new_tab (ephy_shell, screen, window,
 						  tab, url,
 						  EPHY_NEW_TAB_OPEN_PAGE |
 						  EPHY_NEW_TAB_IN_EXISTING_WINDOW |
Index: src/ephy-shell.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-shell.c,v
retrieving revision 1.64
diff -u -r1.64 ephy-shell.c
--- src/ephy-shell.c	28 Oct 2003 11:33:19 -0000	1.64
+++ src/ephy-shell.c	3 Nov 2003 13:18:11 -0000
@@ -436,6 +436,7 @@
  **/
 EphyTab *
 ephy_shell_new_tab (EphyShell *shell,
+		    GdkScreen *screen,
 		    EphyWindow *parent_window,
 		    EphyTab *previous_tab,
 		    const char *url,
@@ -464,6 +465,7 @@
 	else
 	{
 		window = ephy_window_new ();
+		gtk_window_set_screen (GTK_WINDOW (window), screen);
 	}
 
 	toolbar = ephy_window_get_toolbar (window);
@@ -636,10 +638,13 @@
 
 void
 ephy_shell_show_bookmarks_editor (EphyShell *gs,
-				  GtkWidget *parent)
+				  GtkWidget *parent,
+				  GdkScreen *screen)
 {
 	EphyBookmarks *bookmarks;
 
+	g_return_if_fail (screen != NULL);
+
 	if (gs->priv->bme == NULL)
 	{
 		bookmarks = ephy_shell_get_bookmarks (ephy_shell);
@@ -661,6 +666,7 @@
 			(EPHY_BOOKMARKS_EDITOR (gs->priv->bme), parent);
 	}
 
+	gtk_window_set_screen (GTK_WINDOW (gs->priv->bme), screen);
 	gtk_window_present (GTK_WINDOW (gs->priv->bme));
 }
 
Index: src/ephy-shell.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-shell.h,v
retrieving revision 1.15
diff -u -r1.15 ephy-shell.h
--- src/ephy-shell.h	28 Oct 2003 11:33:19 -0000	1.15
+++ src/ephy-shell.h	3 Nov 2003 13:18:12 -0000
@@ -84,6 +84,7 @@
 EphyWindow	   *ephy_shell_get_active_window     (EphyShell *gs);
 
 EphyTab            *ephy_shell_new_tab	             (EphyShell *shell,
+						      GdkScreen *screen,
 						      EphyWindow *parent_window,
 						      EphyTab *previous_tab,
 						      const char *url,
@@ -97,7 +98,8 @@
 						      gboolean fullscreen);
 
 void		    ephy_shell_show_bookmarks_editor (EphyShell *gs,
-						      GtkWidget *parent);
+						      GtkWidget *parent,
+						      GdkScreen *screen);
 
 void		    ephy_shell_show_history_window   (EphyShell *gs,
 						      GtkWidget *parent);
Index: src/ephy-tab.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-tab.c,v
retrieving revision 1.61
diff -u -r1.61 ephy-tab.c
--- src/ephy-tab.c	29 Oct 2003 19:49:38 -0000	1.61
+++ src/ephy-tab.c	3 Nov 2003 13:18:16 -0000
@@ -983,7 +983,10 @@
 
 	if (new_tab)
 	{
-		ephy_shell_new_tab (ephy_shell, window, tab,
+		GdkScreen *screen;
+
+		screen = gtk_window_get_screen (GTK_WINDOW (window));
+		ephy_shell_new_tab (ephy_shell, screen, window, tab,
 				    link_address,
 				    EPHY_NEW_TAB_OPEN_PAGE |
 				    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
Index: src/popup-commands.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/popup-commands.c,v
retrieving revision 1.30
diff -u -r1.30 popup-commands.c
--- src/popup-commands.c	28 Oct 2003 23:22:22 -0000	1.30
+++ src/popup-commands.c	3 Nov 2003 13:18:17 -0000
@@ -46,6 +46,12 @@
 	return info;
 }
 
+static GdkScreen *
+get_screen (EphyWindow *window)
+{
+	return gtk_window_get_screen (GTK_WINDOW (window));
+}
+
 void
 popup_cmd_link_in_new_window (GtkAction *action,
 		              EphyWindow *window)
@@ -60,8 +66,8 @@
 
 	ephy_embed_event_get_property (info, "link", &value);
 
-	ephy_shell_new_tab (ephy_shell, NULL, tab,
-			    g_value_get_string (value),
+	ephy_shell_new_tab (ephy_shell, get_screen (window),
+			    NULL, tab, g_value_get_string (value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_NEW_WINDOW);
 }
@@ -80,8 +86,8 @@
 
 	ephy_embed_event_get_property (info, "link", &value);
 
-	ephy_shell_new_tab (ephy_shell, window, tab,
-			    g_value_get_string (value),
+	ephy_shell_new_tab (ephy_shell, NULL,
+			    window, tab, g_value_get_string (value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 }
@@ -100,8 +106,8 @@
 
 	ephy_embed_event_get_property (info, "image", &value);
 
-	ephy_shell_new_tab (ephy_shell, window, tab,
-			    g_value_get_string (value),
+	ephy_shell_new_tab (ephy_shell, NULL,
+			    window, tab, g_value_get_string (value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 }
@@ -120,8 +126,8 @@
 
 	ephy_embed_event_get_property (info, "image", &value);
 
-	ephy_shell_new_tab (ephy_shell, NULL, tab,
-			    g_value_get_string (value),
+	ephy_shell_new_tab (ephy_shell, get_screen (window),
+			    NULL, tab, g_value_get_string (value),
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_NEW_WINDOW);
 }
@@ -198,7 +204,7 @@
 
 	ephy_embed_get_location (embed, FALSE, &location);
 
-	ephy_shell_new_tab (ephy_shell, window, tab,
+	ephy_shell_new_tab (ephy_shell, NULL, window, tab,
 			    location,
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
@@ -220,8 +226,8 @@
 
 	ephy_embed_get_location (embed, FALSE, &location);
 
-	ephy_shell_new_tab (ephy_shell, NULL, tab,
-			    location,
+	ephy_shell_new_tab (ephy_shell, get_screen (window),
+			    NULL, tab, location,
 			    EPHY_NEW_TAB_OPEN_PAGE |
 			    EPHY_NEW_TAB_IN_NEW_WINDOW);
 
@@ -289,7 +295,7 @@
 	ephy_embed_persist_set_flags
 		(persist, ask_dest ? EMBED_PERSIST_ASK_DESTINATION : 0);
 	ephy_embed_persist_set_persist_key
-		(persist, CONF_STATE_DOWNLOADING_DIR);
+		(persist, CONF_STATE_DOWNLOAD_DIR);
 	ephy_embed_persist_set_source (persist, location);
 
 	ephy_embed_persist_save (persist);
Index: src/session.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/session.c,v
retrieving revision 1.22
diff -u -r1.22 session.c
--- src/session.c	24 Sep 2003 18:45:03 -0000	1.22
+++ src/session.c	3 Nov 2003 13:18:20 -0000
@@ -496,6 +496,9 @@
 		int x = 0, y = 0, width = 0, height = 0;
 		EphyWindow *window = EPHY_WINDOW(w->data);
 		GtkWidget *wmain;
+		GdkScreen *screen;
+
+		screen = gtk_window_get_screen (GTK_WINDOW (window));
 
 		tabs = ephy_window_get_tabs (window);
 		g_return_if_fail (tabs != NULL);
@@ -519,6 +522,9 @@
                 g_snprintf(buffer, 32, "%d", height);
                 xmlSetProp (window_node, "height", buffer);
 
+                g_snprintf(buffer, 32, "%d", gdk_screen_get_number (screen));
+                xmlSetProp (window_node, "screen", buffer);
+
 		for (l = tabs; l != NULL; l = l->next)
 	        {
 			EphyTab *tab = EPHY_TAB(l->data);
@@ -549,7 +555,7 @@
 
 			url = xmlGetProp (child, "url");
 
-			ephy_shell_new_tab (ephy_shell, window, NULL, url,
+			ephy_shell_new_tab (ephy_shell, NULL, window, NULL, url,
 					    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
 					    EPHY_NEW_TAB_OPEN_PAGE |
 					    EPHY_NEW_TAB_APPEND_LAST);
@@ -592,7 +598,10 @@
 		if (strcmp (child->name, "window") == 0)
 		{
 			gulong x = 0, y = 0, width = 0, height = 0;
+			gulong screen_number;
 			xmlChar *tmp;
+			GdkScreen *screen;
+			GdkDisplay *display;
 
 			tmp = xmlGetProp (child, "x");
 			ephy_string_to_int (tmp, &x);
@@ -605,6 +614,13 @@
 			xmlFree (tmp);
 			tmp = xmlGetProp (child, "height");
 			ephy_string_to_int (tmp, &height);
+			xmlFree (tmp);
+
+			display = gdk_display_get_default ();
+			tmp = xmlGetProp (child, "screen");
+			ephy_string_to_int (tmp, &screen_number);
+			screen = gdk_display_get_screen
+				(display, screen_number);
 			xmlFree (tmp);
 
 			window = ephy_window_new ();
Index: src/window-commands.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/window-commands.c,v
retrieving revision 1.87
diff -u -r1.87 window-commands.c
--- src/window-commands.c	28 Oct 2003 11:33:19 -0000	1.87
+++ src/window-commands.c	3 Nov 2003 13:18:23 -0000
@@ -248,11 +248,13 @@
 		            EphyWindow *window)
 {
 	EphyTab *tab;
+	GdkScreen *screen;
 
 	tab = ephy_window_get_active_tab (window);
 	g_return_if_fail (tab != NULL);
 
-	ephy_shell_new_tab (ephy_shell, NULL, tab, NULL,
+	screen = gtk_window_get_screen (GTK_WINDOW (window));
+	ephy_shell_new_tab (ephy_shell, screen, NULL, tab, NULL,
 			    EPHY_NEW_TAB_NEW_PAGE |
 			    EPHY_NEW_TAB_IN_NEW_WINDOW);
 }
@@ -266,7 +268,7 @@
 	tab = ephy_window_get_active_tab (window);
 	g_return_if_fail (tab != NULL);
 
-	ephy_shell_new_tab (ephy_shell, window, tab, NULL,
+	ephy_shell_new_tab (ephy_shell, NULL, window, tab, NULL,
 			    EPHY_NEW_TAB_NEW_PAGE |
 			    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
 			    EPHY_NEW_TAB_JUMP);
@@ -276,7 +278,10 @@
 window_cmd_go_bookmarks (GtkAction *action,
 			 EphyWindow *window)
 {
-	ephy_shell_show_bookmarks_editor (ephy_shell, GTK_WIDGET (window));
+	GdkScreen *screen;
+
+	screen = gtk_window_get_screen (GTK_WINDOW (window));
+	ephy_shell_show_bookmarks_editor (ephy_shell, GTK_WIDGET (window), screen);
 }
 
 void
Index: src/bookmarks/ephy-bookmarks-editor.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.c,v
retrieving revision 1.121
diff -u -r1.121 ephy-bookmarks-editor.c
--- src/bookmarks/ephy-bookmarks-editor.c	28 Oct 2003 20:34:06 -0000	1.121
+++ src/bookmarks/ephy-bookmarks-editor.c	3 Nov 2003 13:18:30 -0000
@@ -380,8 +380,9 @@
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_BMK_PROP_LOCATION);
 
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
-			EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+		ephy_shell_new_tab (ephy_shell, NULL, window, NULL, location,
+			            EPHY_NEW_TAB_OPEN_PAGE |
+				    EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 	}
 
 	g_list_free (selection);
@@ -402,12 +403,15 @@
 	{
 		EphyNode *node = l->data;
 		const char *location;
+		GdkScreen *screen;
 
 		location = ephy_node_get_property_string (node,
 						EPHY_NODE_BMK_PROP_LOCATION);
 
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
-				    EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_NEW_WINDOW);
+		screen = gtk_window_get_screen (GTK_WINDOW (editor));
+		ephy_shell_new_tab (ephy_shell, screen, window, NULL, location,
+				    EPHY_NEW_TAB_OPEN_PAGE |
+				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
 
 	g_list_free (selection);
@@ -870,12 +874,14 @@
 					 EphyBookmarksEditor *editor)
 {
 	const char *location;
+	GdkScreen *screen;
 
 	location = ephy_node_get_property_string
 		(node, EPHY_NODE_BMK_PROP_LOCATION);
 	g_return_if_fail (location != NULL);
 
-	ephy_shell_new_tab (ephy_shell, NULL, NULL, location,
+	screen = gtk_window_get_screen (GTK_WINDOW (editor));
+	ephy_shell_new_tab (ephy_shell, screen, NULL, NULL, location,
 			    EPHY_NEW_TAB_OPEN_PAGE);
 }
 
