[epiphany] location-entry: Be robust to paste translation issues
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] location-entry: Be robust to paste translation issues
- Date: Mon, 28 Nov 2016 20:10:28 +0000 (UTC)
commit 660f4616caed40456556f52b4c24a6003d17901b
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 eb31e80..e729dbb 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -620,6 +620,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,
@@ -664,14 +671,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]