[epiphany] location-entry: Crash nicer if paste menuitem can't be found



commit fc05345d0d7acde7bb7208159bca39783937e50e
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 23 09:20:18 2016 -0500

    location-entry: Crash nicer if paste menuitem can't be found
    
    This is really unfortunate design, but I don't see any better way to
    implement the code, so we'll have to crash if the translation is wrong.
    
    Let's give a nice error message at least, and add a warning for the
    translators, since this is quite a trap otherwise.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772994

 lib/widgets/ephy-location-entry.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index d17680c..02d994d 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -663,12 +663,16 @@ entry_populate_popup_cb (GtkEntry          *entry,
   /* Search for the Paste menu item and insert right after it. */
   children = gtk_container_get_children (GTK_CONTAINER (menu));
   for (item = children, pos = 0; item != NULL; item = item->next, pos++) {
+    /* Translators: Location entry context menu item, must EXACTLY match GtkEntry's translation. */
     if (g_strcmp0 (gtk_menu_item_get_label (item->data), _("_Paste")) == 0) {
       paste_menuitem = item->data;
       break;
     }
   }
 
+  if (!paste_menuitem)
+    g_error ("Broken translation, see bug #772994");
+
   g_signal_connect (paste_and_go_menuitem, "activate",
                     G_CALLBACK (entry_paste_and_go_activate_cb), lentry);
   lentry->paste_binding = g_object_bind_property (paste_menuitem, "sensitive",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]