diff options
author | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-11-28 14:09:16 -0600 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-11-28 14:12:42 -0600 |
commit | 1ac6d9348c7664be6910c3bb6748c3cbfdef47c3 (patch) | |
tree | 581ac75a2bb30545bccd7226763c132ac1c9d834 | |
parent | dc7a399b32b87d683bc5dcd162cef79859ec4ad3 (diff) | |
download | epiphany-1ac6d9348c7664be6910c3bb6748c3cbfdef47c3.tar.gz |
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
-rw-r--r-- | 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 fdf5f890b..0fe915969 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); |