gtk/modules/printbackends/meson.build
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

74 lines
2.1 KiB
Meson

print_backends = []
printbackends_subdir = 'gtk-4.0/@0@/printbackends'.format(gtk_binary_version)
printbackends_install_dir = join_paths(get_option('libdir'), printbackends_subdir)
gio_module_dirs += printbackends_install_dir
printbackends_args = [
'-DGTK_COMPILATION',
'-DGTK_DISABLE_DEPRECATION_WARNINGS',
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
] + common_cflags
cpdb_dep = dependency('cpdb-frontend', version : '>=1.0', required: get_option('print-cpdb'))
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
# Use cpdb backend if present and enabled.
# If not, use cups if present.
# If not, use lpr.
if get_option('print-cpdb').enabled() and cpdb_dep.found()
print_backends += 'cpdb'
shared_module('printbackend-cpdb',
sources: [
'gtkprintbackendcpdb.c',
'gtkprintercpdb.c',
'gtkprintbackendutils.c',
],
c_args: printbackends_args,
dependencies: [libgtk_dep, cpdb_dep],
install_dir: printbackends_install_dir,
install: true,
)
elif cups_dep.found()
print_backends += 'cups'
shared_module('printbackend-cups',
sources: [
'gtkprintbackendcups.c',
'gtkprintercups.c',
'gtkcupsutils.c',
'gtkcupssecretsutils.c',
'gtkprintbackendutils.c',
],
c_args: printbackends_args,
dependencies: [libgtk_dep, cups_dep, colord_dep],
name_suffix: module_suffix,
install_dir: printbackends_install_dir,
install: true,
)
else
# Automatic fall-back to the lpr backend
print_backends += 'lpr'
shared_module('printbackend-lpr',
sources: 'gtkprintbackendlpr.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
name_suffix: module_suffix,
install_dir: printbackends_install_dir,
install: true,
)
endif
# The 'file' print backend cannot be disabled
print_backends += 'file'
shared_module('printbackend-file',
sources: 'gtkprintbackendfile.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
name_suffix: module_suffix,
install_dir: printbackends_install_dir,
install: true,
)
cdata.set_quoted('GTK_PRINT_BACKENDS', ','.join(print_backends))