summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2008-03-12 01:36:35 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2008-03-12 01:36:35 +0000
commitc7583f3773c5934c2f732394d552460fc71f67c6 (patch)
treed939e0f0f01bdb6ced995d85d5930c41477e84f3
parentbaa373e64a9a1c5110126f8f1be1782630b09a0e (diff)
downloadgdk-pixbuf-c7583f3773c5934c2f732394d552460fc71f67c6.tar.gz
Use g_ascii_formatd when formatting custom paper sizes, since cups doesn't
2008-03-11 Matthias Clasen <mclasen@redhat.com> * modules/printbackends/cups/gtkprintbackendcups.c: Use g_ascii_formatd when formatting custom paper sizes, since cups doesn't handle , as decimal separator. (#521548) svn path=/branches/gtk-2-12/; revision=19763
-rw-r--r--ChangeLog8
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c17
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 55a375dbe..f0ac8db1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-11 Matthias Clasen <mclasen@redhat.com>
+
+ Merged from trunk:
+
+ * modules/printbackends/cups/gtkprintbackendcups.c: Use
+ g_ascii_formatd when formatting custom paper sizes, since
+ cups doesn't handle , as decimal separator. (#521548)
+
2008-03-11 Tor Lillqvist <tml@novell.com>
Bug 469868 - Filenames with colon ":" are not saved correctly
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index b40c110b0..fd1691691 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -2464,10 +2464,12 @@ cups_printer_get_options (GtkPrinter *printer,
else
{
gchar *custom_name;
+ char width[G_ASCII_DTOSTR_BUF_SIZE];
+ char height[G_ASCII_DTOSTR_BUF_SIZE];
- custom_name = g_strdup_printf (_("Custom %.2fx%.2f"),
- gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS),
- gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS));
+ g_ascii_formatd (width, sizeof (width), "%.2f", gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS));
+ g_ascii_formatd (height, sizeof (height), "%.2f", gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS));
+ custom_name = g_strdup_printf (_("Custom %sx%s"), width, height);
strncpy (option->defchoice, custom_name, PPD_MAX_NAME);
g_free (custom_name);
}
@@ -2977,9 +2979,12 @@ cups_printer_prepare_for_print (GtkPrinter *printer,
gtk_print_settings_set (settings, "cups-PageSize", ppd_paper_name);
else
{
- char *custom_name = g_strdup_printf ("Custom.%2fx%.2f",
- gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS),
- gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS));
+ char width[G_ASCII_DTOSTR_BUF_SIZE];
+ char height[G_ASCII_DTOSTR_BUF_SIZE];
+
+ g_ascii_formatd (width, sizeof (width), "%.2f", gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS));
+ g_ascii_formatd (height, sizeof (height), "%.2f", gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS));
+ char *custom_name = g_strdup_printf (("Custom.%sx%s"), width, height);
gtk_print_settings_set (settings, "cups-PageSize", custom_name);
g_free (custom_name);
}