From 5d5fe667968ae5e9b4a4fe97ba36a06a7616d718 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 20 Jun 2003 16:52:49 +0000 Subject: Set a title on NET_START (nicified url). 2003-06-20 Marco Pesenti Gritti * src/ephy-tab.c: (ephy_tab_net_state_cb), (ephy_tab_set_title): Set a title on NET_START (nicified url). * src/prefs-dialog.c: (prefs_homepage_current_button_clicked_cb): * src/session.c: (save_tab): * src/window-commands.c: (window_cmd_file_send_to), (window_cmd_file_bookmark_page): Use embed_get_location when we want the real location, tab can contain user changes. --- ChangeLog | 14 ++++++++++++++ src/ephy-tab.c | 16 ++++++++++++++-- src/prefs-dialog.c | 11 +++++++---- src/session.c | 7 +++++-- src/window-commands.c | 14 ++++++++++---- 5 files changed, 50 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31a5047bc..016e13c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-06-20 Marco Pesenti Gritti + + * src/ephy-tab.c: (ephy_tab_net_state_cb), (ephy_tab_set_title): + + Set a title on NET_START (nicified url). + + * src/prefs-dialog.c: (prefs_homepage_current_button_clicked_cb): + * src/session.c: (save_tab): + * src/window-commands.c: (window_cmd_file_send_to), + (window_cmd_file_bookmark_page): + + Use embed_get_location when we want the real location, tab can + contain user changes. + 2003-06-20 Marco Pesenti Gritti * src/ephy-favicon-action.c: (each_url_get_data_binder): diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 2c34b0542..c3630fc6b 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -744,6 +744,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed, const char *uri, tab->priv->cur_requests = 0; ensure_address (tab, uri); + ephy_tab_set_title (tab, NULL); ephy_tab_set_load_percent (tab, 0); ephy_tab_set_load_status (tab, TRUE); ephy_tab_update_navigation_flags (tab); @@ -1104,7 +1105,7 @@ ephy_tab_get_status_message (EphyTab *tab) } #define MAX_LABEL_LENGTH 32 - + static void ephy_tab_set_title (EphyTab *tab, const char *new_title) { @@ -1118,7 +1119,11 @@ ephy_tab_set_title (EphyTab *tab, const char *new_title) if (new_title == NULL || new_title[0] == '\0') { - uri = gnome_vfs_uri_new (tab->priv->address); + char *address; + + ephy_embed_get_location (tab->priv->embed, TRUE, &address); + uri = gnome_vfs_uri_new (address); + if (uri) { title = gnome_vfs_uri_to_string (uri, @@ -1129,12 +1134,19 @@ ephy_tab_set_title (EphyTab *tab, const char *new_title) GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER); gnome_vfs_uri_unref (uri); } + else if (address != NULL) + { + title = g_strdup (address); + } if (title == NULL || title[0] == '\0') { g_free (title); title = g_strdup (_("Blank page")); } + + + g_free (address); } else { diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 7b982e96f..6a4830103 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1155,15 +1155,18 @@ prefs_homepage_current_button_clicked_cb (GtkWidget *button, EphyDialog *dialog) { EphyWindow *window; - EphyTab *tab; + EphyEmbed *embed; + char *location; window = ephy_shell_get_active_window (ephy_shell); g_return_if_fail (window != NULL); - tab = ephy_window_get_active_tab (window); - g_return_if_fail (tab != NULL); + embed = ephy_window_get_active_embed (window); + g_return_if_fail (embed != NULL); - set_homepage_entry (dialog, ephy_tab_get_location (tab)); + ephy_embed_get_location (embed, TRUE, &location); + set_homepage_entry (dialog, location); + g_free (location); } void diff --git a/src/session.c b/src/session.c index 7b99447a1..387a96edd 100644 --- a/src/session.c +++ b/src/session.c @@ -445,9 +445,10 @@ save_tab (EphyWindow *window, xmlNodePtr window_node) { EmbedChromeMask chrome; - const char *location; + char *location; const char *title; xmlNodePtr embed_node; + EphyEmbed *embed; chrome = ephy_window_get_chrome (window); @@ -463,8 +464,10 @@ save_tab (EphyWindow *window, xmlSetProp (embed_node, "title", title); /* otherwise, use the actual location. */ - location = ephy_tab_get_location (tab); + embed = ephy_tab_get_embed (tab); + ephy_embed_get_location (embed, TRUE, &location); xmlSetProp (embed_node, "url", location); + g_free (location); /* insert node into the tree */ xmlAddChild (window_node, embed_node); diff --git a/src/window-commands.c b/src/window-commands.c index a42849b51..84294dfc8 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -124,6 +124,7 @@ window_cmd_file_send_to (EggAction *action, EphyTab *tab; EphyEmbed *embed; char *url; + char *embed_location; char *location; char *title; @@ -133,7 +134,10 @@ window_cmd_file_send_to (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - location = gnome_vfs_escape_string (ephy_tab_get_location (tab)); + ephy_embed_get_location (embed, TRUE, &embed_location); + location = gnome_vfs_escape_string (embed_location); + g_free (embed_location); + if (ephy_embed_get_title (embed, &title) == G_OK) { char *tmp = gnome_vfs_escape_string (title); @@ -279,13 +283,13 @@ window_cmd_go_bookmarks (EggAction *action, void window_cmd_file_bookmark_page (EggAction *action, - EphyWindow *window) + EphyWindow *window) { EphyTab *tab; EphyEmbed *embed; EphyBookmarks *bookmarks; GtkWidget *new_bookmark; - const char *location; + char *location; const char *icon; char *title = NULL; @@ -295,7 +299,8 @@ window_cmd_file_bookmark_page (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - location = ephy_tab_get_location (tab); + ephy_embed_get_location (embed, TRUE, &location); + if (ephy_embed_get_title (embed, &title) != G_OK) { title = g_strdup (_("Untitled")); @@ -317,6 +322,7 @@ window_cmd_file_bookmark_page (EggAction *action, } g_free (title); + g_free (location); } void -- cgit v1.2.3