? lib/egg/.deps
? po/stamp-it
? src/.window-commands.c.swp
Index: src/ephy-session.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-session.c,v
retrieving revision 1.55
diff -u -r1.55 ephy-session.c
--- src/ephy-session.c	23 Mar 2006 16:43:28 -0000	1.55
+++ src/ephy-session.c	15 Apr 2006 01:10:12 -0000
@@ -689,15 +689,19 @@
 			page_flags = EPHY_NEW_TAB_OPEN_PAGE;
 		}
 
-		tab = ephy_shell_new_tab_full (shell, window,
-					       NULL /* parent tab */,
-					       url,
-					       flags | page_flags,
-					       EPHY_EMBED_CHROME_ALL,
-					       FALSE /* is popup? */,
-					       user_time);
+		/* Only open a new window if the url isn't already open */
+		if (ephy_session_present_window (session, url, user_time) == FALSE)
+		{
+			tab = ephy_shell_new_tab_full (shell, window,
+						       NULL /* parent tab */,
+						       url,
+						       flags | page_flags,
+						       EPHY_EMBED_CHROME_ALL,
+						       FALSE /* is popup? */,
+						       user_time);
 
-		window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab)));
+			window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab)));
+		}
 	}
 
 	g_object_unref (shell);
@@ -1582,6 +1586,72 @@
 
 	return window;
 }
+
+
+/**
+ * ephy_session_present_window:
+ * @session: a #EphySession
+ * @address: a URL
+ *
+ * Searches the open windows for a tab with address @address. If found, presents
+ * the window and switches the window's active tab to it.
+ *
+ * Return value: %TRUE if a tab was found
+ **/
+gboolean
+ephy_session_present_window (EphySession *session,
+				const char *address,
+				guint user_time)
+{
+	EphyWindow *window = NULL;
+	EphyTab *tab = NULL;
+	GList *tabs, *w, *t;
+	gboolean found = FALSE;
+
+	g_return_val_if_fail (EPHY_IS_SESSION (session), FALSE);
+	g_return_val_if_fail (address != NULL, FALSE);
+
+    /* if address doesn't have web prefix, default to http:// */
+	if (!g_str_has_prefix (address, "http:") &&
+		!g_str_has_prefix (address, "https:") &&
+		!g_str_has_prefix (address, "ftp:") &&
+		!g_str_has_prefix (address, "file:") &&
+		!g_str_has_prefix (address, "data:") &&
+		!g_str_has_prefix (address, "about:") &&
+		!g_str_has_prefix (address, "gopher:"))
+
+	{
+		address = g_strconcat ("http://", address, NULL);
+	} 
+	for (w = session->priv->windows; w != NULL && found == FALSE; w = w->next)
+	{
+		if (!EPHY_IS_WINDOW (w->data)) continue;
+
+		window = EPHY_WINDOW (w->data);
+
+		tabs = ephy_window_get_tabs (window);
+		for (t = tabs; t != NULL && found == FALSE; t = t->next)
+		{
+			const char *tab_address;
+			tab = EPHY_TAB (t->data);
+
+			tab_address = ephy_tab_get_address (tab); 
+			
+			found = (strcmp (tab_address, address) == 0 ||
+				strcmp (tab_address, g_strconcat (address, "/", NULL)) == 0);
+
+		}
+		g_list_free (tabs);
+	}
+
+	if (found)
+	{
+		ephy_window_jump_to_tab (window, tab);
+		gtk_window_present_with_time (GTK_WINDOW (window), user_time);
+	}
+	return found;
+}
+
 
 /**
  * ephy_session_queue_command:
Index: src/ephy-session.h
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-session.h,v
retrieving revision 1.5
diff -u -r1.5 ephy-session.h
--- src/ephy-session.h	2 Feb 2006 13:31:32 -0000	1.5
+++ src/ephy-session.h	15 Apr 2006 01:10:12 -0000
@@ -86,6 +86,9 @@
 
 void		 ephy_session_remove_window	(EphySession *session,
 						 GtkWindow *window);
+gboolean	 ephy_session_present_window (EphySession *session,
+						  const char *address,
+						  guint user_time);
 
 void		 ephy_session_queue_command	(EphySession *session,
 						 EphySessionCommand op,
Index: src/bookmarks/ephy-bookmark-action.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmark-action.c,v
retrieving revision 1.79
diff -u -r1.79 ephy-bookmark-action.c
--- src/bookmarks/ephy-bookmark-action.c	24 Feb 2006 14:57:04 -0000	1.79
+++ src/bookmarks/ephy-bookmark-action.c	15 Apr 2006 01:10:14 -0000
@@ -32,6 +32,7 @@
 #include "ephy-gui.h"
 #include "ephy-debug.h"
 #include "ephy-dnd.h"
+#include "ephy-session.h"
 
 #include <glib/gi18n.h>
 #include <gtk/gtkwidget.h>
@@ -281,6 +282,7 @@
 	EphyBookmarks *bookmarks;
 	const char *location;
 	char *address = NULL, *text = NULL;
+	EphySession *session;
 
 	g_return_if_fail (priv->node != NULL);
 
@@ -315,9 +317,15 @@
 		address = ephy_bookmarks_resolve_address (bookmarks, location, text);
 	}
 	g_return_if_fail (address != NULL);
-
-	ephy_link_open (EPHY_LINK (action), address, NULL, flags);
-
+	
+	session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+	
+	/* Only open new window if the bookmark isn't already open */
+	if (ephy_session_present_window (session, address, 
+			gtk_get_current_event_time()) == FALSE)
+	{
+		ephy_link_open (EPHY_LINK (action), address, NULL, flags);
+	}
 	g_free (address);
 	g_free (text);
 }
Index: src/bookmarks/ephy-bookmarks-editor.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.c,v
retrieving revision 1.192
diff -u -r1.192 ephy-bookmarks-editor.c
--- src/bookmarks/ephy-bookmarks-editor.c	10 Mar 2006 09:21:06 -0000	1.192
+++ src/bookmarks/ephy-bookmarks-editor.c	15 Apr 2006 01:10:15 -0000
@@ -1265,14 +1265,23 @@
 					 EphyNode *node,
 					 EphyBookmarksEditor *editor)
 {
+	EphySession *session;
 	const char *location;
 
 	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,
-			    EPHY_NEW_TAB_OPEN_PAGE);
+	session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+
+	/* only open a new window if there isn't already on open for this url */
+	if (ephy_session_present_window (session, location, 
+			gtk_get_current_event_time()) == FALSE)
+	{
+		ephy_shell_new_tab (ephy_shell, NULL, NULL, location,
+					EPHY_NEW_TAB_OPEN_PAGE);
+	}
+
 }
 
 static void
