Commit Graph

389 Commits

Author SHA1 Message Date
Matthias Clasen
ade1aaa8be printing: Add context to some strings
The job priority strings need context to disambiguate them from
similar short strings elsewhere.
2024-04-04 16:56:50 +02:00
Marek Kasik
fb3d8b8523 printing: Avoid accessing freed printers
Print backend can be disposed together with all its printers
as a reaction to user stopping enumeration of printers.
Adding a weak pointer help us to detect that the backend
was disposed and hence the backend and its printers should not
be used anymore.

Fixes #6265
2024-03-13 11:17:42 +01:00
Matthias Clasen
ae5ea8e495 printing: Convert headers to #pragma once
That is our current coding style.
2023-12-20 09:44:29 -05:00
Andrey Kutejko
540a83327f Fix issues spotted by PVS-Studio 2023-11-14 08:56:40 +01:00
Benjamin Otte
310ab7b531 Remove G_ENABLE_DEBUG around debug checks
It started out as busywork, but it does many separate things. If I could
start over, I'd take them apart into multiple commits:

1. Remove G_ENABLE_DEBUG around GDK_DEBUG_*() calls
   This is not needed at all, the calls themselves take care of it.

2. Remove G_ENABLE_DEBUG around profiling code
   This now enables profiling support in release builds.

3. Stop poking _gdk_debug_flags and use GDK_DEBUG_CHECK()
   This was old code that was never updated.

4. Make !G_ENABLE_DEBUG turn off GDK_DEBUG_CHECK()
   The code used to
     #define GDK_DEBUG_CHECK(...) false
     #define GDK_DEBUG(...)
   which would compile away all the code inside those macros. This
   means a lot of variable definitions and debug utility functions
   would suddenly no longer be used and cause compiler errors.
2023-11-05 11:16:23 +01:00
Jeremy Bícha
08d08678e8 print: Update printerprivate header location for cpdb backend
This fixes the print-cpdb build option
2023-08-08 17:55:54 -04:00
Matthias Clasen
30ff352960 print: Maintain compatibility
gtkunixprint.h is a public header, that needs
to keep being installed in the same location.
2023-06-07 07:16:26 -04:00
Matthias Clasen
d1aae4bffa print: Move all the remaining sources
Move the unix- and Windows-specific print
sources to the gtk/print subdirectory.
2023-06-07 00:06:33 -04:00
Matthias Clasen
19362522e0 print: Rename private headers
Rename private print-related headers to follow our
naming conventions:
gtkprintutils.h -> gtkprintutilsprivate.h
gtkprinteroption.h -> gtkprinteroptionprivate.h
gtkprinteroptionset.h => gtkprinteroptionsetprivate.h
gtkprinteroptionwidget.h -> gtkprinteroptionwidgetprivate.h
2023-06-06 22:32:18 -04:00
Matthias Clasen
5f39820729 cups: Silence a compiler warning
Bitfields should be unsigned int.
2023-05-18 14:39:46 -04:00
Matthias Clasen
bcb0882208 modules: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
06d3bbafaf printing: Avoid getrandom
GLib has perfectly serviceable random number
apis, and this breaks the macOs build.
2023-02-17 17:20:44 -05:00
tinytrebuchet
300670dad4 Update dependencies for CPDB print backend
Require cpdb-frontend 2.x for building CPDB print backend.
2023-02-14 23:39:13 +05:30
Matthias Clasen
dd22e2aea9 printing: Drop the lpr backend
We want to consolidate and get to fewer print
backends (ideally only one), and the future is cpdb.
2023-02-12 10:10:06 -05:00
tinytrebuchet
41b60bbd6c New CPDB print backend for GTK Print Dialog
The Common Print Dialog Backends (CPDB) concept has GUI-toolkit-independent
backends for each print technology (CUPS, Print to File, cloud printing
services, ...) and each print dialog (GTK, Qt, Chromium, ...) is supposed
to use this backend, so that changes in print technologies can be centrally
and quickly covered by changing the backends and everything new gets available
in all print dialogs.

This commit provides a GTK print dialog backend to add support for the CPDB
concept. It communicates with all installed CPDB backends and so gives support
for all these print technologies to the GTK print dialog.

To make use of CPDB the GTK print dialog is supposed to be installed with this
backend and the 'Print To File' backend, and not any others to prevent printer
duplication.
2023-02-11 01:13:48 +05:30
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
0a6f3944a0 Revert "modules: Fix build on Visual Studio"
This reverts commit acd9c12667.

This commit breaks the build with GLib main on all platforms,
and defining _GLIB_EXTERN arguably invades the GLib namespace.

A different fix for msvc will have to be found.
2022-10-31 20:20:32 -04:00
Kjell Ahlstedt
9db812ea7f gtkprintbackendlpr.c: Add #include "gtkprivate.h"
Necessary after GTK_NOTE was replaced by GTK_DEBUG.
GTK_DEBUG is defined in gtk/gtkprivate.h. GTK_NOTE was defined
in gtk/gtkdebug.h.
2022-09-26 18:38:06 +02:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Matthias Clasen
f33f55bcbb gtk: Use the new debug macros 2022-09-23 18:12:39 -04:00
Matthias Clasen
62192cba6e cups printbackend: Plug memory leaks
This loop has many early exits, and all of them
need to free this info object that gets allocated
at the beginning.
2022-08-12 18:44:25 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Patrick Griffis
af15f5d004 Remove Google Cloud Print backend
This service was shut down at the start of 2021.

This helpfully removes any dependency on json-glib, librest (and libsoup).
2021-07-05 10:54:16 -05:00
Matthias Clasen
f472cb53ae printbackendlpr: Static analysis fixes 2021-05-03 07:44:38 -04:00
Matthias Clasen
d882def373 Merge branch 'meson-install-script' into 'master'
Meson: Use gnome.install_script()

See merge request GNOME/gtk!3135
2021-03-22 12:45:45 +00:00
Matthias Clasen
6d5657eee7 lpr: Fix various compiler warnings
gcc 11 is warning about some const mixups here.
Fix them.
2021-03-17 07:56:07 -04:00
Xavier Claessens
629e70f89d Meson: Use gnome.post_install()
See https://github.com/mesonbuild/meson/pull/8272 and
https://github.com/mesonbuild/meson/issues/8268.
2021-03-08 21:19:09 -05:00
Emmanuele Bassi
78e3908a00 gtk: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
2021-02-11 14:22:22 +00:00
Matthias Clasen
055cd9aaad Merge branch 'printing-temporary-queues-gtk4' into 'master'
printing: Create temporary queues for Avahi printers

See merge request GNOME/gtk!3160
2021-02-07 16:13:46 +00:00
David Lechner
b509809f34 meson: use correct module file extension on macOS
GModule requires the .so file extension on macOS for historic reasons.
However Meson defaults to .dylib for modules, so we need to override
it to get the correct extension.

Fixes #3645.
2021-02-05 16:54:28 -06:00
Marek Kasik
a93ab37ea9 printing: Show all Avahi advertised printers
This commit unsubscribes CUPS backend from a DBus
signal in idle when listening for new items on Avahi.

Since GDBus emits gathered signals in idle while
checking whether the signal has been unsubscribed
it could happen that a signal was not processed
because it was removed from hash table of
subscribed signals.
This caused the situation where printers advertised
on Avahi were not listed in CUPS backend sometimes.

We need those signals since this happens when switching
from a general subscription which listens to signals
for all Avahi services to a specific one which listens
to just _ipp._tcp and _ipps._tcp (chicken and egg problem).
2021-02-05 18:35:56 +01:00
Marek Kasik
5d7364960a printing: Create temporary queues for Avahi printers
This change extends set of Avahi advertised printers which
works with Gtk's CUPS print backend.

It creates a temporary queue (local printer) for each
Avahi printer in CUPS instead of accessing them directly
(via CUPS library).

This makes some printers work which did not work before and
also gives users more options to change in the print dialog.

This also changes naming of printers to be in accordance with CUPS.
It uses '_' instead of '-' and has hostname appended for CUPS remote
printers.
2021-02-05 18:35:56 +01:00
Matthias Clasen
93d795e7c0 printing: Remove cairo header checks
cc.has_header doesn't work with subprojects, and all this
check does is to make the build fail, so we can just...
let the build fail instead.
2021-01-03 21:34:04 -05:00
Matthias Clasen
20289ad8e1 Fix the value for the print-backends setting
This was broken in the meson conversion, causing
us to default to "" instead of the built print
backends.

Fixes: #3486
2020-12-21 14:10:03 -05:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Christian Hergert
ee47ddf5fd lpr: fix cast warning 2020-11-18 20:16:40 -08:00
Benjamin Otte
6d7e56bed6 cloudprint: Make compile without warnings 2020-10-27 16:43:34 +01:00
Thomas Lange
0493e89897 Fix the build with cups < 2.2.12
PPD_CUSTOM_UNKNOWN was introduced in cups 2.3.
and has been backported to 2.2.12.
Only handle it when we build against a new enough cups.

Fixes: #2968
2020-10-26 19:16:26 +01:00
Xavier Claessens
1b7a99cb24 Apply 1 suggestion(s) to 1 file(s) 2020-10-22 00:36:23 +00:00
Xavier Claessens
a4aa6d79ad meson: Use feature options for media and print backends
This gracefully disable ffmpeg, gstreamer, cups and cloudprint optional
dependencies when they are not available, while still giving full
control to distributors using -Dauto_features=enabled.
2020-10-17 09:54:47 -04:00
Matthias Clasen
668868fb1f Merge branch 'master' into 'master'
Allow LPR backend to print PDF and PS file formats

See merge request GNOME/gtk!418
2020-10-07 20:51:40 +00:00
Matthias Clasen
028cd1e23a Revert "Fix the build with cups < 2.3"
This reverts commit d761e3cf2c.

I am seeing PPD_CUSTOM_UNKNOWN in the cups headers in our
ci images, and that is cups 2.2.12. So this commit was
mistaken.
2020-10-01 07:59:30 -04:00
Matthias Clasen
c4d350c260 build: Start using meson feature options
Use feature options for things that are optional features,
update the docs.

Visible changes here is that the 'print-backends' option
got renamed to 'print' to go better with 'media', and the
'tracker3' option got renamed to 'tracker'.

For options that have been changed into features, the
syntax now is -Dfeature=enabled or -Dfeature=disabled
or -Dfeature=auto.
2020-08-23 16:45:15 -04:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Marek Kasik
5a8f90357d printing: Use original names for remote CUPS printers
CUPS uses resource paths in the form of "printers/printer_name"
or "classes/class_name" so it is enough to remove the "printers/"
or "classes/" prefix and use the string behind it as a name.

There was recently introduced a wrong check for the prefix.
This commit fixes it in the way it was originally intended.
2020-08-20 13:54:02 +02:00
Simon McVittie
afcb9c0e63 cloudprint: Fix redundant declarations
G_DEFINE_DYNAMIC_TYPE declares these functions as static, and
-Werror=redundant-decls won't let us redeclare them. This is the
equivalent of 72c72d0b, but for a different backend.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-08-08 14:24:31 +01:00
Matthias Clasen
5ecf1431f0 cups: Don't emit a warning if we can't talk to avahi
The g_warning in this case makes the templates test
fail if it can't connect to the system bus (as is the
case for running installed tests in ci).
2020-08-01 23:24:36 -04:00
Matthias Clasen
d761e3cf2c Fix the build with cups < 2.3
PPD_CUSTOM_UNKNOWN was introduced in cups 2.3.
Only handle it when we build against a new enough cups.

Fixes: #2968
2020-07-31 10:01:45 -04:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00