From 9ea9e684b4cb5563d5b395a93b923771b0f6bffc Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Mon, 11 Jan 2010 14:00:35 -0500 Subject: Avoid blank items in back/forward menus Use the url of the page as its menu label if there's no title set. Bug #604491 --- src/ephy-navigation-action.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index d19cf21fb..d3c31299b 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.c @@ -236,13 +236,20 @@ build_back_or_forward_menu (EphyNavigationAction *action) { GtkWidget *item; WebKitWebHistoryItem *hitem; - const char *title, *url; + const char *url; + char *title; hitem = (WebKitWebHistoryItem*)l->data; url = webkit_web_history_item_get_uri (hitem); - title = webkit_web_history_item_get_title (hitem); - item = new_history_menu_item (title ? title : url, url); + title = g_strdup (webkit_web_history_item_get_title (hitem)); + + if ((title == NULL || g_strstrip (title)[0] == '\0')) + item = new_history_menu_item (url, url); + else + item = new_history_menu_item (title, url); + + g_free (title); g_object_set_data_full (G_OBJECT (item), HISTORY_ITEM_DATA_KEY, g_object_ref (hitem), g_object_unref); -- cgit v1.2.3