summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Borges <felipeborges@gnome.org>2016-04-12 15:55:19 +0200
committerFelipe Borges <felipeborges@gnome.org>2016-04-13 14:27:34 +0200
commit8e0c2a3fff88a578b721eb2f7d236f6459056aa2 (patch)
treef09352c71ddf71ba1dd648cb378292f5b47ed067
parent99763f3dd5fc75b2bb93a08403e8e278b799c0a0 (diff)
downloadgtk+-8e0c2a3fff88a578b721eb2f7d236f6459056aa2.tar.gz
cups: Fix more "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764585
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c61
1 files changed, 48 insertions, 13 deletions
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index 01f1f1ed72..9a4b733201 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -4402,16 +4402,52 @@ static const struct {
{ "output-bin", "face-down", NC_("output-bin", "Face Down Bin") },
/* Translators: Large capacity output bin */
{ "output-bin", "large-capacity", NC_("output-bin", "Large Capacity Bin") },
- /* Translators: Output stacker number %d */
- { "output-bin", "stacker-N", NC_("output-bin", "Stacker %d") },
- /* Translators: Output mailbox number %d */
- { "output-bin", "mailbox-N", NC_("output-bin", "Mailbox %d") },
- /* Translators: Private mailbox */
- { "output-bin", "my-mailbox", NC_("output-bin", "My Mailbox") },
- /* Translators: Output tray number %d */
- { "output-bin", "tray-N", NC_("output-bin", "Tray %d") }
+ { NULL, NULL, NULL }
};
+/*
+ * Handles "format not a string literal" error
+ * https://mail.gnome.org/archives/desktop-devel-list/2016-March/msg00075.html
+ */
+static const gchar *
+get_ipp_choice_translation_string (gint index,
+ guint i)
+{
+ const gchar *translation;
+ gchar *string;
+
+ if (i < G_N_ELEMENTS (ipp_choice_translations))
+ translation = ipp_choice_translations[i].translation;
+ else
+ {
+ switch (i)
+ {
+ case 14:
+ /* Translators: Output stacker number %d */
+ string = g_strdup_printf ("Stacker %d", index);
+ break;
+ case 15:
+ /* Translators: Output mailbox number %d */
+ string = g_strdup_printf ("Mailbox %d", index);
+ break;
+ case 16:
+ /* Translators: Private mailbox */
+ string = g_strdup ("My Mailbox");
+ break;
+ case 17:
+ /* Translators: Output tray number %d */
+ string = g_strdup_printf ("Tray %d", index);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ translation = NC_("output-bin", string);
+ }
+
+ return translation;
+}
+
static const struct {
const char *lpoption;
const char *name;
@@ -5143,7 +5179,7 @@ get_ipp_choice_translation (const gchar *ipp_option_name,
gchar *endptr;
gint i;
- for (i = 0; i < G_N_ELEMENTS (ipp_choice_translations); i++)
+ for (i = 0; ipp_choice_translations[i].ipp_option_name != NULL; i++)
{
if (g_strcmp0 (ipp_choice_translations[i].ipp_option_name, ipp_option_name) == 0)
{
@@ -5170,10 +5206,9 @@ get_ipp_choice_translation (const gchar *ipp_option_name,
if (index != 0 || endptr != nptr)
{
- translation = g_strdup_printf (g_dpgettext2 (GETTEXT_PACKAGE,
- ipp_option_name,
- ipp_choice_translations[i].translation),
- index);
+ translation = g_strdup (g_dpgettext2 (GETTEXT_PACKAGE,
+ ipp_option_name,
+ get_ipp_choice_translation_string (index, i)));
break;
}
}