Commit Graph

361 Commits

Author SHA1 Message Date
Andre Heinecke
e99e282b5a Prevent empty password request popup for kerberos
If auth_info_required is only set to "negotiate" the
    request password dialog is shown anyway for each print
    job without any input fields. As the request_password
    dialog only handles username, password and domain.

    https://bugzilla.gnome.org/show_bug.cgi?id=669008
2015-03-09 14:19:57 +01:00
Marek Kasik
c2aff4ab6e printing: Set printer state correctly
Consider NULL printer state message as empty too.
Printer state IPP_PRINTER_STOPPED can be considered as paused state.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-03-02 10:51:07 +01:00
Marek Kasik
f74067dda2 printing: Always get details of Avahi printers via IPP
Request details of Avahi browsed printers even when
we've got their PPDs already. Some options are not
present in PPD.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:23 +01:00
Marek Kasik
979a4c1b08 printing: Get covers for each printer individually
Since we combine Avahi browsed printers and
printers of local CUPS in one backend we need to
get covers for each printer separately.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:19 +01:00
Marek Kasik
00f9f1cc6b printing: Use correct units for margins taken via IPP
cups_printer_get_hard_margins() returned margins in millimeters
for margins taken via IPP request instead of Units used before.
2015-02-20 12:27:12 +01:00
Marek Kasik
059fc5d3d9 printing: Fix build with CUPS older than 1.6
Define missing functions ippFirstAttribute(), ippNextAttribute()
and macro ippGetCollection(). These were added in CUPS 1.6.

https://bugzilla.gnome.org/show_bug.cgi?id=740358
2014-11-27 17:07:33 +01:00
Andre Heinecke
d9786d74db Remove overzealous validity check for secrets
We directly get the length of the secret from the g_variant
   and use it in a following g_strndup which ensures that the
   resulting string is terminated.

   This fixes reading secrets which were stored by system-config-printer.

https://bugzilla.gnome.org/show_bug.cgi?id=740612
2014-11-25 22:51:45 -05:00
Marek Kasik
a4a38dff0d Get media-col-default attribute correctly
Fix a typo which caused that "number-up-supported" and "media-col-default"
IPP attributes were not requested correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-16 15:02:59 +02:00
Marek Kasik
493aa4e9b3 Get duplex option via IPP
Request "sides-supported" and "sides-default" attributes through
IPP if there is no PPD for selected printer.
Pass "sides" option with other options in printer_get_options().
Add function setup_ipp_option() for creating of IPP option
of given name with passed choices and default value.
Mark such an option as "is-ipp-option" so we can distinguish it
later.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-13 11:58:18 +02:00
Marek Kasik
e78c3e2c8c Get paper sizes from IPP query
Query printer via IPP for paper sizes if there is no
or empty PPD file.
Parse "media-supported" and "media-size-supported" attributes for list
of paper sizes. Parse "media-default" and "media-col-default" attributes
for default settings.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-10 13:40:27 +02:00
Marek Kasik
a73c858f4b Remove dead code from CUPS backend
https://bugzilla.gnome.org/show_bug.cgi?id=725441
2014-10-10 13:40:24 +02:00
Marek Kasik
8b5d30d439 Remove redundant checks for NULL
Remove checks for NULL before g_free() and g_clear_object().
Merge check for NULL, freeing of pointer and its setting
to NULL by g_clear_pointer().

https://bugzilla.gnome.org/show_bug.cgi?id=733157
2014-10-02 19:06:03 +02:00
Matthias Clasen
7182ae4f45 printing: Better typography
Use U+201C/U+201D for quoting.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:22 -04:00
Matthias Clasen
60f0445233 Printing: Better typography
Use U+007D MULTPLICATION SIGN for dimensions.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:20 -04:00
Руслан Ижбулатов
45ab4ae09b build: Set no_undefined in Makefile.decl
This simplifies the code and - more importantly - fixes the cases like
in testsuite/reftests where the no_undefined definition was missing.

https://bugzilla.gnome.org/show_bug.cgi?id=736382
2014-09-15 16:35:40 +02:00
Andre Heinecke
382d68ff8e Use secrets service for cups auth_info
When a printer requires auth_info (e.g. a printer connected
    over the samba protocol) it is now possible to save the
    credentials necessary for printing if a secrets service
    is available over dbus.
    The auth_info is then stored / loaded from the default
    collection of that secrets service.
    If no such service is available the user is not shown
    the option to remember the password and the behavior
    remains the same as before.

    https://bugzilla.gnome.org/show_bug.cgi?id=674264
2014-09-01 22:39:51 +02:00
Simon McVittie
d329544e70 Use AC_USE_SYSTEM_EXTENSIONS to get _GNU_SOURCE, _XOPEN_SOURCE etc.
Similar to Bug #684123 in GLib.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=641638
Bug-Debian: https://bugs.debian.org/756476
Reviewed-by: Matthias Clasen
2014-08-21 09:54:12 +01:00
John Ralls
e3b8c4efeb Bug 729924 - Crash trying to print in OSX
We should only use the PageSize option from the ppd if it
actually exists.
2014-08-03 11:50:50 +02:00
Javier Jardón
c5b0ae5574 docs: Change documentation to consistenly use "Returns:"
Instead "Return value:" or "Return:"
2014-07-10 16:54:34 +01:00
Antoine Jacoutot
8ede929ef7 prevent redefinition of typedef GtkPrinterCloudprint
https://bugzilla.gnome.org/show_bug.cgi?id=727009
2014-03-25 12:24:41 +01:00
Marek Kasik
b95ce71b89 printing: Fail nicely when /tmp is not writable
Don't crash when /tmp is not writable when printing to file.
Show that getting of printer details failed for CUPS printers.

https://bugzilla.gnome.org/show_bug.cgi?id=693200
2014-03-17 14:37:34 -04:00
Rico Tzschichholz
239903d2f1 printbackends: Fix make dist 2014-03-03 07:33:53 +01:00
Tim Waugh
aaae0ca8ba New cloudprint GTK+ print module for Google Cloud Print.
This is a web service provided by Google that allows people to
share their printers (https://www.google.com/cloudprint/learn/).

In addition to being able to print to printers shared on Google Cloud
Print, there is an equivalent of "Print to file" in the form of "Save to
Google Drive".

The cloudprint module uses gnome-online-accounts to obtain the OAuth 2.0
access token for the Google account.

Currently it can discover available printers, get simple details about
them such as display name and status, and submit jobs without any
special options.

https://bugzilla.gnome.org/show_bug.cgi?id=723368
2014-02-28 11:45:03 +01:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Marek Kasik
9513d3b2a4 printing: Don't leak http connection to CUPS
Close http connection to CUPS after execution
of request which created it.

https://bugzilla.gnome.org/show_bug.cgi?id=720535
2013-12-19 12:59:26 +01:00
Marek Kasik
083f834dd7 printing: Don't double free connection to CUPS
Don't call httpClose() on http connections which are created
outside of GtkCupsRequest in GtkCupsRequest's functions.

https://bugzilla.gnome.org/show_bug.cgi?id=720338
2013-12-14 16:33:02 -05:00
Marek Kasik
118b09c68c printing: Fix memory leak when listing Avahi printers
Return values of g_variant_get_child_value() were not unreffed
correctly together with one value returned by g_variant_get().
Use g_variant_get_data() instead of copying each byte separately.

https://bugzilla.gnome.org/show_bug.cgi?id=712799
2013-11-25 10:27:39 +01:00
Marek Kasik
376e2c003d printing: Don't wake up Avahi printers unnecessarily
Use info available in Avahi TXT records for creation of gtk printer
and request details when needed (through gtk_printer_request_details()).
If there is a printer advertised on Avahi by a remote CUPS server
try to get its PPD file at first or get its capabilities through an IPP
request if it fails.

https://bugzilla.gnome.org/show_bug.cgi?id=712751
2013-11-21 15:44:45 +01:00
Siegfried Gevatter (RainCT)
f682aabf74 Add print to PDF to recent manager
Printing a file with to PDF/etc. with the virtual printer option doesn't add
the file to the list of recently used files. It should be there, so I can
easily access it.

https://bugzilla.gnome.org/show_bug.cgi?id=668598
2013-11-14 03:56:47 -05:00
Carlos Garcia Campos
6130f076be gtkprintbackendfile: Check the GtkPrintSettings passed to file_printer_get_options is not NULL before using it
https://bugzilla.gnome.org/show_bug.cgi?id=703784
2013-11-09 11:57:17 -05:00
Bastien Nocera
438cd857c4 all: Add names to timeouts
Add names to every timeout we setup, so it's easier to track their
usage, and debug possible misbehaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=710651
2013-10-23 13:31:18 +02:00
Timothy Arceri
c759cb7140 Remove unused function
https://bugzilla.gnome.org/show_bug.cgi?id=586107
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
2013-10-06 01:27:06 -04:00
Timothy Arceri
481fc6b850 Remove a bunch of unused variables.
https://bugzilla.gnome.org/show_bug.cgi?id=586107
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
2013-10-06 01:27:06 -04:00
Timothy Arceri
dae0951db4 Dont set enum to NULL fixes build issues on Solaris 10
https://bugzilla.gnome.org/show_bug.cgi?id=586107
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
2013-10-06 01:27:06 -04:00
Marek Kasik
f29841a03e printing: Show correct status of a job
"job-state" is IPP_TAG_ENUM not IPP_TAG_INTEGER.
2013-06-06 11:09:36 +02:00
Marek Kasik
bdf40603d5 printing: Don't crash when printer-state-message not provided
Check whether "printer-state-message" was returned before its
usage.

https://bugzilla.gnome.org/show_bug.cgi?id=699750
2013-05-09 15:13:59 +02:00
Carlos Garcia Campos
2adacca119 gtkprintbackendfile: Fix infinite loop in _cairo_write()
It can happen if the io channel has been closed. In that case
g_io_channel_write_chars() returns early because of a g_return macro
that checks if the io channel is writable. When returning from g_return
macros, the bytes written output parameter is not updated and the error
is not filled, so the error is not detected and the written variable is
used uninitialized. We should check the return value of
g_io_channel_write_chars() to break the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=685419
2013-04-14 12:19:09 +02:00
Matthias Clasen
e2ec223cd7 Don't free a list that has not been initialized 2013-04-09 21:18:05 -04:00
Carlos Garcia Campos
5701681df4 gtkprintbackendcups: Fix a crash in avahi_create_browsers()
In avahi_request_printer_list() a new connection to the DBus system bus
is started asynchronously, but it's not cancellable and it's not taking
any reference of the GtkPrintBackendCups. This means that when the
callback is called, the object might have been destroyed already. We can
just pass the cancellable created and check for the cancelled error in
the callback before trying to use the GtkPrintBackendCups. The code to
cancel avahi operations and to unsibscribe from the DBus signals has
been moved from finalize to dispose to make sure it happens as soon as
possible.

https://bugzilla.gnome.org/show_bug.cgi?id=696553
2013-03-25 14:58:03 +01:00
Carlos Garcia Campos
b29cd63c38 gtkprintbackendcups: Fix a crash in gtk_print_backend_cups_finalize()
If GtkPrintBackendCups is finalized and cups_get_printer_list hasn't
been called, g_object_unref is called for the GDBusConnection pointer
that is NULL. Use g_clear_object() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=696546
2013-03-25 14:40:50 +01:00
Marek Kasik
05901bdbbd printing: Use DBus calls instead of Avahi API
Converts usage of Avahi API to DBus calls. This change allows
us to remove dependency on avahi-gobject and avoids of possible
circular dependency.
Lists printers if Gtk+ is compiled with CUPS 1.6 or newer.
2013-03-13 15:33:56 +01:00
Marek Kasik
a727117acf printing: Remove usage of GError in connection test
Really remove usage of error in previous commit.

Related to
https://bugzilla.gnome.org/show_bug.cgi?id=695714
2013-03-13 15:25:45 +01:00
Marek Kasik
7529b95fab printing: Don't hang when getting info for Avahi printer
Asynchronously create testing connection to address returned
by GaServiceResolver. Don't request info for such printer if
the connection fails.

https://bugzilla.gnome.org/show_bug.cgi?id=695714
2013-03-13 14:59:10 +01:00
Marek Kasik
36d2324891 printing: Show Avahi printers on IPv6 network
Create correct URIs for printers on IPv6 networks.
2013-03-13 10:54:44 +01:00
Rico Tzschichholz
4054d531c3 printing: Fix build with -Werror=format-security 2013-03-06 22:26:21 +01:00
Marek Kasik
8075181033 printing: Mark texts for translation correctly
Use _() instead of N_() for printer states. Mark connection
string "; " for translation so it is correctly handled for
right to left languages.
2013-03-04 14:35:24 +01:00
Marek Kasik
4ba83ab573 printing: Remove unnecessary break
Remove the first space when connecting multiple printer states
together.

Related to
https://bugzilla.gnome.org/show_bug.cgi?id=688956
2013-03-04 14:34:21 +01:00
Marek Kasik
eed9e72e83 printing: List Avahi printers
Show printers advertised by avahi on local network. CUPS
backend now looks for _ipps._tcp and _ipp._tcp services
offered by avahi. If it finds such a service (printer)
it requests its attributes through IPP_GET_PRINTER_ATTRIBUTES
ipp request and adds it to the list of printers. Such printer
behaves like a remote printer then.
If an avahi printer is a default printer then it is considered
default by the backend only if there is no local or remote
default printer.
This functionality is enabled when building Gtk+ with CUPS 1.6
or later because it replaces browsing protocol removed in CUPS 1.6.

https://bugzilla.gnome.org/show_bug.cgi?id=688956
2013-03-04 14:30:49 +01:00
Matthias Clasen
9d36dbb44b Revert "Fix gtkprintbackendcups crash"
This reverts commit 54ffc982e9.

I've undone the GList behaviour change instead.
2013-03-01 19:13:30 -05:00
John Ralls
54ffc982e9 Fix gtkprintbackendcups crash
From trying to call g_list_delete_link with a NULL node or
removed_printer_checklist.
2013-03-01 10:14:59 -08:00
Marek Kasik
6f69a0fef6 printing: Call mark_printer_active() with correct parameters
Revert the second part of the commit
6ad6f719c6. mark_printer_active()
was called without its second parameter in g_list_free_full().
2012-12-04 15:48:08 +01:00
Benjamin Berg
fd301e7847 Use the ppd groups "name" instead of "text" (bug #687065)
This commit fixes a regression caused by a patch to remove Cups 1.2
ifdefs. This resulted in the "installable options" to appear in the
print dialog.
2012-11-29 10:02:08 +01:00
Christophe Fergeau
e8659679cd Sanitize memory handling in cups_request_printer_list_cb
gtk+ was trying to display already freed strings, leaking memory,
...I noticed this because I was getting weird blinking characters
as the status of my cups printers, and valgrind confirmed something
was wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=683072
2012-11-26 10:19:31 +01:00
Marek Kasik
be7752183e printing: Add "Custom." prefix only once to paper size
Check whether "Custom." prefix is already present in the name
of selected paper size. (#679883)
2012-09-19 18:03:41 +02:00
Adrian Johnson
dd7e8e9414 Don't rotate pdf landscape output 2012-09-12 15:38:37 +02:00
Marek Kasik
1d7ab22099 printing: Don't load custom paper sizes in file backend
Resolves #683474.
2012-09-06 14:32:31 +02:00
Rico Tzschichholz
e8dcfad441 cups: Use IPP api when necessary with CUPS 1.6 2012-08-05 09:56:58 +02:00
Matthias Clasen
3e78324501 modules: Don't use GDK_THREADS_ENTER/LEAVE macros internally
These are just wrappers for the functions, and we want to
deprecate them. Stopping to use them internally is a good
first step. Also define GTK_COMPILATION so we can keep using
gdk_threads_enter/leave without causing deprecation warnings.
2012-07-30 18:01:47 +02:00
Matthias Clasen
01a3345c06 file printbackend: Protect a callback by GDK_THREADS_ENTER
https://bugzilla.gnome.org/show_bug.cgi?id=649569
2012-05-17 00:11:15 -04:00
Timothy Arceri
8d1f32aaaf GTK PrintToFile settings
To make setting output directory and filename simpler in the PrintToFile
dialog two gtkprintsettings have been added GTK_PRINT_SETTINGS_OUTPUT_DIR
 and GTK_PRINT_SETTINGS_OUTPUT_BASENAME.

This will reduce the code needed to implement a better name than "output.pdf"
and actually makes more sense than the existing setting
GTK_PRINT_SETTINGS_OUTPUT_URI which doesn't work seamlessly with
GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT like the new settings do.

https://bugzilla.gnome.org/show_bug.cgi?id=657322
2012-05-14 14:26:53 +02:00
Matthias Clasen
18db64749f Fix build with --enable-debug 2012-04-30 07:07:33 -04:00
Richard Hughes
bf71b88319 Fix the colord support in GtkPrinterCups when the PPD is loaded async
If the PPD is not available when the printer is loaded then the PPD options are
not available and we can't get the correct qualifier to use with colord.

When the PPD becomes available, refresh the profile title to reflect reality.

https://bugzilla.gnome.org/show_bug.cgi?id=674890
2012-04-30 06:22:12 -04:00
John Ralls
46385aff03 Remove some more CUPS 1.2 ifdefs. 2012-04-23 12:44:06 -07:00
John Ralls
2c000c8e61 Bug 670373: modules/printing/cups/gtkprintbackendcups.c won't build with CUPS 1.6
Fix up accesses of ipp structures in gtkcupsutils.c
2012-04-23 12:44:06 -07:00
John Ralls
02f57f9642 Bug 670373: modules/printing/cups/gtkprintbackendcups.c won't build with CUPS 1.6
Having refactored cups_request_printer_list_cb so that the cups
version-dependent block size is small enough to be handled in a single ifdef,
make the ifdef HAVE_CUPS_API_1_6 block.
2012-04-23 12:44:06 -07:00
John Ralls
3e354a17ef Move some variable declarations into the scopes in which they're used. 2012-04-23 12:44:06 -07:00
John Ralls
58ca84584a Extract Function cups_create_printer 2012-04-23 12:44:06 -07:00
John Ralls
d10d34e0ec Extract function cups_printer_handle_attribute 2012-04-23 12:44:06 -07:00
John Ralls
651f7b4b93 Extract printer setup variables into a struct
So that it can be passed as a single parameter to functions as we extract-function to make cups_request_printer_list_cb more manageable.

Note that not all of the affected variables are changed in this changeset. Those are in extracted functions and will be addressed in the next two changes.
2012-04-23 12:44:06 -07:00
John Ralls
4945b832b2 Create enum PrinterStateLevel
Fixes "magic number" in printer_state_reason_level.
2012-04-23 12:44:06 -07:00
John Ralls
60969ff951 Extract reasons and reasons_desc arrays to file level
So that they can be used from more than one function. Rename them to avoid naming conflicts.
2012-04-23 12:44:06 -07:00
John Ralls
bfad99ad52 Bug 670373: modules/printing/cups/gtkprintbackendcups.c won't build with CUPS 1.6
The first, simple changes. Turns off the deprecation warnings and substitutes macros and short ifdef blocks where feasible.
2012-04-23 12:44:06 -07:00
Marek Kasik
2c1839ae5f printing: Localize loaded PPD files
Use ppdLocalize() to localize strings in loaded PPD file (#674326).
2012-04-20 17:09:58 +02:00
Marek Kasik
f6e2d0947d printing: Get default number-up value from CUPS
Requests "number-up-default" attribute from CUPS and
uses its value for setting value of "gtk-n-up" option.
(#672993)
2012-04-20 17:04:58 +02:00
Javier Jardón
80d54b4533 build: require cups >= 1.2
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=672182
2012-03-19 00:10:14 +00:00
Marek Kasik
abf1c57bd0 printing: Increase reference count for user data
Increase reference count for data passed to colord's callbacks (#671419).
2012-03-12 12:36:50 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Marek Kasik
9afe13bf91 printing: Don't crash when printing
This commit fixes crash which occurs in Firefox, Thunderbird and Inkscape
during printing. This crash was caused because of wrong handling of Custom
CUPS options. (#543520)
2012-01-31 12:15:43 +01:00
Matthias Clasen
585a6652d5 Use G_SOURCE_CONTINUE/REMOVE
Now that GLib provides these macros, we should use them
to make the code more readable.
2012-01-30 19:12:27 -05:00
Marek Kasik
e0d32d9456 printing: Fix a typo
Fix a typo which crashes on my printer.
2012-01-26 10:52:47 +01:00
Benjamin Berg
27f3c3c031 Strip "Custom." prefix when getting default options from cups. 2012-01-17 20:33:32 +01:00
Benjamin Berg
6fa6576dda 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.
2012-01-06 00:20:42 +01:00
Javier Jardón
6ad6f719c6 modules/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Jan Rękorajski
f807f7834f print dialog: Fix authentication logic
Reset state of CUPS requests correctly during authentization and
check CUPS requests for errors.
Don't initialize variables holding password and username with empty
string (#664640).
2011-12-14 14:09:48 +01:00
Benjamin Berg
94782e914c Fix polling for new data in cups print backend (bug #599664) 2011-08-06 10:37:21 +02:00
Javier Jardón
32e00d1f43 Use AM_CPPFLAGS instead the obsolete INCLUDES 2011-07-06 15:58:32 +01:00
Benjamin Otte
0bfb663d0c cups: Fix unused variable warning when not using colord 2011-06-10 15:01:04 +02:00
Richard Hughes
9bff51e538 Add optional colord support to the CUPS print module
This functionality adds a new 'Printer Profile' entry to the 'Color' page in the
UNIX print dialog if colord support is enabled.

This shows the user what color profile will be used for the settings they have
selected, and if no profile or the default profile is going to be used.

We are deliberately not allowing the user to _change_ the selected profile, as
the ICC profile is an implementation detail, and we should not change the other
print settings based on the characterization state.

The OpenICC group broadly recommend showing the profile that is used, so that
power users can be sure the correct profile is being used at the right time.

Normal users won't care, as they don't know how horrible the color match is
without profiling the printer and media.
2011-06-09 18:31:02 +01:00
Marek Kasik
9a0700e20c Check whether a resolution has been set in GtkPrintSettings
If resolution has not been set then use default resolution from ppd.

https://bugzilla.gnome.org/show_bug.cgi?id=635254
2011-03-21 11:11:09 -04:00
Matthias Clasen
524ce69bcb Bump the version to 3.0.0
At the same time, change the library sonames for -3.0 to just -3.
This is necessary since the 2.99 releases installed libraries like
libgtk-3.0.so.0.9903.0, and we want to prevent the library version
number from jumping back. So 3.0 will have libgtk-3.so.0.0.0.
2011-02-10 14:41:02 -05:00
Matthias Clasen
645650ae24 Silence unused variable warnings in the cups printbackend 2011-01-30 02:16:18 -05:00
Benjamin Otte
d1ecd28695 cups: Someone can neither type, read compiler output and run tests.
Being able to do one of these would have caught this.
2011-01-03 16:25:18 +01:00
Matthias Clasen
7537907baf cups printbackend: create a pdf surface when appropriate
This should address bug 560177.
Based on a patch by Adrian Johnson.
2011-01-03 09:34:04 -05:00
Adrian Johnson
ebcd0ba233 Set file GtkPrinter accepts_pdf/ps based on selected format 2011-01-03 08:14:34 -05:00
Adrian Johnson
856cc65f63 Set "accepts-pdf" property to true only if supported by the print backend 2011-01-03 08:14:34 -05:00
Robert Ancell
2013e23c4b Use getters and setters for GtkPrintJob in gtkprintbackendtest.c 2010-12-22 15:36:47 +11:00
Matthias Clasen
07d49ee56a Merge libgdk and libgtk
This commit does a number of things:
- remove some dead wchar configury from configure.ac and gdkconfig.h
- repurpose gdkconfig.h as header that contains GDK_WINDOWING_foo
  macros for each included backend, include it in gdk.h and install
  it in $includedir instead of below $libdir
- drop the backend from the library names
- build libgdk-3.0.la as a convenience lib and include it in libgtk-3.0.la
It does not yet enable building multiple backends at the same time.
2010-12-21 12:06:55 -05:00
Matthias Clasen
8105125369 Remove sealed members from GtkPrintJob
Also add accessors for these members, and use them in print backends.
2010-12-18 17:45:31 -05:00
Marek Kasik
0fe9e481dd Print files to Documents directory by default
Set default directory to G_USER_DIRECTORY_DOCUMENTS
when printing to file backend and fallback to the current
directory when it is not available (#633896).
2010-11-13 15:23:32 +09:00
Benjamin Otte
9e31ef616d cups: Add hack to work around gcc warning
gcc warns if you switch on values that are not part of the enum you're
switching on. So handle those cases in the default handler by using if
statments.

PS: Someone file a bug against cups about this?
2010-10-18 19:22:44 +02:00
Marek Kasik
95e69afea8 Parse lpoptions correctly
Parse options job-sheets, job-hold-until and sides correctly.
Add get_lpoption_name() for translation of lpoption names to
gtk option names. Usable for options which values don't need
conversion (e.g. number-up, number-up-layout, job-billing
and job-priority).
Rename array option_names to ppd_option_names to reflect its
purpose better. Rename get_option_name() to get_ppd_option_name()
because of the same reason.
2010-10-15 17:01:16 -04:00
Christian Dywan
e9a7a2104b Use and print note for key only if there are credentials
Otherwise key might be printed uninitialized.
2010-10-08 16:03:49 +02:00
Benjamin Otte
efefc4e794 cups: Fix compile warnings with --enable-debug 2010-09-27 20:48:43 +02:00
Tor Lillqvist
801875b805 Replace gtk_debug_flags with getter and setter functions
Preferrably should be made just into a local variable for libgtk like
_gdk_debug_flags for libgdk. But for now used by
gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.
2010-09-08 21:31:34 +03:00
Philip Withnall
5fa4a05ccc Miscellaneous string fixes
Mostly capitalisation fixes. Closes: bgo#528257
2010-08-22 15:06:45 +01:00
Matthias Clasen
0cb1f9a180 Make print backends use standard icon names for printers
This is to make the print dialog work with the previous commit.
See bug 626474.
2010-08-18 18:27:39 -04:00
Benjamin Otte
c90ba0a3be cups: Fix cast warnings 2010-07-26 16:42:46 +02:00
Marek Kasik
998459afb7 Don't handle CUPS' "connecting-to-device" state reason
CUPS backend shouldn't handle "connecting-to-device" state reason.
It shows "Printer '%s' may not be connected" for this state,
which is not true in almost all cases. Better is to use
"printer-state-message" which contains correct message (#622011).
2010-06-24 09:27:16 +02:00
Colin Walters
95bc0f5405 Use g_source_set_name for all custom GSources in GTK+
Naming the sources allows easier debugging with e.g. SystemTap
probes.

https://bugzilla.gnome.org/show_bug.cgi?id=620511
2010-06-03 21:49:22 -04:00
Marek Kasik
f8ac123192 Test connection to all given addresses when printing
Go to the next address given by CUPS if we fail to connect to
previous address (#603637).
2010-06-03 10:13:17 +02:00
Marek Kasik
33097d65b7 Honor PPD reading over listing of printers
Reading of PPD files collides with getting list of printers.
It helps to give higher priority to getting of PPDs than to
getting list of printers (#614581).
2010-05-24 16:39:19 +02:00
Matthias Clasen
7447ef0fc2 Make 3.0 parallel-installable to 2.x
In particular, rename

  - libraries to lib*-3.0.so
  - pc files to *-3.0.pc
  - include paths to /usr/include/gtk-3.0/*
  - module paths to /usr/lib/gtk-3.0/*
  - rc files names to gtk-3.0/gtkrc
  - commandline utilities to *-3.0
  - adjust documentation

Also change the install location for unix-print headers to
/usr/include/gtk-3.0/unix-print/gtk.
2010-05-08 01:18:53 -04:00
Marek Kasik
59e5e2dd5b Define httpGetHostname() for CUPS 1.1 and lower
Function httpGetHostname() is in CUPS since version 1.2, that is why we need
its equivalent for lower versions of CUPS (#610176).
2010-03-17 10:14:24 +01:00
Christian Persch
efa90e4182 Allow getting the printer's hard margins
Adds a way to get the unprintable area of the printer. Bug #468989.
2009-12-01 17:39:01 +01:00
Javier Jardón
ef414cc6bf Fix compilation warning: Cast to gchar* 2009-11-09 09:36:31 +01:00
Nicola Fontana
1e1131c959 Do not use static GTypeInfo and GInterfaceInfo
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.

https://bugzilla.gnome.org/show_bug.cgi?id=600158
2009-11-06 01:21:09 +01:00
Marek Kasik
50e784c405 Rotate number-up layout according to orientation when printing
Number-up layout has to be rotated differently since rotation in
"landscape" and "reversed landscape" mode was changed.
2009-10-27 16:53:43 +01:00
Javier Jardón
d5f1b79fab Fix compilation warnings: use G_GSIZE_FORMAT instead %i 2009-10-21 19:38:20 +02:00
Matthias Clasen
97d15954ad Move SIGPIPE suppression to gtk_init and document it
Some people were unhappy with doing it deep inside the lpr print
backend at an unpredictable time, and SIGPIPE is almost never
wanted anyway.
2009-10-01 11:45:28 -04:00
Marek Kasik
dd52987d1f Speed up printer listing in the print dialog
Use shorter timeout for connection testing to avoid A 3-6 second
delay before the printers appear. Bug 594643
2009-09-30 12:43:40 -04:00
Marek Kasik
a3e0766218 Add support for 'auth-info' attribute to the CUPS backend
Check for 'auth-info-required' attribute from printer attributes to
find out whether an authentization of user is needed.
Change password dialog of print backend to be able to require informations
requested thru 'auth-info-required' (#566522).
2009-09-24 15:34:56 +02:00
Marek Kasik
5f4915f624 Don't hang print dialog when remote CUPS printer is not available
This patch tests availability of remote host before getting ppd file
for selected printer (#586207). It also adds a state message for
failure of getting details.
2009-09-23 14:35:26 +02:00
Marek Kasik
f6ed1487bd Let GTK+ handle SIGPIPE signal itself when printing with lpr
When a SIGPIPE signal is raised during printing with lpr,
application should not be killed by the signal but a standard
error-workflow should be performed (bug #503776).
2009-09-16 09:59:56 +02:00
Matthias Clasen
be22a62160 Cleanups
This commit removes dead code, mostly pointed out by clang.
2009-09-10 13:53:28 -04:00
Matthias Clasen
ebf73f4096 Remove a dead assignment
Pointed out by clang.
2009-09-09 00:53:32 -04:00
Matthias Clasen
13147323d7 Forgotten part of the lpi change 2009-08-30 11:11:46 -04:00
Marek Kasik
f117777c20 Return meaningful default values for lpi and resolution
Change default values returned by gtk_print_settings_get_printer_lpi()
and gtk_print_settings_get_resolution{_x, _y}(). New values are 150 for
lpi and 300 for resolution (instead of 0) (#590861).
2009-08-29 21:34:05 -04:00
Marek Kasik
3b336186ee Add CUPS events as soon as possible when printing
CUPS events are added in prepare part of the main loop. These
events are initialized before their addition (#434318, #586466).
2009-08-29 21:32:01 -04:00
Marek Kasik
c21373dbe2 Use gtk-save icon for GtkPrintBackendFile
Use gtk-save icon instead of gtk-floppy for GtkPrintBackendFile.
2009-08-18 16:05:31 +02:00
Marek Kasik
3dc377a2ca Correctly select default printer when there is more than one (CUPS)
Select a local default printer if there is one instead of a remote
default printer (specified by the "printer-type" CUPS attribute)
(#591549).
2009-08-18 13:22:23 +02:00
Marek Kasik
70efa73311 Print when Enter pressed in certain GtkEntries of the print dialog
Print when Enter pressed in Name entry or Command Line entry in the
print dialog (#564695).
Add gtk_printer_option_set_activates_default() function and
gtk_printer_option_get_activates_default() function to control
behaviour of GtkPrinterOptionWidget.
2009-08-11 09:24:18 +02:00
Marek Kasik
94bc87c637 Get default cover sheets from each printer separately
Fixes bug #590309.
Add default_cover_before string and default_cover_after string
to GtkPrinterCups and fill it when getting list of printers.
2009-08-05 10:34:27 +02:00
Marek Kasik
39b960216c Add SVG support to GtkPrintBackendFile
This add support for printing to SVG 1.2 files (#357655).
2009-08-03 11:25:19 +02:00
Marek Kasik
961ab2e5c1 Print in correct order when printing 4 pages per sheet to landscape
Rotates page layout according to selected paper orientation
when printing through CUPS backend (#420335).
2009-06-04 18:49:29 +02:00
James Andrewartha
bd84d95e63 add missing include $(top_srcdir)/git.mk to modules/papi/Makefile.am
Signed-off-by: Davyd Madeley <davyd@madeley.id.au>
2009-05-21 14:45:25 +08:00
mark@ecs.vuw.ac.nz
1eff9aba24 Signalize that CUPS connection is available when EISCONN occurs
Add test for EISCONN error when testing whether a connection to CUPS server
is available (#576678 - patch by mark@ecs.vuw.ac.nz).

Signed-off-by: Marek Kasik <mkasik@redhat.com>
2009-05-19 16:08:21 +02:00
Davyd Madeley
3969d1b969 Add papi to DIST_SUBDIRS 2009-05-19 16:31:52 +08:00
Marek Kasik
91190ce281 Add ability to print in number-up mode for file backend and lpr backend
GtkPrintOperation is now able to render multiple pages per sheet by its
own. The most important changes are in these functions:
  * increment_page_sequence
  * prepare_data
  * common_render_page
  * print_pages_idle
Patch also changes set of choices for 2 pages per sheet mode when
landscape orientation is used to "Top to bottom" and "Bottom to top".
2009-05-13 18:28:42 +02:00
gheet
c57fc80465 Adding PAPI printbackend
Adding a new print backend module using libpapi detals see GNOME#382676.
(gheet)
2009-05-11 18:33:08 +01:00
Behdad Esfahbod
a398c840be Add git.mk to generate .gitignore files
Add four new doc templates that were not in repository.
2009-05-04 14:29:21 -04:00
Marek Kasik
2c5ae21cdc Adds authentication support of CUPS backend
Adds authentication support of CUPS backend against CUPS server.
Print dialog is now capable to ask user for password and pass it
to the CUPS server. It is also possible to authenticate user
through Kerberos (GSS-API) (#384940).
2009-04-21 14:24:32 +02:00
Marek Kasik
84125f1325 Bug 568571 – Asian am/pm format on cups print backend's time parsing
2009-02-12  Marek Kasik  <mkasik@redhat.com>

	Bug 568571 – Asian am/pm format on cups print backend's time parsing

	* modules/printbackends/cups/gtkprintbackendcups.c: Add Asian am/pm
	format into formats recognized by CUPS backend

svn path=/trunk/; revision=22319
2009-02-12 12:12:30 +00:00
Takao Fujiwara
16c207c27f Bug 571015 libprintbackend-cups has unlocalized strings
2009-02-10  Takao Fujiwara  <takao.fujiwara@sun.com>

	Bug 571015  libprintbackend-cups has unlocalized strings

	* modules/printbackends/cups/gtkprintbackendcups.c:
	Added a translator comment with the request of translators.


svn path=/trunk/; revision=22304
2009-02-10 17:32:47 +00:00
Takao Fujiwara
a4a9790285 Bug 571015 libprintbackend-cups has unlocalized strings
2009-02-09  Takao Fujiwara  <takao.fujiwara@sun.com>

	Bug 571015  libprintbackend-cups has unlocalized strings

	Reviewed by Matthias Clasen  <mclasen@redhat.com>

	* modules/printbackends/cups/gtkprintbackendcups.c (handle_option):
	Add translatable strings from ppd files.


svn path=/trunk/; revision=22294
2009-02-09 05:39:37 +00:00
Marek Kasik
6dbb29a5d4 Bug 561801 - "scheduled printing" doesn't function as expected
2009-01-21  Marek Kasik  <mkasik@redhat.com>
	Bug 561801 - "scheduled printing" doesn't function as expected

	* gtk/gtkprintunixdialog: Add tooltip.
	* modules/printbackends/cups/gtkprintbackendcups.c: Add conversion
	  from local time to utc time for scheduled printing.

svn path=/trunk/; revision=22158
2009-01-21 15:03:14 +00:00
Matthias Clasen
234881fd08 Clean up includes in test printbackend.
svn path=/trunk/; revision=21851
2008-12-08 00:44:50 +00:00
Marek Kasik
a3b07ac981 Bug 339714 - Set printer dpi on cairo ps/pdf surfaces when printing
2008-10-30  Marek Kasik  <mkasik@redhat.com>

	Bug 339714 - Set printer dpi on cairo ps/pdf surfaces when printing

	* gtk/gtk.symbols
	* gtk/gtkprintsettings.c
	* gtk/gtkprintsettings.h
	* docs/reference/gtk/gtk-sections.txt
	* modules/printbackends/file/gtkprintbackendfile.c
	* modules/printbackends/test/gtkprintbackendtest.c
	* modules/printbackends/cups/gtkprintbackendcups.c
	* modules/printbackends/lpr/gtkprintbackendlpr.c:
	Added lpi (lines per inch) setting to GtkPrintSettings and support
	for anamorphic dpi. Surface fallback resolution is set to 2*lpi.

svn path=/trunk/; revision=21733
2008-10-30 16:24:27 +00:00
Marek Kasik
1d7c1e13e8 Bug 344522 – support non-local destination files (GtkPrint):
2008-09-30  Marek Kasik  <mkasik@redhat.com>

	Bug 344522 – support non-local destination files (GtkPrint):

	* gtk/gtkprintunixdialog.c
	* gtk/gtkprinteroptionwidget.c: Process URI instead of filename.
	* modules/printbackends/file/gtkprintbackendfile.c: Add ability
	to save files on non-local filesystems.

svn path=/trunk/; revision=21552
2008-09-30 08:45:01 +00:00
Marek Kasik
f96d7b972b Bug 553241 – double freed pointer in lpr_write cause firefox3 crash
2008-09-25  Marek Kasik  <mkasik@redhat.com>

	Bug 553241 – double freed pointer in lpr_write cause firefox3 crash

	* modules/printbackends/lpr/gtkprintbackendlpr.c:
	The redundant freeing of memory was removed.

	Patch by Chris Wang

svn path=/trunk/; revision=21516
2008-09-25 11:46:35 +00:00
Matthias Clasen
8ec27f7760 Bug 346903 – gtk_enumerate_printers needs events to complete
2008-09-17  Matthias Clasen  <mclasen@redhat.com>

        Bug 346903 – gtk_enumerate_printers needs events to complete

        * gtk/gtkprintbackend.h:
        * gtk/gtkprintbackend.c: Add a GtkPrintBackend::status property.

        * modules/printbackends/cups/gtkcupsutils.h:
        * modules/printbackends/cups/gtkcupsutils.c: Turn the connection
        test into a tristate available/unavailable/in progress.

        * modules/printbackends/cups/gtkprintbackendcups.c: Use a single
        connection test instance for getting the default printer and for
        getting the printer list. Set the GtkPrintBackend::status property
        according to the result of the connection test. Use the printer-type
        attribute to find the default printer, if cups supports it.

        * gtk/gtkprinter.c: When enumerating printers, give up when
        the backend status is 'unavailable'.

        * gtk/gtkprintunixdialog.c (printer_status_cb): Select the printer
        when it is the default and nothing else has been selected yet.


svn path=/trunk/; revision=21417
2008-09-17 22:07:10 +00:00