diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-09-28 21:36:17 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-09-28 21:36:17 +0800 |
commit | 987c5c02385bf24d79ad7273d3ebf000e53fb08a (patch) | |
tree | c97a57dcc85ef5f316465463717e2ce35c4ba4a9 | |
parent | d5a0c6e2268a784462634c3bdc7055d0540d611f (diff) | |
download | gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar.gz gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar.bz2 gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar.lz gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar.xz gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.tar.zst gsoc2013-epiphany-987c5c02385bf24d79ad7273d3ebf000e53fb08a.zip |
Add a function to get the tab's real title, and use it where appropriate.
2005-09-28 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-notebook.c: (sync_label):
* src/ephy-tab.c: (ephy_tab_get_title_composite),
(ephy_tab_get_title):
* src/ephy-tab.h:
* src/ephy-tabs-menu.c: (sync_tab_title):
* src/ephy-window.c: (sync_tab_title):
* src/window-commands.c: (window_cmd_file_send_to),
(window_cmd_file_bookmark_page):
Add a function to get the tab's real title, and use it
where appropriate. Fixes bug #317418.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | src/ephy-notebook.c | 2 | ||||
-rw-r--r-- | src/ephy-tab.c | 39 | ||||
-rw-r--r-- | src/ephy-tab.h | 2 | ||||
-rw-r--r-- | src/ephy-tabs-menu.c | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 3 | ||||
-rw-r--r-- | src/window-commands.c | 28 |
7 files changed, 60 insertions, 30 deletions
@@ -1,5 +1,19 @@ 2005-09-28 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-notebook.c: (sync_label): + * src/ephy-tab.c: (ephy_tab_get_title_composite), + (ephy_tab_get_title): + * src/ephy-tab.h: + * src/ephy-tabs-menu.c: (sync_tab_title): + * src/ephy-window.c: (sync_tab_title): + * src/window-commands.c: (window_cmd_file_send_to), + (window_cmd_file_bookmark_page): + + Add a function to get the tab's real title, and use it + where appropriate. Fixes bug #317418. + +2005-09-28 Christian Persch <chpe@cvs.gnome.org> + * configure.ac: * embed/mozilla/FilePicker.cpp: 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 5283818fa..d5b060c59 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1461,7 +1461,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 cc9b5ee1b..779b3be3d 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); |