From ce5c764b6383dc23ea5e4cd238e501ecda89161c Mon Sep 17 00:00:00 2001 From: mkasik Date: Wed, 28 Jan 2009 14:46:27 +0000 Subject: [PATCH] - modify default_printer.patch to show a network default printer in the case of no local default printer - Resolves: #478400 --- default_printer.patch | 80 ++++++++++++++++++++++++++++++++++++++----- gtk2.spec | 7 +++- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/default_printer.patch b/default_printer.patch index fc8b0f6..a74d415 100644 --- a/default_printer.patch +++ b/default_printer.patch @@ -1,12 +1,76 @@ --- modules/printbackends/cups/gtkprintbackendcups.c 2009-01-01 20:41:58.000000000 +0100 -+++ modules/printbackends/cups/gtkprintbackendcups.c 2009-01-19 13:31:59.000000000 +0100 -@@ -1303,7 +1303,8 @@ cups_request_printer_list_cb (GtkPrintBa - else if (strcmp (attr->name, "printer-type") == 0) - { - got_printer_type = TRUE; -- if (attr->values[0].integer & 0x00020000) -+ if ((attr->values[0].integer & 0x00020000) && -+ !(attr->values[0].integer & 0x00000002)) ++++ modules/printbackends/cups/gtkprintbackendcups.c 2009-01-21 13:54:39.000000000 +0100 +@@ -1103,6 +1103,7 @@ cups_request_printer_list_cb (GtkPrintBa + ipp_t *response; + gboolean list_has_changed; + GList *removed_printer_checklist; ++ gchar *remote_default_printer = NULL; + + GDK_THREADS_ENTER (); + +@@ -1190,6 +1191,7 @@ cups_request_printer_list_cb (GtkPrintBa + gboolean is_accepting_jobs = TRUE; + gboolean default_printer = FALSE; + gboolean got_printer_type = FALSE; ++ gboolean remote_printer = FALSE; + + /* Skip leading attributes until we hit a printer... + */ +@@ -1307,6 +1309,11 @@ cups_request_printer_list_cb (GtkPrintBa default_printer = TRUE; else default_printer = FALSE; ++ ++ if (attr->values[0].integer & 0x00000002) ++ remote_printer = TRUE; ++ else ++ remote_printer = FALSE; + } + else + { +@@ -1330,8 +1337,16 @@ cups_request_printer_list_cb (GtkPrintBa + { + if (default_printer && !cups_backend->got_default_printer) + { +- cups_backend->got_default_printer = TRUE; +- cups_backend->default_printer = g_strdup (printer_name); ++ if (!remote_printer) ++ { ++ cups_backend->got_default_printer = TRUE; ++ cups_backend->default_printer = g_strdup (printer_name); ++ } ++ else ++ { ++ if (remote_default_printer == NULL) ++ remote_default_printer = g_strdup (printer_name); ++ } + } + } + else +@@ -1552,6 +1567,26 @@ done: + + gtk_print_backend_set_list_done (backend); + ++ if (!cups_backend->got_default_printer && remote_default_printer != NULL) ++ { ++ cups_backend->default_printer = g_strdup (remote_default_printer); ++ cups_backend->got_default_printer = TRUE; ++ g_free (remote_default_printer); ++ ++ if (cups_backend->default_printer != NULL) ++ { ++ GtkPrinter *default_printer = NULL; ++ default_printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (cups_backend), ++ cups_backend->default_printer); ++ if (default_printer != NULL) ++ { ++ gtk_printer_set_is_default (default_printer, TRUE); ++ g_signal_emit_by_name (GTK_PRINT_BACKEND (cups_backend), ++ "printer-status-changed", default_printer); ++ } ++ } ++ } ++ + GDK_THREADS_LEAVE (); + } + diff --git a/gtk2.spec b/gtk2.spec index a48c832..50df232 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -16,7 +16,7 @@ Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X Name: gtk2 Version: %{base_version} -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ Group: System Environment/Libraries Source: http://download.gnome.org/sources/gtk+/2.15/gtk+-%{version}.tar.bz2 @@ -297,6 +297,11 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/gtk-2.0 %changelog +* Wed Jan 28 2009 Marek Kasik - 2.15.2-3 +- modify default_printer.patch to show a network default printer + in the case of no local default printer +- Resolves: #478400 + * Tue Jan 27 2009 Matthias Clasen - 2.15.2-2 - Fix togglebuttons causing crashes