diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2012-02-15 20:35:57 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2012-02-15 20:35:57 +0000 |
commit | 1ffabe284d9f5a4ac055941d9817af71be1e5b54 (patch) | |
tree | 2b816cb3cc40a5f3053c8371de5613041272e298 /extra/gtk2 | |
parent | 650a87f5a67f6e71d4a56e52139a718d86ebbb46 (diff) |
Wed Feb 15 20:35:56 UTC 2012
Diffstat (limited to 'extra/gtk2')
-rw-r--r-- | extra/gtk2/cups-custom-print.patch | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/extra/gtk2/cups-custom-print.patch b/extra/gtk2/cups-custom-print.patch deleted file mode 100644 index ffc89aa32..000000000 --- a/extra/gtk2/cups-custom-print.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 8170436e61ea68c713d75ad374d22c3261be9203 Mon Sep 17 00:00:00 2001 -From: Benjamin Berg <benjamin@sipsolutions.net> -Date: Sat, 24 Dec 2011 16:26:32 +0000 -Subject: Set cups Custom print options correctly (bug #543520, patch by Marek Kašík) - -This patch fixes the cups print backend to pass Custom options with -the "Custom." prefix to cups if neccessary. ---- -diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c -index 14a1b5d..2751ee4 100644 ---- a/modules/printbackends/cups/gtkprintbackendcups.c -+++ b/modules/printbackends/cups/gtkprintbackendcups.c -@@ -483,22 +483,44 @@ cups_print_cb (GtkPrintBackendCups *print_backend, - GDK_THREADS_LEAVE (); - } - -+typedef struct { -+ GtkCupsRequest *request; -+ GtkPrinterOptionSet *options; -+} CupsOptionsData; -+ - static void - add_cups_options (const gchar *key, - const gchar *value, - gpointer user_data) - { -- GtkCupsRequest *request = user_data; -+ CupsOptionsData *data = (CupsOptionsData *) user_data; -+ GtkCupsRequest *request = data->request; -+ GtkPrinterOptionSet *options = data->options; -+ GtkPrinterOption *option = NULL; -+ gchar *new_value = NULL; - - if (!g_str_has_prefix (key, "cups-")) - return; - - if (strcmp (value, "gtk-ignore-value") == 0) - return; -+ -+ option = gtk_printer_option_set_lookup (options, key); - - key = key + strlen ("cups-"); - -- gtk_cups_request_encode_option (request, key, value); -+ /* Add "Custom." prefix to custom values */ -+ if (value && option && -+ !gtk_printer_option_has_choice (option, value)) -+ new_value = g_strdup_printf ("Custom.%s", value); -+ -+ if (new_value) -+ { -+ gtk_cups_request_encode_option (request, key, new_value); -+ g_free (new_value); -+ } -+ else -+ gtk_cups_request_encode_option (request, key, value); - } - - static void -@@ -511,8 +533,12 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, - { - GtkPrinterCups *cups_printer; - CupsPrintStreamData *ps; -+ CupsOptionsData *options_data; - GtkCupsRequest *request; - GtkPrintSettings *settings; -+ GtkPrinterOptionSet *options; -+ GtkPrintCapabilities capabilities; -+ GtkPageSetup *page_setup; - const gchar *title; - char printer_absolute_uri[HTTP_MAX_URI]; - -@@ -521,6 +547,8 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, - - cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job)); - settings = gtk_print_job_get_settings (job); -+ capabilities = cups_printer_get_capabilities (GTK_PRINTER (cups_printer)); -+ page_setup = gtk_printer_get_default_page_size (GTK_PRINTER (cups_printer)); - - request = gtk_cups_request_new_with_username (NULL, - GTK_CUPS_POST, -@@ -558,8 +586,18 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend, - IPP_TAG_NAME, "job-name", - NULL, title); - -- gtk_print_settings_foreach (settings, add_cups_options, request); -- -+ options = cups_printer_get_options (GTK_PRINTER (cups_printer), settings, page_setup, capabilities); -+ -+ options_data = g_new0 (CupsOptionsData, 1); -+ options_data->request = request; -+ options_data->options = options; -+ -+ gtk_print_settings_foreach (settings, add_cups_options, options_data); -+ -+ g_object_unref (page_setup); -+ g_object_unref (options); -+ g_free (options_data); -+ - ps = g_new0 (CupsPrintStreamData, 1); - ps->callback = callback; - ps->user_data = user_data; --- -cgit v0.9.0.2 |