Guest User

Untitled

a guest
Jul 21st, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. From 44339d44aebdbcb3150016e0ca8ce880fbb436da Mon Sep 17 00:00:00 2001
  2. From: Diego Escalante Urrelo <diegoe@gnome.org>
  3. Date: Mon, 11 Jan 2010 14:00:35 -0500
  4. Subject: [PATCH] Avoid blank items in back/forward menus
  5.  
  6. Use the url of the page as its menu label if there's no title set.
  7.  
  8. Bug #604491
  9. ---
  10. src/ephy-navigation-action.c | 13 ++++++++++---
  11. 1 files changed, 10 insertions(+), 3 deletions(-)
  12.  
  13. diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c
  14. index d19cf21..d3c3129 100644
  15. --- a/src/ephy-navigation-action.c
  16. +++ b/src/ephy-navigation-action.c
  17. @@ -236,13 +236,20 @@ build_back_or_forward_menu (EphyNavigationAction *action)
  18. {
  19. GtkWidget *item;
  20. WebKitWebHistoryItem *hitem;
  21. - const char *title, *url;
  22. + const char *url;
  23. + char *title;
  24.  
  25. hitem = (WebKitWebHistoryItem*)l->data;
  26. url = webkit_web_history_item_get_uri (hitem);
  27. - title = webkit_web_history_item_get_title (hitem);
  28.  
  29. - item = new_history_menu_item (title ? title : url, url);
  30. + title = g_strdup (webkit_web_history_item_get_title (hitem));
  31. +
  32. + if ((title == NULL || g_strstrip (title)[0] == '\0'))
  33. + item = new_history_menu_item (url, url);
  34. + else
  35. + item = new_history_menu_item (title, url);
  36. +
  37. + g_free (title);
  38.  
  39. g_object_set_data_full (G_OBJECT (item), HISTORY_ITEM_DATA_KEY,
  40. g_object_ref (hitem), g_object_unref);
  41. --
  42. 1.6.6
Add Comment
Please, Sign In to add comment