Index: src/ephy-tab.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-tab.c,v
retrieving revision 1.37
diff -u -p -r1.37 ephy-tab.c
--- src/ephy-tab.c	15 Jun 2003 23:47:33 -0000	1.37
+++ src/ephy-tab.c	18 Jun 2003 17:08:51 -0000
@@ -57,6 +57,7 @@ struct EphyTabPrivate
 	char *icon_address;
 	char *address;
 	char *title;
+	char *loading_title;
 	int load_percent;
 	gboolean visibility;
 	gboolean load_status;
@@ -204,7 +205,7 @@ ephy_tab_get_property (GObject *object,
 			g_value_set_int (value, tab->priv->security_level);
 			break;
 		case PROP_TITLE:
-			g_value_set_string (value, tab->priv->title);
+			g_value_set_string (value, ephy_tab_get_title (tab));
 			break;
 		case PROP_VISIBLE:
 			g_value_set_boolean (value, tab->priv->visibility);
@@ -378,6 +379,7 @@ ephy_tab_finalize (GObject *object)
 	}
 
 	g_free (tab->priv->title);
+	g_free (tab->priv->loading_title);
 	g_free (tab->priv->address);
 	g_free (tab->priv->icon_address);
 	g_free (tab->priv->link_message);
@@ -410,6 +412,8 @@ ephy_tab_set_load_status (EphyTab *tab, 
 	tab->priv->load_status = status;
 
 	g_object_notify (G_OBJECT (tab), "load-status");
+
+	g_object_notify (G_OBJECT (tab), "title");
 }
 
 gboolean
@@ -720,6 +724,46 @@ build_progress_from_requests (EphyTab *t
 	}
 }
 
+
+static void
+ephy_tab_set_loading_title (EphyTab *tab, const char *address)
+{
+	GnomeVFSURI *uri;
+	char *title = NULL;
+	int len;
+
+	g_return_if_fail (IS_EPHY_TAB (tab));
+
+	g_free (tab->priv->loading_title);
+
+	uri = gnome_vfs_uri_new (address);
+	if (uri)
+	{
+		title = gnome_vfs_uri_to_string (uri,
+				GNOME_VFS_URI_HIDE_USER_NAME |
+				GNOME_VFS_URI_HIDE_PASSWORD |
+				GNOME_VFS_URI_HIDE_HOST_PORT |
+				GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD |
+				GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
+		gnome_vfs_uri_unref (uri);
+	}
+
+	if (title == NULL || title[0] == '\0')
+	{
+		g_free (title);
+		title = g_strdup (_("Blank page"));
+	}
+
+	/* strip trailing slash */
+	len = strlen (title);
+	if (len > 0 && title[len - 1] == '/')
+	{
+		title[len - 1] = '\0';
+	}
+
+	tab->priv->loading_title = title;
+}
+
 static void
 ensure_address (EphyTab *tab, const char *address)
 {
@@ -752,6 +796,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed,
 			tab->priv->cur_requests = 0;
 			ensure_address (tab, uri);
 
+			ephy_tab_set_loading_title (tab, uri);
 			ephy_tab_set_load_percent (tab, 0);
 			ephy_tab_set_load_status (tab, TRUE);
 			ephy_tab_update_navigation_flags (tab);
@@ -1053,7 +1098,8 @@ ephy_tab_init (EphyTab *tab)
 	tab->priv->cur_requests = 0;
 	tab->priv->width = -1;
 	tab->priv->height = -1;
-	tab->priv->title = g_strdup (_("Loading..."));
+	tab->priv->title = NULL;
+	tab->priv->loading_title = NULL;
 	tab->priv->address = NULL;
 	tab->priv->icon_address = NULL;
 	tab->priv->load_percent = 0;
@@ -1061,7 +1107,7 @@ ephy_tab_init (EphyTab *tab)
 	tab->priv->link_message = NULL;
 	tab->priv->security_level = STATE_IS_UNKNOWN;
 	tab->priv->status_message = NULL;
-	tab->priv->zoom = 1.0;	
+	tab->priv->zoom = 1.0;
 
 	tab->priv->embed = ephy_embed_new (G_OBJECT(single));
 	ephy_embed_shell_add_embed (EPHY_EMBED_SHELL (ephy_shell),
@@ -1223,8 +1269,8 @@ static void
 ephy_tab_set_title (EphyTab *tab, const char *new_title)
 {
 	GnomeVFSURI *uri;
+	const char *title;
 	char *title_short = NULL;
-	char *title = NULL;
 
 	g_return_if_fail (IS_EPHY_TAB (tab));
 
@@ -1232,37 +1278,23 @@ ephy_tab_set_title (EphyTab *tab, const 
 
 	if (new_title == NULL || new_title[0] == '\0')
 	{
-		uri = gnome_vfs_uri_new (tab->priv->address);
-		if (uri)
-		{
-			title = gnome_vfs_uri_to_string (uri,
-					GNOME_VFS_URI_HIDE_USER_NAME |
-					GNOME_VFS_URI_HIDE_PASSWORD |
-					GNOME_VFS_URI_HIDE_HOST_PORT |
-					GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD |
-					GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
-			gnome_vfs_uri_unref (uri);
-		}
-
-		if (title == NULL || title[0] == '\0')
-		{
-			g_free (title);
-			title = g_strdup (_("Blank page"));
-		}
+		/* use the address as title */
+		tab->priv->title = NULL;
+		title = tab->priv->loading_title;
 	}
 	else
 	{
-		title = g_strdup (new_title);
+		tab->priv->title = g_strdup (new_title);
+		title = new_title;
 	}
 
-	tab->priv->title = title;
-
 	title_short = ephy_string_shorten (title, MAX_LABEL_LENGTH);
 
 	/**
 	 * FIXME: instead of shortening the title here, use an egg action
 	 * which creates menu items with ellipsizing labels
 	 */
+	
 	g_object_set (G_OBJECT (tab->priv->action),
 		      "label", title_short,
 		      NULL);
@@ -1277,7 +1309,12 @@ ephy_tab_get_title (EphyTab *tab)
 {
 	g_return_val_if_fail (IS_EPHY_TAB (tab), "");
 
-	return tab->priv->title;
+	if (tab->priv->load_status == FALSE && tab->priv->title)
+	{
+		return tab->priv->title;
+	}
+
+	return tab->priv->loading_title;
 }
 
 const char *
