aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ephy-notebook.c2
-rw-r--r--src/ephy-tab.c39
-rw-r--r--src/ephy-tab.h2
-rw-r--r--src/ephy-tabs-menu.c2
-rw-r--r--src/ephy-window.c3
-rw-r--r--src/window-commands.c28
6 files changed, 46 insertions, 30 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 55e458b5a..fd4d41208 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -1011,7 +1011,7 @@ sync_label (EphyTab *tab, GParamSpec *pspec, GtkWidget *proxy)
g_return_if_fail (ebox != NULL && tips != NULL && label != NULL);
- title = ephy_tab_get_title (tab);
+ title = ephy_tab_get_title_composite (tab);
if (title)
{
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 236e946ac..d07152a53 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -2212,15 +2212,18 @@ ephy_tab_set_title (EphyTab *tab,
}
/**
- * ephy_tab_get_title:
+ * ephy_tab_get_title_composite:
* @tab: an #EphyTab
*
* Returns the title of the web page loaded in @tab.
+ *
+ * This differs from #ephy_tab_get_title in that this function
+ * will return a special title while the page is still loading.
*
- * Return value: @tab's loaded web page's title. Will never be %NULL.
+ * Return value: @tab's web page's title. Will never be %NULL.
**/
const char *
-ephy_tab_get_title (EphyTab *tab)
+ephy_tab_get_title_composite (EphyTab *tab)
{
EphyTabPrivate *priv;
const char *title = "";
@@ -2247,6 +2250,36 @@ ephy_tab_get_title (EphyTab *tab)
}
/**
+ * ephy_tab_get_title:
+ * @tab: an #EphyTab
+ *
+ * Returns the title of the web page loaded in @tab.
+ *
+ * Return value: @tab's loaded web page's title. Will never be %NULL.
+ **/
+const char *
+ephy_tab_get_title (EphyTab *tab)
+{
+ EphyTabPrivate *priv;
+ const char *title = "";
+
+ g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
+
+ priv = tab->priv;
+
+ if (priv->is_blank)
+ {
+ title = _("Blank page");
+ }
+ else
+ {
+ title = priv->title;
+ }
+
+ return title != NULL ? title : "";
+}
+
+/**
* ephy_tab_get_address:
* @tab: an #EphyTab
*
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index f84595c02..0c34d97dd 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -115,6 +115,8 @@ const char *ephy_tab_get_status_message (EphyTab *tab);
const char *ephy_tab_get_title (EphyTab *tab);
+const char *ephy_tab_get_title_composite (EphyTab *tab);
+
gboolean ephy_tab_get_visibility (EphyTab *tab);
float ephy_tab_get_zoom (EphyTab *tab);
diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c
index c900eab24..48f94b8d6 100644
--- a/src/ephy-tabs-menu.c
+++ b/src/ephy-tabs-menu.c
@@ -124,7 +124,7 @@ sync_tab_title (EphyTab *tab,
{
const char *title;
- title = ephy_tab_get_title (tab);
+ title = ephy_tab_get_title_composite (tab);
g_object_set (action, "label", title, NULL);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index acc8db5ac..050a43d4d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1459,7 +1459,8 @@ sync_tab_title (EphyTab *tab,
if (priv->closing) return;
- gtk_window_set_title (GTK_WINDOW(window), ephy_tab_get_title (tab));
+ gtk_window_set_title (GTK_WINDOW(window),
+ ephy_tab_get_title_composite (tab));
}
static void
diff --git a/src/window-commands.c b/src/window-commands.c
index e48b698d8..29eca66a7 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -129,7 +129,6 @@ window_cmd_file_send_to (GtkAction *action,
{
EphyTab *tab;
EphyEmbed *embed;
- const char *address;
char *url, *location, *title;
tab = ephy_window_get_active_tab (window);
@@ -138,20 +137,8 @@ window_cmd_file_send_to (GtkAction *action,
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
- address = ephy_tab_get_address (tab);
- location = gnome_vfs_escape_string (address);
-
- title = ephy_embed_get_title (embed);
- if (title != NULL)
- {
- char *tmp = gnome_vfs_escape_string (title);
- g_free (title);
- title = tmp;
- }
- else
- {
- title = gnome_vfs_escape_string (_("Check this out!"));
- }
+ location = gnome_vfs_escape_string (ephy_tab_get_address (tab));
+ title = gnome_vfs_escape_string (ephy_tab_get_title (tab));
url = g_strconcat ("mailto:",
"?Subject=", title,
@@ -288,8 +275,7 @@ window_cmd_file_bookmark_page (GtkAction *action,
EphyEmbed *embed;
EphyBookmarks *bookmarks;
GtkWidget *new_bookmark;
- const char *location, *icon;
- char *title;
+ const char *location, *icon, *title;
tab = ephy_window_get_active_tab (window);
g_return_if_fail (tab != NULL);
@@ -298,13 +284,7 @@ window_cmd_file_bookmark_page (GtkAction *action,
g_return_if_fail (embed != NULL);
location = ephy_tab_get_address (tab);
-
- title = ephy_embed_get_title (embed);
- if (title == NULL)
- {
- title = g_strdup (_("Untitled"));
- }
-
+ title = ephy_tab_get_title (tab);
icon = ephy_tab_get_icon_address (tab);
bookmarks = ephy_shell_get_bookmarks (ephy_shell);