epiphany r7856 - trunk/src



Author: cosimoc
Date: Thu Jan 10 20:40:35 2008
New Revision: 7856
URL: http://svn.gnome.org/viewvc/epiphany?rev=7856&view=rev

Log:
Open externally opened link in current tab if it is blank.
Fix bug #499613.


Modified:
   trunk/src/ephy-activation.c
   trunk/src/ephy-main.c
   trunk/src/ephy-session.c
   trunk/src/ephy-shell.c
   trunk/src/ephy-shell.h

Modified: trunk/src/ephy-activation.c
==============================================================================
--- trunk/src/ephy-activation.c	(original)
+++ trunk/src/ephy-activation.c	Thu Jan 10 20:40:35 2008
@@ -64,8 +64,12 @@
 			       guint startup_id,
 			       GError **error)
 {
+	char *new_options;
+	
+	new_options = g_strconcat (options, "external,", NULL);
 	return session_queue_command (EPHY_SESSION_CMD_OPEN_URIS,
-				      options, uris, startup_id, error);
+				      new_options, uris, startup_id, error);
+	g_free (new_options);
 }
 
 gboolean

Modified: trunk/src/ephy-main.c
==============================================================================
--- trunk/src/ephy-main.c	(original)
+++ trunk/src/ephy-main.c	Thu Jan 10 20:40:35 2008
@@ -369,7 +369,7 @@
 		}
 		if (open_in_new_tab)
 		{
-			g_string_append (options, "new-tab,");
+			g_string_append (options, "new-tab,external,");
 		}
 
 		ephy_session_queue_command (session,

Modified: trunk/src/ephy-session.c
==============================================================================
--- trunk/src/ephy-session.c	(original)
+++ trunk/src/ephy-session.c	Thu Jan 10 20:40:35 2008
@@ -673,6 +673,10 @@
 
 	window = ephy_session_get_active_window (session);
 
+	if (options != NULL && strstr (options, "external") != NULL)
+	{
+		flags |= EPHY_NEW_TAB_FROM_EXTERNAL;
+	}
 	if (options != NULL && strstr (options, "new-window") != NULL)
 	{
 		window = NULL;

Modified: trunk/src/ephy-shell.c
==============================================================================
--- trunk/src/ephy-shell.c	(original)
+++ trunk/src/ephy-shell.c	Thu Jan 10 20:40:35 2008
@@ -450,7 +450,7 @@
 EphyEmbed *
 ephy_shell_new_tab_full (EphyShell *shell,
 			 EphyWindow *parent_window,
-			 EphyEmbed *previous_tab,
+			 EphyEmbed *previous_embed,
 			 const char *url,
 			 EphyNewTabFlags flags,
 			 EphyEmbedChrome chrome,
@@ -458,10 +458,10 @@
 			 guint32 user_time)
 {
 	EphyWindow *window;
-	EphyEmbed *embed;
+	EphyEmbed *embed = NULL;
 	gboolean in_new_window = TRUE;
 	gboolean jump_to;
-	EphyEmbed *previous_embed = NULL;
+	gboolean active_is_blank = FALSE;
 	GtkWidget *nb;
 	int position = -1;
 	gboolean is_empty = FALSE;
@@ -489,28 +489,43 @@
 
 	toolbar = EPHY_TOOLBAR (ephy_window_get_toolbar (window));
 
-	if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_tab != NULL)
+	if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_embed != NULL)
 	{
 		nb = ephy_window_get_notebook (window);
                 /* FIXME this assumes the tab is the direct notebook child */
 		position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
 						  GTK_WIDGET (previous_embed)) + 1;
 	}
-
-	embed = EPHY_EMBED (ephy_embed_factory_new_object (EPHY_TYPE_EMBED));
-	g_assert (embed != NULL);
-	gtk_widget_show (GTK_WIDGET (embed));
-
-	ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to);
+	
+	if (flags & EPHY_NEW_TAB_FROM_EXTERNAL)
+	{
+		/* If the active embed is blank, use that to open the url and jump to it */
+		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+		if (embed != NULL)
+		{
+			if (ephy_embed_get_is_blank (embed))
+			{
+				active_is_blank = TRUE;
+			}
+		}
+	}
+	if (active_is_blank == FALSE)
+	{
+		embed = EPHY_EMBED (ephy_embed_factory_new_object (EPHY_TYPE_EMBED));
+		g_assert (embed != NULL);
+		gtk_widget_show (GTK_WIDGET (embed));
+		
+		ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to);
+	}
 
 	if (previous_embed != NULL)
-	{
+	{	
 		ephy_embed_shistory_copy (previous_embed,
 					  embed,
 					  TRUE,   /* back history */
 					  TRUE,   /* forward history */
 					  FALSE); /* current index */
-	}
+	}		
 
 	ephy_gui_window_update_user_time (GTK_WIDGET (window), user_time);
 

Modified: trunk/src/ephy-shell.h
==============================================================================
--- trunk/src/ephy-shell.h	(original)
+++ trunk/src/ephy-shell.h	Thu Jan 10 20:40:35 2008
@@ -65,6 +65,7 @@
 
 	/* The way to load */
 	EPHY_NEW_TAB_ALLOW_FIXUP	= 1 << 12,
+	EPHY_NEW_TAB_FROM_EXTERNAL      = 1 << 13,
 	
 } EphyNewTabFlags;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]