[epiphany/gnome-3-22] location-entry: Be robust to paste translation issues



commit 1ac6d9348c7664be6910c3bb6748c3cbfdef47c3
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Nov 28 14:09:16 2016 -0600

    location-entry: Be robust to paste translation issues
    
    Don't crash if Epiphany has a different translation than GTK+, just get
    the translation from GTK+ instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772994

 lib/widgets/ephy-location-entry.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index fdf5f89..0fe9159 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -606,6 +606,13 @@ entry_undo_activate_cb (GtkMenuItem       *item,
   ephy_location_entry_reset_internal (entry, FALSE);
 }
 
+/* The build should fail here each time when upgrading to a new major version
+ * of GTK+, so that we don't forget to update this domain.
+ */
+#if GTK_MAJOR_VERSION == 3
+#define GTK_GETTEXT_DOMAIN "gtk30"
+#endif
+
 static void
 entry_populate_popup_cb (GtkEntry          *entry,
                          GtkMenu           *menu,
@@ -650,14 +657,12 @@ entry_populate_popup_cb (GtkEntry          *entry,
   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) {
+    if (g_strcmp0 (gtk_menu_item_get_label (item->data), g_dgettext (GTK_GETTEXT_DOMAIN, "_Paste")) == 0) {
       paste_menuitem = item->data;
       break;
     }
   }
-
-  if (!paste_menuitem)
-    g_error ("Broken translation, see bug #772994");
+  g_assert (paste_menuitem != NULL);
 
   g_signal_connect (paste_and_go_menuitem, "activate",
                     G_CALLBACK (entry_paste_and_go_activate_cb), lentry);


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