From 50cf1c08ddbf79722a3dd3f9b117b5e05cd602ad Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Jun 2023 22:45:02 -0400 Subject: [PATCH 01/12] print: Install headers in a subdir This is a first step towards isolating the printing code within gtk. --- gtk/gtk.h | 12 ++++++------ gtk/gtkpagesetup.c | 4 ++-- gtk/gtkpagesetupunixdialog.c | 2 +- gtk/gtkpapersize.c | 4 ++-- gtk/gtkprintoperation-portal.c | 4 ++-- gtk/gtkprintoperation-portal.h | 2 +- gtk/gtkprintoperation-private.h | 2 +- gtk/gtkprintoperationpreview.c | 2 +- gtk/gtkprintsettings.c | 2 +- gtk/meson.build | 11 ++++------- gtk/{ => print}/gtkpagesetup.h | 2 +- gtk/{ => print}/gtkpapersize.h | 0 gtk/{ => print}/gtkprintcontext.h | 2 +- gtk/{ => print}/gtkprintoperation.h | 8 ++++---- gtk/{ => print}/gtkprintoperationpreview.h | 2 +- gtk/{ => print}/gtkprintsettings.h | 2 +- gtk/print/meson.build | 8 ++++++++ 17 files changed, 37 insertions(+), 32 deletions(-) rename gtk/{ => print}/gtkpagesetup.h (99%) rename gtk/{ => print}/gtkpapersize.h (100%) rename gtk/{ => print}/gtkprintcontext.h (98%) rename gtk/{ => print}/gtkprintoperation.h (98%) rename gtk/{ => print}/gtkprintoperationpreview.h (98%) rename gtk/{ => print}/gtkprintsettings.h (99%) create mode 100644 gtk/print/meson.build diff --git a/gtk/gtk.h b/gtk/gtk.h index 8ad4e38902..c5f9b4b583 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -200,19 +200,19 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/gtk/gtkpagesetup.c b/gtk/gtkpagesetup.c index 588e43d8e7..5e77236127 100644 --- a/gtk/gtkpagesetup.c +++ b/gtk/gtkpagesetup.c @@ -18,9 +18,9 @@ #include "config.h" -#include "gtkpagesetup.h" +#include "print/gtkpagesetup.h" #include "gtkprintutilsprivate.h" -#include "gtkprintoperation.h" /* for GtkPrintError */ +#include "print/gtkprintoperation.h" /* for GtkPrintError */ #include #include "gtktypebuiltins.h" diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c index e9f5cfd6ab..c0de95de55 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/gtkpagesetupunixdialog.c @@ -33,7 +33,7 @@ #include "gtkpagesetupunixdialog.h" #include "gtkcustompaperunixdialog.h" #include "gtkprintbackendprivate.h" -#include "gtkpapersize.h" +#include "print/gtkpapersize.h" #include "gtkprintutilsprivate.h" #include "deprecated/gtkdialogprivate.h" diff --git a/gtk/gtkpapersize.c b/gtk/gtkpapersize.c index 97bd96d49c..20fa327a64 100644 --- a/gtk/gtkpapersize.c +++ b/gtk/gtkpapersize.c @@ -26,9 +26,9 @@ #endif #include -#include "gtkpapersize.h" +#include "print/gtkpapersize.h" #include "gtkprintutilsprivate.h" -#include "gtkprintoperation.h" /* for GtkPrintError */ +#include "print/gtkprintoperation.h" /* for GtkPrintError */ #include /* _gtk_load_custom_papers() only on Unix so far */ diff --git a/gtk/gtkprintoperation-portal.c b/gtk/gtkprintoperation-portal.c index d39ad1645c..4f4c4ccaae 100644 --- a/gtk/gtkprintoperation-portal.c +++ b/gtk/gtkprintoperation-portal.c @@ -31,8 +31,8 @@ #include "gtkprintoperation-private.h" #include "gtkprintoperation-portal.h" -#include "gtkprintsettings.h" -#include "gtkpagesetup.h" +#include "print/gtkprintsettings.h" +#include "print/gtkpagesetup.h" #include "gtkprintbackendprivate.h" #include "gtkfilelauncher.h" #include diff --git a/gtk/gtkprintoperation-portal.h b/gtk/gtkprintoperation-portal.h index ee84b28f69..6aa1219213 100644 --- a/gtk/gtkprintoperation-portal.h +++ b/gtk/gtkprintoperation-portal.h @@ -17,7 +17,7 @@ #pragma once -#include "gtkprintoperation.h" +#include "print/gtkprintoperation.h" G_BEGIN_DECLS diff --git a/gtk/gtkprintoperation-private.h b/gtk/gtkprintoperation-private.h index 46833a63c5..f5daa45291 100644 --- a/gtk/gtkprintoperation-private.h +++ b/gtk/gtkprintoperation-private.h @@ -18,7 +18,7 @@ #pragma once -#include "gtkprintoperation.h" +#include "print/gtkprintoperation.h" G_BEGIN_DECLS diff --git a/gtk/gtkprintoperationpreview.c b/gtk/gtkprintoperationpreview.c index 423e352390..af4ae58799 100644 --- a/gtk/gtkprintoperationpreview.c +++ b/gtk/gtkprintoperationpreview.c @@ -18,7 +18,7 @@ #include "config.h" -#include "gtkprintoperationpreview.h" +#include "print/gtkprintoperationpreview.h" #include "gtkmarshalers.h" #include "gtkprivate.h" diff --git a/gtk/gtkprintsettings.c b/gtk/gtkprintsettings.c index 5daa6e6711..04a02e350e 100644 --- a/gtk/gtkprintsettings.c +++ b/gtk/gtkprintsettings.c @@ -23,7 +23,7 @@ #include -#include "gtkprintsettings.h" +#include "print/gtkprintsettings.h" #include "gtkprintutilsprivate.h" #include "gtktypebuiltins.h" #include "gtkwidget.h" diff --git a/gtk/meson.build b/gtk/meson.build index 65b13ffd48..824d3c0129 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -545,19 +545,13 @@ gtk_public_headers = files([ 'gtkoverlay.h', 'gtkoverlaylayout.h', 'gtkpadcontroller.h', - 'gtkpagesetup.h', 'gtkpaned.h', - 'gtkpapersize.h', 'gtkpasswordentry.h', 'gtkpasswordentrybuffer.h', 'gtkpicture.h', 'gtkpopover.h', 'gtkpopovermenu.h', 'gtkpopovermenubar.h', - 'gtkprintcontext.h', - 'gtkprintoperation.h', - 'gtkprintoperationpreview.h', - 'gtkprintsettings.h', 'gtkprogressbar.h', 'gtkrange.h', 'gtkrecentmanager.h', @@ -632,8 +626,11 @@ gtk_public_headers = files([ 'gtk.h', ]) +subdir('print') + install_headers(gtk_public_headers, subdir: 'gtk-4.0/gtk/') install_headers(gtk_deprecated_headers, subdir: 'gtk-4.0/gtk/deprecated') +install_headers(gtk_print_headers, subdir: 'gtk-4.0/gtk/print') gtk_sources = gtk_public_sources + gtk_private_sources @@ -958,7 +955,7 @@ gtkmarshalers = gnome.genmarshal('gtkmarshalers', gtkmarshal_h = gtkmarshalers[1] gtktypebuiltins = gnome.mkenums('gtktypebuiltins', - sources: gtk_public_headers + gtk_deprecated_headers, + sources: gtk_public_headers + gtk_deprecated_headers + gtk_print_headers, c_template: 'gtktypebuiltins.c.template', h_template: 'gtktypebuiltins.h.template', install_dir: gtk_includedir / 'gtk-4.0/gtk', diff --git a/gtk/gtkpagesetup.h b/gtk/print/gtkpagesetup.h similarity index 99% rename from gtk/gtkpagesetup.h rename to gtk/print/gtkpagesetup.h index 770db797a8..975e3d75b0 100644 --- a/gtk/gtkpagesetup.h +++ b/gtk/print/gtkpagesetup.h @@ -23,7 +23,7 @@ #error "Only can be included directly." #endif -#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkpapersize.h b/gtk/print/gtkpapersize.h similarity index 100% rename from gtk/gtkpapersize.h rename to gtk/print/gtkpapersize.h diff --git a/gtk/gtkprintcontext.h b/gtk/print/gtkprintcontext.h similarity index 98% rename from gtk/gtkprintcontext.h rename to gtk/print/gtkprintcontext.h index 3c09c366c2..d492959300 100644 --- a/gtk/gtkprintcontext.h +++ b/gtk/print/gtkprintcontext.h @@ -24,7 +24,7 @@ #endif #include -#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkprintoperation.h b/gtk/print/gtkprintoperation.h similarity index 98% rename from gtk/gtkprintoperation.h rename to gtk/print/gtkprintoperation.h index 2b6bb7075a..ccee5d8e16 100644 --- a/gtk/gtkprintoperation.h +++ b/gtk/print/gtkprintoperation.h @@ -26,10 +26,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkprintoperationpreview.h b/gtk/print/gtkprintoperationpreview.h similarity index 98% rename from gtk/gtkprintoperationpreview.h rename to gtk/print/gtkprintoperationpreview.h index 32ac15c447..b5b952f636 100644 --- a/gtk/gtkprintoperationpreview.h +++ b/gtk/print/gtkprintoperationpreview.h @@ -23,7 +23,7 @@ #endif #include -#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkprintsettings.h b/gtk/print/gtkprintsettings.h similarity index 99% rename from gtk/gtkprintsettings.h rename to gtk/print/gtkprintsettings.h index 507fae60fa..e3e51025f3 100644 --- a/gtk/gtkprintsettings.h +++ b/gtk/print/gtkprintsettings.h @@ -22,7 +22,7 @@ #error "Only can be included directly." #endif -#include +#include G_BEGIN_DECLS diff --git a/gtk/print/meson.build b/gtk/print/meson.build new file mode 100644 index 0000000000..8028cd520a --- /dev/null +++ b/gtk/print/meson.build @@ -0,0 +1,8 @@ +gtk_print_headers = files([ + 'gtkpagesetup.h', + 'gtkpapersize.h', + 'gtkprintcontext.h', + 'gtkprintoperation.h', + 'gtkprintoperationpreview.h', + 'gtkprintsettings.h', +]) From 434a747d4263d9cfcf54e7ed947342e1e88f2624 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Jun 2023 22:52:12 -0400 Subject: [PATCH 02/12] print: Move frontend sources Move the cross-platform printing sources to the gtk/print subdirectory. --- gtk/meson.build | 12 +++--------- gtk/{ => print}/gtkpagesetup.c | 4 ++-- gtk/{ => print}/gtkpapersize.c | 4 ++-- gtk/{ => print}/gtkprintcontext.c | 0 gtk/{ => print}/gtkprintoperation.c | 0 gtk/{ => print}/gtkprintoperationpreview.c | 2 +- gtk/{ => print}/gtkprintsettings.c | 2 +- gtk/{ => print}/gtkprintutils.c | 0 gtk/print/meson.build | 10 ++++++++++ 9 files changed, 19 insertions(+), 15 deletions(-) rename gtk/{ => print}/gtkpagesetup.c (99%) rename gtk/{ => print}/gtkpapersize.c (99%) rename gtk/{ => print}/gtkprintcontext.c (100%) rename gtk/{ => print}/gtkprintoperation.c (100%) rename gtk/{ => print}/gtkprintoperationpreview.c (99%) rename gtk/{ => print}/gtkprintsettings.c (99%) rename gtk/{ => print}/gtkprintutils.c (100%) diff --git a/gtk/meson.build b/gtk/meson.build index 824d3c0129..479a7b6269 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -1,6 +1,7 @@ subdir('a11y') subdir('deprecated') subdir('inspector') +subdir('print') gtk_cargs = [ '-DGTK_COMPILATION', @@ -128,7 +129,6 @@ gtk_private_sources = files([ 'gtkplacesviewrow.c', 'gtkpointerfocus.c', 'gtkpopovercontent.c', - 'gtkprintutils.c', 'gtkprivate.c', 'gtkprogresstracker.c', 'gtkrbtree.c', @@ -303,19 +303,13 @@ gtk_public_sources = files([ 'gtkoverlay.c', 'gtkoverlaylayout.c', 'gtkpadcontroller.c', - 'gtkpagesetup.c', 'gtkpaned.c', - 'gtkpapersize.c', 'gtkpasswordentry.c', 'gtkpasswordentrybuffer.c', 'gtkpicture.c', 'gtkpopover.c', 'gtkpopovermenu.c', 'gtkpopovermenubar.c', - 'gtkprintcontext.c', - 'gtkprintoperation.c', - 'gtkprintoperationpreview.c', - 'gtkprintsettings.c', 'gtkprogressbar.c', 'gtkpropertylookuplistmodel.c', 'gtkrange.c', @@ -407,6 +401,8 @@ gtk_public_sources = files([ 'gtkwindowhandle.c', ]) +gtk_public_sources += gtk_print_sources + gtk_private_type_headers = files([ 'gtkcsstypesprivate.h', 'gtktexthandleprivate.h', @@ -626,8 +622,6 @@ gtk_public_headers = files([ 'gtk.h', ]) -subdir('print') - install_headers(gtk_public_headers, subdir: 'gtk-4.0/gtk/') install_headers(gtk_deprecated_headers, subdir: 'gtk-4.0/gtk/deprecated') install_headers(gtk_print_headers, subdir: 'gtk-4.0/gtk/print') diff --git a/gtk/gtkpagesetup.c b/gtk/print/gtkpagesetup.c similarity index 99% rename from gtk/gtkpagesetup.c rename to gtk/print/gtkpagesetup.c index 5e77236127..588e43d8e7 100644 --- a/gtk/gtkpagesetup.c +++ b/gtk/print/gtkpagesetup.c @@ -18,9 +18,9 @@ #include "config.h" -#include "print/gtkpagesetup.h" +#include "gtkpagesetup.h" #include "gtkprintutilsprivate.h" -#include "print/gtkprintoperation.h" /* for GtkPrintError */ +#include "gtkprintoperation.h" /* for GtkPrintError */ #include #include "gtktypebuiltins.h" diff --git a/gtk/gtkpapersize.c b/gtk/print/gtkpapersize.c similarity index 99% rename from gtk/gtkpapersize.c rename to gtk/print/gtkpapersize.c index 20fa327a64..97bd96d49c 100644 --- a/gtk/gtkpapersize.c +++ b/gtk/print/gtkpapersize.c @@ -26,9 +26,9 @@ #endif #include -#include "print/gtkpapersize.h" +#include "gtkpapersize.h" #include "gtkprintutilsprivate.h" -#include "print/gtkprintoperation.h" /* for GtkPrintError */ +#include "gtkprintoperation.h" /* for GtkPrintError */ #include /* _gtk_load_custom_papers() only on Unix so far */ diff --git a/gtk/gtkprintcontext.c b/gtk/print/gtkprintcontext.c similarity index 100% rename from gtk/gtkprintcontext.c rename to gtk/print/gtkprintcontext.c diff --git a/gtk/gtkprintoperation.c b/gtk/print/gtkprintoperation.c similarity index 100% rename from gtk/gtkprintoperation.c rename to gtk/print/gtkprintoperation.c diff --git a/gtk/gtkprintoperationpreview.c b/gtk/print/gtkprintoperationpreview.c similarity index 99% rename from gtk/gtkprintoperationpreview.c rename to gtk/print/gtkprintoperationpreview.c index af4ae58799..423e352390 100644 --- a/gtk/gtkprintoperationpreview.c +++ b/gtk/print/gtkprintoperationpreview.c @@ -18,7 +18,7 @@ #include "config.h" -#include "print/gtkprintoperationpreview.h" +#include "gtkprintoperationpreview.h" #include "gtkmarshalers.h" #include "gtkprivate.h" diff --git a/gtk/gtkprintsettings.c b/gtk/print/gtkprintsettings.c similarity index 99% rename from gtk/gtkprintsettings.c rename to gtk/print/gtkprintsettings.c index 04a02e350e..5daa6e6711 100644 --- a/gtk/gtkprintsettings.c +++ b/gtk/print/gtkprintsettings.c @@ -23,7 +23,7 @@ #include -#include "print/gtkprintsettings.h" +#include "gtkprintsettings.h" #include "gtkprintutilsprivate.h" #include "gtktypebuiltins.h" #include "gtkwidget.h" diff --git a/gtk/gtkprintutils.c b/gtk/print/gtkprintutils.c similarity index 100% rename from gtk/gtkprintutils.c rename to gtk/print/gtkprintutils.c diff --git a/gtk/print/meson.build b/gtk/print/meson.build index 8028cd520a..78312aabd6 100644 --- a/gtk/print/meson.build +++ b/gtk/print/meson.build @@ -6,3 +6,13 @@ gtk_print_headers = files([ 'gtkprintoperationpreview.h', 'gtkprintsettings.h', ]) + +gtk_print_sources = files([ + 'gtkpagesetup.c', + 'gtkpapersize.c', + 'gtkprintcontext.c', + 'gtkprintoperation.c', + 'gtkprintoperationpreview.c', + 'gtkprintsettings.c', + 'gtkprintutils.c', +]) From d1aae4bffafac19eb2effcf162b2a61d8f4f1bb0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Jun 2023 23:14:39 -0400 Subject: [PATCH 03/12] print: Move all the remaining sources Move the unix- and Windows-specific print sources to the gtk/print subdirectory. --- gtk/gtkmain.c | 2 +- gtk/meson.build | 38 ++--------------- gtk/{ => print}/gtkcustompaperunixdialog.c | 0 gtk/{ => print}/gtkcustompaperunixdialog.h | 0 gtk/{ => print}/gtkpagesetupunixdialog.c | 2 +- gtk/{ => print}/gtkpagesetupunixdialog.h | 0 gtk/{ => print}/gtkprint-win32.c | 0 gtk/{ => print}/gtkprint-win32.h | 0 gtk/{ => print}/gtkprintbackend.c | 0 gtk/{ => print}/gtkprintbackendprivate.h | 4 +- gtk/{ => print}/gtkprinter.c | 0 gtk/{ => print}/gtkprinter.h | 0 gtk/{ => print}/gtkprinteroption.c | 0 gtk/{ => print}/gtkprinteroptionprivate.h | 0 gtk/{ => print}/gtkprinteroptionset.c | 0 gtk/{ => print}/gtkprinteroptionsetprivate.h | 0 gtk/{ => print}/gtkprinteroptionwidget.c | 0 .../gtkprinteroptionwidgetprivate.h | 2 +- gtk/{ => print}/gtkprinterprivate.h | 2 +- gtk/{ => print}/gtkprintjob.c | 0 gtk/{ => print}/gtkprintjob.h | 2 +- gtk/{ => print}/gtkprintoperation-portal.c | 4 +- gtk/{ => print}/gtkprintoperation-portal.h | 2 +- gtk/{ => print}/gtkprintoperation-private.h | 2 +- gtk/{ => print}/gtkprintoperation-unix.c | 0 gtk/{ => print}/gtkprintoperation-win32.c | 0 gtk/{ => print}/gtkprintunixdialog.c | 0 gtk/{ => print}/gtkprintunixdialog.h | 4 +- gtk/{ => print}/gtkprintutilsprivate.h | 0 gtk/{ => print}/gtkunixprint.h | 8 ++-- gtk/print/meson.build | 41 +++++++++++++++++++ gtk/{ => print}/paper_names.c | 0 gtk/{ => print}/paper_names_offsets.c | 0 modules/printbackends/gtkprintbackendcups.c | 8 ++-- modules/printbackends/gtkprintbackendcups.h | 2 +- modules/printbackends/gtkprintbackendfile.c | 2 +- modules/printbackends/gtkprintbackendfile.h | 2 +- modules/printbackends/gtkprintercups.h | 4 +- 38 files changed, 70 insertions(+), 61 deletions(-) rename gtk/{ => print}/gtkcustompaperunixdialog.c (100%) rename gtk/{ => print}/gtkcustompaperunixdialog.h (100%) rename gtk/{ => print}/gtkpagesetupunixdialog.c (99%) rename gtk/{ => print}/gtkpagesetupunixdialog.h (100%) rename gtk/{ => print}/gtkprint-win32.c (100%) rename gtk/{ => print}/gtkprint-win32.h (100%) rename gtk/{ => print}/gtkprintbackend.c (100%) rename gtk/{ => print}/gtkprintbackendprivate.h (99%) rename gtk/{ => print}/gtkprinter.c (100%) rename gtk/{ => print}/gtkprinter.h (100%) rename gtk/{ => print}/gtkprinteroption.c (100%) rename gtk/{ => print}/gtkprinteroptionprivate.h (100%) rename gtk/{ => print}/gtkprinteroptionset.c (100%) rename gtk/{ => print}/gtkprinteroptionsetprivate.h (100%) rename gtk/{ => print}/gtkprinteroptionwidget.c (100%) rename gtk/{ => print}/gtkprinteroptionwidgetprivate.h (99%) rename gtk/{ => print}/gtkprinterprivate.h (98%) rename gtk/{ => print}/gtkprintjob.c (100%) rename gtk/{ => print}/gtkprintjob.h (99%) rename gtk/{ => print}/gtkprintoperation-portal.c (99%) rename gtk/{ => print}/gtkprintoperation-portal.h (98%) rename gtk/{ => print}/gtkprintoperation-private.h (99%) rename gtk/{ => print}/gtkprintoperation-unix.c (100%) rename gtk/{ => print}/gtkprintoperation-win32.c (100%) rename gtk/{ => print}/gtkprintunixdialog.c (100%) rename gtk/{ => print}/gtkprintunixdialog.h (98%) rename gtk/{ => print}/gtkprintutilsprivate.h (100%) rename gtk/{ => print}/gtkunixprint.h (83%) rename gtk/{ => print}/paper_names.c (100%) rename gtk/{ => print}/paper_names_offsets.c (100%) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 9c07e3d652..573f250d8b 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -63,7 +63,7 @@ #include "gtkwidgetprivate.h" #include "gtkwindowprivate.h" #include "gtkwindowgroup.h" -#include "gtkprintbackendprivate.h" +#include "print/gtkprintbackendprivate.h" #include "gtkimmoduleprivate.h" #include "gtkroot.h" #include "gtknative.h" diff --git a/gtk/meson.build b/gtk/meson.build index 479a7b6269..7b8926451b 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -676,50 +676,18 @@ if os_unix and tracker3_dep.found() endif if os_unix - gtk_unix_print_headers = [ - 'gtkpagesetupunixdialog.h', - 'gtkprintunixdialog.h', - 'gtkprinter.h', - 'gtkprintjob.h', - 'gtkunixprint.h', - ] install_headers(gtk_unix_print_headers, subdir: 'gtk-4.0/unix-print/gtk') - - gtk_unix_print_sources = files([ - 'gtkcustompaperunixdialog.c', - 'gtkpagesetupunixdialog.c', - 'gtkprintbackend.c', - 'gtkprinter.c', - 'gtkprinteroption.c', - 'gtkprinteroptionset.c', - 'gtkprinteroptionwidget.c', - 'gtkprintjob.c', - 'gtkprintoperation-unix.c', - 'gtkprintoperation-portal.c', - 'gtkprintunixdialog.c', - ]) - gtk_sources += gtk_unix_print_sources endif if os_win32 - gtk_win32_print_headers = [] - gtk_win32_print_sources = files([ - 'gtkprint-win32.c', - 'gtkprintoperation-win32.c', - 'gtkfilechoosernativewin32.c', - 'gtkwin32.c', - ]) - gtk_sources += gtk_win32_print_sources gtk_sources += [ 'gtkcolorpickerwin32.c', - 'gtkimcontextime.c' + 'gtkimcontextime.c', + 'gtkfilechoosernativewin32.c', + 'gtkwin32.c', ] - - if cc.has_header_symbol('windows.h', 'IPrintDialogCallback') - cdata.set('HAVE_IPRINTDIALOGCALLBACK', 1) - endif endif if x11_enabled diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/print/gtkcustompaperunixdialog.c similarity index 100% rename from gtk/gtkcustompaperunixdialog.c rename to gtk/print/gtkcustompaperunixdialog.c diff --git a/gtk/gtkcustompaperunixdialog.h b/gtk/print/gtkcustompaperunixdialog.h similarity index 100% rename from gtk/gtkcustompaperunixdialog.h rename to gtk/print/gtkcustompaperunixdialog.h diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/print/gtkpagesetupunixdialog.c similarity index 99% rename from gtk/gtkpagesetupunixdialog.c rename to gtk/print/gtkpagesetupunixdialog.c index c0de95de55..e9f5cfd6ab 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/print/gtkpagesetupunixdialog.c @@ -33,7 +33,7 @@ #include "gtkpagesetupunixdialog.h" #include "gtkcustompaperunixdialog.h" #include "gtkprintbackendprivate.h" -#include "print/gtkpapersize.h" +#include "gtkpapersize.h" #include "gtkprintutilsprivate.h" #include "deprecated/gtkdialogprivate.h" diff --git a/gtk/gtkpagesetupunixdialog.h b/gtk/print/gtkpagesetupunixdialog.h similarity index 100% rename from gtk/gtkpagesetupunixdialog.h rename to gtk/print/gtkpagesetupunixdialog.h diff --git a/gtk/gtkprint-win32.c b/gtk/print/gtkprint-win32.c similarity index 100% rename from gtk/gtkprint-win32.c rename to gtk/print/gtkprint-win32.c diff --git a/gtk/gtkprint-win32.h b/gtk/print/gtkprint-win32.h similarity index 100% rename from gtk/gtkprint-win32.h rename to gtk/print/gtkprint-win32.h diff --git a/gtk/gtkprintbackend.c b/gtk/print/gtkprintbackend.c similarity index 100% rename from gtk/gtkprintbackend.c rename to gtk/print/gtkprintbackend.c diff --git a/gtk/gtkprintbackendprivate.h b/gtk/print/gtkprintbackendprivate.h similarity index 99% rename from gtk/gtkprintbackendprivate.h rename to gtk/print/gtkprintbackendprivate.h index be14331673..0e72f47cff 100644 --- a/gtk/gtkprintbackendprivate.h +++ b/gtk/print/gtkprintbackendprivate.h @@ -27,8 +27,8 @@ #endif #include -#include -#include +#include "gtkunixprint.h" +#include "gtkprinteroptionsetprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkprinter.c b/gtk/print/gtkprinter.c similarity index 100% rename from gtk/gtkprinter.c rename to gtk/print/gtkprinter.c diff --git a/gtk/gtkprinter.h b/gtk/print/gtkprinter.h similarity index 100% rename from gtk/gtkprinter.h rename to gtk/print/gtkprinter.h diff --git a/gtk/gtkprinteroption.c b/gtk/print/gtkprinteroption.c similarity index 100% rename from gtk/gtkprinteroption.c rename to gtk/print/gtkprinteroption.c diff --git a/gtk/gtkprinteroptionprivate.h b/gtk/print/gtkprinteroptionprivate.h similarity index 100% rename from gtk/gtkprinteroptionprivate.h rename to gtk/print/gtkprinteroptionprivate.h diff --git a/gtk/gtkprinteroptionset.c b/gtk/print/gtkprinteroptionset.c similarity index 100% rename from gtk/gtkprinteroptionset.c rename to gtk/print/gtkprinteroptionset.c diff --git a/gtk/gtkprinteroptionsetprivate.h b/gtk/print/gtkprinteroptionsetprivate.h similarity index 100% rename from gtk/gtkprinteroptionsetprivate.h rename to gtk/print/gtkprinteroptionsetprivate.h diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/print/gtkprinteroptionwidget.c similarity index 100% rename from gtk/gtkprinteroptionwidget.c rename to gtk/print/gtkprinteroptionwidget.c diff --git a/gtk/gtkprinteroptionwidgetprivate.h b/gtk/print/gtkprinteroptionwidgetprivate.h similarity index 99% rename from gtk/gtkprinteroptionwidgetprivate.h rename to gtk/print/gtkprinteroptionwidgetprivate.h index b470cfd398..dac14bc7a7 100644 --- a/gtk/gtkprinteroptionwidgetprivate.h +++ b/gtk/print/gtkprinteroptionwidgetprivate.h @@ -16,8 +16,8 @@ */ #pragma once +#include #include "gtkprinteroptionprivate.h" -#include "gtkbox.h" G_BEGIN_DECLS diff --git a/gtk/gtkprinterprivate.h b/gtk/print/gtkprinterprivate.h similarity index 98% rename from gtk/gtkprinterprivate.h rename to gtk/print/gtkprinterprivate.h index 409e66ffb3..451588ed6f 100644 --- a/gtk/gtkprinterprivate.h +++ b/gtk/print/gtkprinterprivate.h @@ -19,7 +19,7 @@ #pragma once #include -#include +#include "gtkunixprint.h" #include "gtkprinteroptionsetprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkprintjob.c b/gtk/print/gtkprintjob.c similarity index 100% rename from gtk/gtkprintjob.c rename to gtk/print/gtkprintjob.c diff --git a/gtk/gtkprintjob.h b/gtk/print/gtkprintjob.h similarity index 99% rename from gtk/gtkprintjob.h rename to gtk/print/gtkprintjob.h index b1e4563298..f15342497a 100644 --- a/gtk/gtkprintjob.h +++ b/gtk/print/gtkprintjob.h @@ -24,7 +24,7 @@ #include #include -#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkprintoperation-portal.c b/gtk/print/gtkprintoperation-portal.c similarity index 99% rename from gtk/gtkprintoperation-portal.c rename to gtk/print/gtkprintoperation-portal.c index 4f4c4ccaae..d39ad1645c 100644 --- a/gtk/gtkprintoperation-portal.c +++ b/gtk/print/gtkprintoperation-portal.c @@ -31,8 +31,8 @@ #include "gtkprintoperation-private.h" #include "gtkprintoperation-portal.h" -#include "print/gtkprintsettings.h" -#include "print/gtkpagesetup.h" +#include "gtkprintsettings.h" +#include "gtkpagesetup.h" #include "gtkprintbackendprivate.h" #include "gtkfilelauncher.h" #include diff --git a/gtk/gtkprintoperation-portal.h b/gtk/print/gtkprintoperation-portal.h similarity index 98% rename from gtk/gtkprintoperation-portal.h rename to gtk/print/gtkprintoperation-portal.h index 6aa1219213..ee84b28f69 100644 --- a/gtk/gtkprintoperation-portal.h +++ b/gtk/print/gtkprintoperation-portal.h @@ -17,7 +17,7 @@ #pragma once -#include "print/gtkprintoperation.h" +#include "gtkprintoperation.h" G_BEGIN_DECLS diff --git a/gtk/gtkprintoperation-private.h b/gtk/print/gtkprintoperation-private.h similarity index 99% rename from gtk/gtkprintoperation-private.h rename to gtk/print/gtkprintoperation-private.h index f5daa45291..46833a63c5 100644 --- a/gtk/gtkprintoperation-private.h +++ b/gtk/print/gtkprintoperation-private.h @@ -18,7 +18,7 @@ #pragma once -#include "print/gtkprintoperation.h" +#include "gtkprintoperation.h" G_BEGIN_DECLS diff --git a/gtk/gtkprintoperation-unix.c b/gtk/print/gtkprintoperation-unix.c similarity index 100% rename from gtk/gtkprintoperation-unix.c rename to gtk/print/gtkprintoperation-unix.c diff --git a/gtk/gtkprintoperation-win32.c b/gtk/print/gtkprintoperation-win32.c similarity index 100% rename from gtk/gtkprintoperation-win32.c rename to gtk/print/gtkprintoperation-win32.c diff --git a/gtk/gtkprintunixdialog.c b/gtk/print/gtkprintunixdialog.c similarity index 100% rename from gtk/gtkprintunixdialog.c rename to gtk/print/gtkprintunixdialog.c diff --git a/gtk/gtkprintunixdialog.h b/gtk/print/gtkprintunixdialog.h similarity index 98% rename from gtk/gtkprintunixdialog.h rename to gtk/print/gtkprintunixdialog.h index 3c12c7abfa..48a5ec7b85 100644 --- a/gtk/gtkprintunixdialog.h +++ b/gtk/print/gtkprintunixdialog.h @@ -22,8 +22,8 @@ #endif #include -#include -#include +#include +#include G_BEGIN_DECLS diff --git a/gtk/gtkprintutilsprivate.h b/gtk/print/gtkprintutilsprivate.h similarity index 100% rename from gtk/gtkprintutilsprivate.h rename to gtk/print/gtkprintutilsprivate.h diff --git a/gtk/gtkunixprint.h b/gtk/print/gtkunixprint.h similarity index 83% rename from gtk/gtkunixprint.h rename to gtk/print/gtkunixprint.h index c285b4ed00..79158f1ef3 100644 --- a/gtk/gtkunixprint.h +++ b/gtk/print/gtkunixprint.h @@ -18,10 +18,10 @@ #define __GTK_UNIX_PRINT_H_INSIDE__ -#include -#include -#include -#include +#include +#include +#include +#include #undef __GTK_UNIX_PRINT_H_INSIDE__ diff --git a/gtk/print/meson.build b/gtk/print/meson.build index 78312aabd6..79f4d085de 100644 --- a/gtk/print/meson.build +++ b/gtk/print/meson.build @@ -16,3 +16,44 @@ gtk_print_sources = files([ 'gtkprintsettings.c', 'gtkprintutils.c', ]) + +gtk_unix_print_headers = [] +gtk_unix_print_sources = [] + +if os_unix + gtk_unix_print_headers += files([ + 'gtkpagesetupunixdialog.h', + 'gtkprintunixdialog.h', + 'gtkprinter.h', + 'gtkprintjob.h', + 'gtkunixprint.h', + ]) + + gtk_unix_print_sources += files([ + 'gtkcustompaperunixdialog.c', + 'gtkpagesetupunixdialog.c', + 'gtkprintbackend.c', + 'gtkprinter.c', + 'gtkprinteroption.c', + 'gtkprinteroptionset.c', + 'gtkprinteroptionwidget.c', + 'gtkprintjob.c', + 'gtkprintoperation-unix.c', + 'gtkprintoperation-portal.c', + 'gtkprintunixdialog.c', + ]) +endif + +gtk_win32_print_headers = [] +gtk_win32_print_sources = [] + +if os_win32 + gtk_win32_print_sources += files([ + 'gtkprint-win32.c', + 'gtkprintoperation-win32.c', + ]) + + if cc.has_header_symbol('windows.h', 'IPrintDialogCallback') + cdata.set('HAVE_IPRINTDIALOGCALLBACK', 1) + endif +endif diff --git a/gtk/paper_names.c b/gtk/print/paper_names.c similarity index 100% rename from gtk/paper_names.c rename to gtk/print/paper_names.c diff --git a/gtk/paper_names_offsets.c b/gtk/print/paper_names_offsets.c similarity index 100% rename from gtk/paper_names_offsets.c rename to gtk/print/paper_names_offsets.c diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c index ed40db68aa..aa9b515878 100644 --- a/modules/printbackends/gtkprintbackendcups.c +++ b/modules/printbackends/gtkprintbackendcups.c @@ -45,9 +45,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include "gtkprintbackendcups.h" @@ -57,7 +57,7 @@ #include "gtkcupssecretsutils.h" #include "gtkprintbackendutils.h" -#include +#include #include "gtkprivate.h" #ifdef HAVE_COLORD diff --git a/modules/printbackends/gtkprintbackendcups.h b/modules/printbackends/gtkprintbackendcups.h index a37a571a35..b5ac6d3980 100644 --- a/modules/printbackends/gtkprintbackendcups.h +++ b/modules/printbackends/gtkprintbackendcups.h @@ -20,7 +20,7 @@ #define __GTK_PRINT_BACKEND_CUPS_H__ #include -#include "gtkprintbackendprivate.h" +#include "gtk/print/gtkprintbackendprivate.h" G_BEGIN_DECLS diff --git a/modules/printbackends/gtkprintbackendfile.c b/modules/printbackends/gtkprintbackendfile.c index 739313064b..eb0b00ce3b 100644 --- a/modules/printbackends/gtkprintbackendfile.c +++ b/modules/printbackends/gtkprintbackendfile.c @@ -35,7 +35,7 @@ #include #include "gtk/gtk.h" -#include "gtk/gtkprinterprivate.h" +#include "gtk/print/gtkprinterprivate.h" #include "gtk/gtkprivate.h" #include "gtkprintbackendfile.h" diff --git a/modules/printbackends/gtkprintbackendfile.h b/modules/printbackends/gtkprintbackendfile.h index 0ca051b5ff..280b901d00 100644 --- a/modules/printbackends/gtkprintbackendfile.h +++ b/modules/printbackends/gtkprintbackendfile.h @@ -21,7 +21,7 @@ #define __GTK_PRINT_BACKEND_FILE_H__ #include -#include "gtkprintbackendprivate.h" +#include "gtk/print/gtkprintbackendprivate.h" G_BEGIN_DECLS diff --git a/modules/printbackends/gtkprintercups.h b/modules/printbackends/gtkprintercups.h index 81b6cfb9c8..fb67f6ac83 100644 --- a/modules/printbackends/gtkprintercups.h +++ b/modules/printbackends/gtkprintercups.h @@ -23,8 +23,8 @@ #include #include "gtkcupsutils.h" -#include -#include +#include +#include #ifdef HAVE_COLORD #include From 2adc0170487b3797b3cf1ec133fbacede2f83fe1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Jun 2023 23:35:07 -0400 Subject: [PATCH 04/12] print: Start sorting apart includes Use gtk/gtk.h in the print sources, so that it becomes apparent where we are using private apis. --- gtk/print/gtkcustompaperunixdialog.c | 9 +--- gtk/print/gtkpagesetup.c | 6 ++- gtk/print/gtkpagesetupunixdialog.c | 10 +--- gtk/print/gtkpapersize.c | 3 +- gtk/print/gtkprintbackend.c | 18 +++---- gtk/print/gtkprinter.c | 28 +++++------ gtk/print/gtkprinteroption.c | 6 +-- gtk/print/gtkprinteroptionprivate.h | 11 ----- gtk/print/gtkprinteroptionset.c | 4 +- gtk/print/gtkprinteroptionwidget.c | 18 ++----- gtk/print/gtkprintjob.c | 13 +++-- gtk/print/gtkprintoperation-portal.c | 15 ++++-- gtk/print/gtkprintoperation-unix.c | 8 +-- gtk/print/gtkprintoperation-win32.c | 7 ++- gtk/print/gtkprintoperation.c | 73 ++++++++++++++-------------- gtk/print/gtkprintoperationpreview.c | 12 +++-- gtk/print/gtkprintsettings.c | 4 +- gtk/print/gtkprintunixdialog.c | 50 +++++++------------ 18 files changed, 125 insertions(+), 170 deletions(-) diff --git a/gtk/print/gtkcustompaperunixdialog.c b/gtk/print/gtkcustompaperunixdialog.c index 375927e517..ccca8e664c 100644 --- a/gtk/print/gtkcustompaperunixdialog.c +++ b/gtk/print/gtkcustompaperunixdialog.c @@ -26,18 +26,13 @@ #endif #include -#include "gtkprivate.h" -#include "deprecated/gtkliststore.h" - -#include "gtksignallistitemfactory.h" -#include "gtklabel.h" -#include "gtkspinbutton.h" +#include +#include "deprecated/gtkdialogprivate.h" #include "gtkcustompaperunixdialog.h" #include "gtkprintbackendprivate.h" #include "gtkprintutilsprivate.h" -#include "deprecated/gtkdialogprivate.h" #define LEGACY_CUSTOM_PAPER_FILENAME ".gtk-custom-papers" #define CUSTOM_PAPER_FILENAME "custom-papers" diff --git a/gtk/print/gtkpagesetup.c b/gtk/print/gtkpagesetup.c index 588e43d8e7..1b9416aa9d 100644 --- a/gtk/print/gtkpagesetup.c +++ b/gtk/print/gtkpagesetup.c @@ -18,11 +18,13 @@ #include "config.h" +#include + +#include + #include "gtkpagesetup.h" #include "gtkprintutilsprivate.h" #include "gtkprintoperation.h" /* for GtkPrintError */ -#include -#include "gtktypebuiltins.h" /** * GtkPageSetup: diff --git a/gtk/print/gtkpagesetupunixdialog.c b/gtk/print/gtkpagesetupunixdialog.c index e9f5cfd6ab..ceddba4ca0 100644 --- a/gtk/print/gtkpagesetupunixdialog.c +++ b/gtk/print/gtkpagesetupunixdialog.c @@ -22,20 +22,14 @@ #include #include -#include "gtkprivate.h" - -#include "gtkbutton.h" -#include "gtkscrolledwindow.h" -#include "gtkcheckbutton.h" -#include "gtklabel.h" -#include "gtkgrid.h" +#include +#include "deprecated/gtkdialogprivate.h" #include "gtkpagesetupunixdialog.h" #include "gtkcustompaperunixdialog.h" #include "gtkprintbackendprivate.h" #include "gtkpapersize.h" #include "gtkprintutilsprivate.h" -#include "deprecated/gtkdialogprivate.h" /** * GtkPageSetupUnixDialog: diff --git a/gtk/print/gtkpapersize.c b/gtk/print/gtkpapersize.c index 97bd96d49c..894a6f7334 100644 --- a/gtk/print/gtkpapersize.c +++ b/gtk/print/gtkpapersize.c @@ -26,10 +26,11 @@ #endif #include +#include + #include "gtkpapersize.h" #include "gtkprintutilsprivate.h" #include "gtkprintoperation.h" /* for GtkPrintError */ -#include /* _gtk_load_custom_papers() only on Unix so far */ #ifdef G_OS_UNIX diff --git a/gtk/print/gtkprintbackend.c b/gtk/print/gtkprintbackend.c index 1fd4c3572b..a16e34606a 100644 --- a/gtk/print/gtkprintbackend.c +++ b/gtk/print/gtkprintbackend.c @@ -20,12 +20,12 @@ #include #include - #include -#include "gtkdebug.h" + +#include #include "gtkmodulesprivate.h" -#include "gtkmarshalers.h" #include "gtkprivate.h" + #include "gtkprintbackendprivate.h" @@ -272,7 +272,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) GTK_PARAM_READWRITE)); signals[PRINTER_LIST_CHANGED] = - g_signal_new (I_("printer-list-changed"), + g_signal_new ("printer-list-changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, printer_list_changed), @@ -280,7 +280,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) NULL, G_TYPE_NONE, 0); signals[PRINTER_LIST_DONE] = - g_signal_new (I_("printer-list-done"), + g_signal_new ("printer-list-done", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, printer_list_done), @@ -288,7 +288,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) NULL, G_TYPE_NONE, 0); signals[PRINTER_ADDED] = - g_signal_new (I_("printer-added"), + g_signal_new ("printer-added", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, printer_added), @@ -296,7 +296,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) NULL, G_TYPE_NONE, 1, GTK_TYPE_PRINTER); signals[PRINTER_REMOVED] = - g_signal_new (I_("printer-removed"), + g_signal_new ("printer-removed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, printer_removed), @@ -304,7 +304,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) NULL, G_TYPE_NONE, 1, GTK_TYPE_PRINTER); signals[PRINTER_STATUS_CHANGED] = - g_signal_new (I_("printer-status-changed"), + g_signal_new ("printer-status-changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, printer_status_changed), @@ -312,7 +312,7 @@ gtk_print_backend_class_init (GtkPrintBackendClass *class) NULL, G_TYPE_NONE, 1, GTK_TYPE_PRINTER); signals[REQUEST_PASSWORD] = - g_signal_new (I_("request-password"), + g_signal_new ("request-password", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintBackendClass, request_password), diff --git a/gtk/print/gtkprinter.c b/gtk/print/gtkprinter.c index 9b16d02463..356525e037 100644 --- a/gtk/print/gtkprinter.c +++ b/gtk/print/gtkprinter.c @@ -20,8 +20,6 @@ #include #include -#include "gtkprivate.h" - #include "gtkprinter.h" #include "gtkprinterprivate.h" #include "gtkprintbackendprivate.h" @@ -120,7 +118,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_NAME, g_param_spec_string ("name", NULL, NULL, "", - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkPrinter:backend: (attributes org.gtk.Property.get=gtk_printer_get_backend) @@ -131,7 +129,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_BACKEND, g_param_spec_object ("backend", NULL, NULL, GTK_TYPE_PRINT_BACKEND, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkPrinter:is-virtual: (attributes org.gtk.Property.get=gtk_printer_is_virtual) @@ -142,7 +140,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_IS_VIRTUAL, g_param_spec_boolean ("is-virtual", NULL, NULL, FALSE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkPrinter:accepts-pdf: (attributes org.gtk.Property.get=gtk_printer_accepts_pdf) @@ -153,7 +151,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_ACCEPTS_PDF, g_param_spec_boolean ("accepts-pdf", NULL, NULL, FALSE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkPrinter:accepts-ps: (attributes org.gtk.Property.get=gtk_printer_accepts_ps) @@ -164,7 +162,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_ACCEPTS_PS, g_param_spec_boolean ("accepts-ps", NULL, NULL, TRUE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkPrinter:state-message: (attributes org.gtk.Property.get=gtk_printer_get_state_message) @@ -175,7 +173,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_STATE_MESSAGE, g_param_spec_string ("state-message", NULL, NULL, "", - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter:location: (attributes org.gtk.Property.get=gtk_printer_get_location) @@ -186,7 +184,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_LOCATION, g_param_spec_string ("location", NULL, NULL, "", - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter:icon-name: (attributes org.gtk.Property.get=gtk_printer_get_icon_name) @@ -197,7 +195,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_ICON_NAME, g_param_spec_string ("icon-name", NULL, NULL, "printer", - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter:job-count: (attributes org.gtk.Property.get=gtk_printer_get_job_count) @@ -210,7 +208,7 @@ gtk_printer_class_init (GtkPrinterClass *class) 0, G_MAXINT, 0, - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter:paused: (attributes org.gtk.Property.get=gtk_printer_is_paused) @@ -224,7 +222,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_PAUSED, g_param_spec_boolean ("paused", NULL, NULL, FALSE, - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter:accepting-jobs: (attributes org.gtk.Property.get=gtk_printer_is_accepting_jobs) @@ -235,7 +233,7 @@ gtk_printer_class_init (GtkPrinterClass *class) PROP_ACCEPTING_JOBS, g_param_spec_boolean ("accepting-jobs", NULL, NULL, TRUE, - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrinter::details-acquired: @@ -249,7 +247,7 @@ gtk_printer_class_init (GtkPrinterClass *class) * actually obtained. */ signals[DETAILS_ACQUIRED] = - g_signal_new (I_("details-acquired"), + g_signal_new ("details-acquired", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrinterClass, details_acquired), @@ -1361,7 +1359,7 @@ gtk_print_capabilities_get_type (void) { 0, NULL, NULL } }; - etype = g_flags_register_static (I_("GtkPrintCapabilities"), values); + etype = g_flags_register_static ("GtkPrintCapabilities", values); } return etype; diff --git a/gtk/print/gtkprinteroption.c b/gtk/print/gtkprinteroption.c index 91e4bdecb9..25f415616c 100644 --- a/gtk/print/gtkprinteroption.c +++ b/gtk/print/gtkprinteroption.c @@ -18,9 +18,7 @@ #include "config.h" #include -#include -#include "gtkprivate.h" #include "gtkprinteroptionprivate.h" /***************************************** @@ -88,7 +86,7 @@ gtk_printer_option_class_init (GtkPrinterOptionClass *class) gobject_class->get_property = gtk_printer_option_get_property; signals[CHANGED] = - g_signal_new (I_("changed"), + g_signal_new ("changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrinterOptionClass, changed), @@ -100,7 +98,7 @@ gtk_printer_option_class_init (GtkPrinterOptionClass *class) PROP_VALUE, g_param_spec_string ("value", NULL, NULL, "", - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); } GtkPrinterOption * diff --git a/gtk/print/gtkprinteroptionprivate.h b/gtk/print/gtkprinteroptionprivate.h index 0578e30ebb..82dd8739ba 100644 --- a/gtk/print/gtkprinteroptionprivate.h +++ b/gtk/print/gtkprinteroptionprivate.h @@ -87,39 +87,28 @@ struct _GtkPrinterOptionClass void (*_gtk_reserved4) (void); }; -GDK_AVAILABLE_IN_ALL GType gtk_printer_option_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL GtkPrinterOption *gtk_printer_option_new (const char *name, const char *display_text, GtkPrinterOptionType type); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_set (GtkPrinterOption *option, const char *value); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_set_has_conflict (GtkPrinterOption *option, gboolean has_conflict); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_clear_has_conflict (GtkPrinterOption *option); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_set_boolean (GtkPrinterOption *option, gboolean value); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_allocate_choices (GtkPrinterOption *option, int num); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_choices_from_array (GtkPrinterOption *option, int num_choices, const char **choices, const char **choices_display); -GDK_AVAILABLE_IN_ALL gboolean gtk_printer_option_has_choice (GtkPrinterOption *option, const char *choice); -GDK_AVAILABLE_IN_ALL void gtk_printer_option_set_activates_default (GtkPrinterOption *option, gboolean activates); -GDK_AVAILABLE_IN_ALL gboolean gtk_printer_option_get_activates_default (GtkPrinterOption *option); diff --git a/gtk/print/gtkprinteroptionset.c b/gtk/print/gtkprinteroptionset.c index 288fda6f37..c6e10d2f93 100644 --- a/gtk/print/gtkprinteroptionset.c +++ b/gtk/print/gtkprinteroptionset.c @@ -19,10 +19,8 @@ #include "config.h" #include #include -#include #include "gtkprinteroptionsetprivate.h" -#include "gtkprivate.h" /***************************************** * GtkPrinterOptionSet * @@ -67,7 +65,7 @@ gtk_printer_option_set_class_init (GtkPrinterOptionSetClass *class) gobject_class->finalize = gtk_printer_option_set_finalize; signals[CHANGED] = - g_signal_new (I_("changed"), + g_signal_new ("changed", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrinterOptionSetClass, changed), diff --git a/gtk/print/gtkprinteroptionwidget.c b/gtk/print/gtkprinteroptionwidget.c index c14a675761..fb0fe1268c 100644 --- a/gtk/print/gtkprinteroptionwidget.c +++ b/gtk/print/gtkprinteroptionwidget.c @@ -22,19 +22,7 @@ #include #include -#include "gtkcheckbutton.h" -#include "gtkdropdown.h" -#include "gtklistitem.h" -#include "gtksignallistitemfactory.h" -#include "gtkentry.h" -#include "gtkfiledialog.h" -#include "gtkimage.h" -#include "gtklabel.h" -#include "gtkcheckbutton.h" -#include "gtkgrid.h" -#include "gtkorientable.h" -#include "gtkprivate.h" -#include "gtkstringlist.h" +#include #include "gtkprinteroptionwidgetprivate.h" @@ -112,7 +100,7 @@ gtk_printer_option_widget_class_init (GtkPrinterOptionWidgetClass *class) widget_class->mnemonic_activate = gtk_printer_option_widget_mnemonic_activate; signals[CHANGED] = - g_signal_new (I_("changed"), + g_signal_new ("changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrinterOptionWidgetClass, changed), @@ -124,7 +112,7 @@ gtk_printer_option_widget_class_init (GtkPrinterOptionWidgetClass *class) PROP_SOURCE, g_param_spec_object ("source", NULL, NULL, GTK_TYPE_PRINTER_OPTION, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); } diff --git a/gtk/print/gtkprintjob.c b/gtk/print/gtkprintjob.c index b295d8d69f..9efc638ef9 100644 --- a/gtk/print/gtkprintjob.c +++ b/gtk/print/gtkprintjob.c @@ -42,7 +42,6 @@ #include #include -#include "gtkprivate.h" #include "gtkprintjob.h" #include "gtkprinter.h" @@ -144,7 +143,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) PROP_TITLE, g_param_spec_string ("title", NULL, NULL, NULL, - GTK_PARAM_READWRITE | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** @@ -156,7 +155,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) PROP_PRINTER, g_param_spec_object ("printer", NULL, NULL, GTK_TYPE_PRINTER, - GTK_PARAM_READWRITE | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** @@ -168,7 +167,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) PROP_SETTINGS, g_param_spec_object ("settings", NULL, NULL, GTK_TYPE_PRINT_SETTINGS, - GTK_PARAM_READWRITE | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** @@ -180,7 +179,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) PROP_PAGE_SETUP, g_param_spec_object ("page-setup", NULL, NULL, GTK_TYPE_PAGE_SETUP, - GTK_PARAM_READWRITE | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** @@ -193,7 +192,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) PROP_TRACK_PRINT_STATUS, g_param_spec_boolean ("track-print-status", NULL, NULL, FALSE, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintJob::status-changed: @@ -205,7 +204,7 @@ gtk_print_job_class_init (GtkPrintJobClass *class) * to obtain the new status. */ signals[STATUS_CHANGED] = - g_signal_new (I_("status-changed"), + g_signal_new ("status-changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintJobClass, status_changed), diff --git a/gtk/print/gtkprintoperation-portal.c b/gtk/print/gtkprintoperation-portal.c index d39ad1645c..6dc36892c9 100644 --- a/gtk/print/gtkprintoperation-portal.c +++ b/gtk/print/gtkprintoperation-portal.c @@ -29,16 +29,23 @@ #include +#include +#include +#include "gtkwindowprivate.h" +#include "gtkprivate.h" + #include "gtkprintoperation-private.h" #include "gtkprintoperation-portal.h" #include "gtkprintsettings.h" #include "gtkpagesetup.h" #include "gtkprintbackendprivate.h" -#include "gtkfilelauncher.h" -#include -#include "gtkwindowprivate.h" -#include "gtkprivate.h" +#ifndef PORTAL_BUS_NAME +#define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop" +#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop" +#define PORTAL_REQUEST_INTERFACE "org.freedesktop.portal.Request" +#define PORTAL_PRINT_INTERFACE "org.freedesktop.portal.Print" +#endif typedef struct { GtkPrintOperation *op; diff --git a/gtk/print/gtkprintoperation-unix.c b/gtk/print/gtkprintoperation-unix.c index 1108927bb2..db4d878e33 100644 --- a/gtk/print/gtkprintoperation-unix.c +++ b/gtk/print/gtkprintoperation-unix.c @@ -29,20 +29,20 @@ #include #include +#include +#include +#include "gtkprivate.h" + #include "gtkprintoperation-private.h" #include "gtkprintoperation-portal.h" #include #include -#include "gtkprivate.h" #include "gtkprintunixdialog.h" #include "gtkpagesetupunixdialog.h" #include "gtkprintbackendprivate.h" #include "gtkprinter.h" #include "gtkprintjob.h" -#include "gtklabel.h" -#include "gtkfilelauncher.h" -#include typedef struct diff --git a/gtk/print/gtkprintoperation-win32.c b/gtk/print/gtkprintoperation-win32.c index 15d68abff4..a68ecfc2b6 100644 --- a/gtk/print/gtkprintoperation-win32.c +++ b/gtk/print/gtkprintoperation-win32.c @@ -39,12 +39,11 @@ #include #include #include +#include +#include "gtkwidgetprivate.h" + #include "gtkprintoperation-private.h" #include "gtkprint-win32.h" -#include "gtkwindow.h" -#include "gtkprivate.h" -#include "gtkwidgetprivate.h" -#include "gtknative.h" #include "win32/gdkprivate-win32.h" #define MAX_PAGE_RANGES 20 diff --git a/gtk/print/gtkprintoperation.c b/gtk/print/gtkprintoperation.c index c4b0fab467..6423a890a4 100644 --- a/gtk/print/gtkprintoperation.c +++ b/gtk/print/gtkprintoperation.c @@ -25,14 +25,13 @@ #include -#include "gtkprintoperation-private.h" +#include +#include #include "gtkmarshalers.h" #include "gdk/gdkmarshalers.h" -#include #include "gtkprivate.h" -#include "deprecated/gtkmessagedialog.h" -#include "gtkwindowgroup.h" -#include "gtktypebuiltins.h" + +#include "gtkprintoperation-private.h" /** * GtkPrintOperation: @@ -632,7 +631,7 @@ preview_ready (GtkPrintOperationPreview *preview, preview_print_idle, pop, preview_print_idle_done); - gdk_source_set_static_name_by_id (id, "[gtk] preview_print_idle"); + g_source_set_static_name (g_main_context_find_source_by_id (NULL, id), "[gtk] preview_print_idle"); } @@ -768,7 +767,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * after the ::done signal was emitted. */ signals[DONE] = - g_signal_new (I_("done"), + g_signal_new ("done", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, done), @@ -790,7 +789,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * [method@Gtk.PrintOperation.set_n_pages]. */ signals[BEGIN_PRINT] = - g_signal_new (I_("begin-print"), + g_signal_new ("begin-print", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, begin_print), @@ -821,7 +820,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * Returns: %TRUE if pagination is complete */ signals[PAGINATE] = - g_signal_new (I_("paginate"), + g_signal_new ("paginate", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, paginate), @@ -846,7 +845,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * this page. */ signals[REQUEST_PAGE_SETUP] = - g_signal_new (I_("request-page-setup"), + g_signal_new ("request-page-setup", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, request_page_setup), @@ -919,7 +918,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * according to your needs. */ signals[DRAW_PAGE] = - g_signal_new (I_("draw-page"), + g_signal_new ("draw-page", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, draw_page), @@ -943,7 +942,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * been allocated in the [signal@Gtk.PrintOperation::begin-print] handler. */ signals[END_PRINT] = - g_signal_new (I_("end-print"), + g_signal_new ("end-print", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, end_print), @@ -962,7 +961,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * status. */ signals[STATUS_CHANGED] = - g_signal_new (I_("status-changed"), + g_signal_new ("status-changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, status_changed), @@ -991,7 +990,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * the print dialog */ signals[CREATE_CUSTOM_WIDGET] = - g_signal_new (I_("create-custom-widget"), + g_signal_new ("create-custom-widget", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, create_custom_widget), @@ -1015,7 +1014,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * widget, which can actualize itself according to this change. */ signals[UPDATE_CUSTOM_WIDGET] = - g_signal_new (I_("update-custom-widget"), + g_signal_new ("update-custom-widget", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, update_custom_widget), @@ -1039,7 +1038,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * later time. */ signals[CUSTOM_WIDGET_APPLY] = - g_signal_new (I_("custom-widget-apply"), + g_signal_new ("custom-widget-apply", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, custom_widget_apply), @@ -1075,7 +1074,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) * Returns: %TRUE if the listener wants to take over control of the preview */ signals[PREVIEW] = - g_signal_new (I_("preview"), + g_signal_new ("preview", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationClass, preview), @@ -1102,7 +1101,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_DEFAULT_PAGE_SETUP, g_param_spec_object ("default-page-setup", NULL, NULL, GTK_TYPE_PAGE_SETUP, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintOperation:print-settings: (attributes org.gtk.Property.get=gtk_print_operation_get_print_settings org.gtk.Property.set=gtk_print_operation_set_print_settings) @@ -1117,7 +1116,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_PRINT_SETTINGS, g_param_spec_object ("print-settings", NULL, NULL, GTK_TYPE_PRINT_SETTINGS, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintOperation:job-name: (attributes org.gtk.Property.set=gtk_print_operation_set_job_name) @@ -1132,7 +1131,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_JOB_NAME, g_param_spec_string ("job-name", NULL, NULL, "", - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintOperation:n-pages: (attributes org.gtk.Property.set=gtk_print_operation_set_n_pages) @@ -1155,7 +1154,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) -1, G_MAXINT, -1, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:current-page: (attributes org.gtk.Property.set=gtk_print_operation_set_current_page) @@ -1173,7 +1172,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) -1, G_MAXINT, -1, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:use-full-page: (attributes org.gtk.Property.set=gtk_print_operation_set_use_full_page) @@ -1191,7 +1190,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_USE_FULL_PAGE, g_param_spec_boolean ("use-full-page", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:track-print-status: (attributes org.gtk.Property.set=gtk_print_operation_set_track_print_status) @@ -1208,7 +1207,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_TRACK_PRINT_STATUS, g_param_spec_boolean ("track-print-status", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:unit: (attributes org.gtk.Property.set=gtk_print_operation_set_unit) @@ -1222,7 +1221,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) g_param_spec_enum ("unit", NULL, NULL, GTK_TYPE_UNIT, GTK_UNIT_NONE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:show-progress: (attributes org.gtk.Property.set=gtk_print_operation_set_show_progress) @@ -1234,7 +1233,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_SHOW_PROGRESS, g_param_spec_boolean ("show-progress", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:allow-async: (attributes org.gtk.Property.set=gtk_print_operation_set_allow_async) @@ -1254,7 +1253,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_ALLOW_ASYNC, g_param_spec_boolean ("allow-async", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:export-filename: (attributes org.gtk.Property.set=gtk_print_operation_set_export_filename) @@ -1274,7 +1273,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_EXPORT_FILENAME, g_param_spec_string ("export-filename", NULL, NULL, NULL, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintOperation:status: (attributes org.gtk.Property.get=gtk_print_operation_get_status) @@ -1286,7 +1285,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) g_param_spec_enum ("status", NULL, NULL, GTK_TYPE_PRINT_STATUS, GTK_PRINT_STATUS_INITIAL, - GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:status-string: (attributes org.gtk.Property.get=gtk_print_operation_get_status_string) @@ -1303,7 +1302,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_STATUS_STRING, g_param_spec_string ("status-string", NULL, NULL, "", - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** @@ -1319,7 +1318,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_CUSTOM_TAB_LABEL, g_param_spec_string ("custom-tab-label", NULL, NULL, NULL, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintOperation:support-selection: (attributes org.gtk.Property.get=gtk_print_operation_get_support_selection org.gtk.Property.set=gtk_print_operation_set_support_selection) @@ -1332,7 +1331,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_SUPPORT_SELECTION, g_param_spec_boolean ("support-selection", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:has-selection: (attributes org.gtk.Property.get=gtk_print_operation_get_has_selection org.gtk.Property.set=gtk_print_operation_set_has_selection) @@ -1346,7 +1345,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_HAS_SELECTION, g_param_spec_boolean ("has-selection", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** @@ -1359,7 +1358,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) PROP_EMBED_PAGE_SETUP, g_param_spec_boolean ("embed-page-setup", NULL, NULL, FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); /** * GtkPrintOperation:n-pages-to-print: (attributes org.gtk.Property.get=gtk_print_operation_get_n_pages_to_print) @@ -1381,7 +1380,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) -1, G_MAXINT, -1, - GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY)); + G_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY)); } /** @@ -2879,7 +2878,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS g_timeout_add (SHOW_PROGRESS_TIME, (GSourceFunc) show_progress_timeout, data); - gdk_source_set_static_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout"); + g_source_set_static_name (g_main_context_find_source_by_id (NULL, priv->show_progress_timeout_id), "[gtk] show_progress_timeout"); data->progress = progress; } @@ -2950,7 +2949,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS print_pages_idle, data, print_pages_idle_done); - gdk_source_set_static_name_by_id (priv->print_pages_idle_id, "[gtk] print_pages_idle"); + g_source_set_static_name (g_main_context_find_source_by_id (NULL, priv->print_pages_idle_id), "[gtk] print_pages_idle"); /* Recursive main loop to make sure we don't exit on sync operations */ if (priv->is_sync) diff --git a/gtk/print/gtkprintoperationpreview.c b/gtk/print/gtkprintoperationpreview.c index 423e352390..8e782bd498 100644 --- a/gtk/print/gtkprintoperationpreview.c +++ b/gtk/print/gtkprintoperationpreview.c @@ -18,9 +18,11 @@ #include "config.h" -#include "gtkprintoperationpreview.h" +#include + #include "gtkmarshalers.h" -#include "gtkprivate.h" + +#include "gtkprintoperationpreview.h" /** @@ -57,7 +59,7 @@ gtk_print_operation_preview_get_type (void) }; print_operation_preview_type = - g_type_register_static (G_TYPE_INTERFACE, I_("GtkPrintOperationPreview"), + g_type_register_static (G_TYPE_INTERFACE, "GtkPrintOperationPreview", &print_operation_preview_info, 0); g_type_interface_add_prerequisite (print_operation_preview_type, G_TYPE_OBJECT); @@ -85,7 +87,7 @@ gtk_print_operation_preview_base_init (gpointer g_iface) * * A handler for this signal can be used for setup tasks. */ - g_signal_new (I_("ready"), + g_signal_new ("ready", GTK_TYPE_PRINT_OPERATION_PREVIEW, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationPreviewIface, ready), @@ -106,7 +108,7 @@ gtk_print_operation_preview_base_init (gpointer g_iface) * according to @page_setup and set up a suitable cairo * context, using [method@Gtk.PrintContext.set_cairo_context]. */ - id = g_signal_new (I_("got-page-size"), + id = g_signal_new ("got-page-size", GTK_TYPE_PRINT_OPERATION_PREVIEW, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkPrintOperationPreviewIface, got_page_size), diff --git a/gtk/print/gtkprintsettings.c b/gtk/print/gtkprintsettings.c index 5daa6e6711..2c8c3a2f33 100644 --- a/gtk/print/gtkprintsettings.c +++ b/gtk/print/gtkprintsettings.c @@ -23,10 +23,10 @@ #include +#include + #include "gtkprintsettings.h" #include "gtkprintutilsprivate.h" -#include "gtktypebuiltins.h" -#include "gtkwidget.h" /** diff --git a/gtk/print/gtkprintunixdialog.c b/gtk/print/gtkprintunixdialog.c index 1835002b9a..7611ea141e 100644 --- a/gtk/print/gtkprintunixdialog.c +++ b/gtk/print/gtkprintunixdialog.c @@ -25,6 +25,14 @@ #include #include +#include +#include +#include "gtkmarshalers.h" +#include "deprecated/gtkdialogprivate.h" +#include "gtkrenderbackgroundprivate.h" +#include "gtkrenderborderprivate.h" +#include "gtkcsscolorvalueprivate.h" + #include "gtkprintunixdialog.h" #include "gtkcustompaperunixdialog.h" @@ -33,29 +41,6 @@ #include "gtkprinteroptionwidgetprivate.h" #include "gtkprintutilsprivate.h" -#include "gtkspinbutton.h" -#include "gtkimage.h" -#include "gtknotebook.h" -#include "gtkscrolledwindow.h" -#include "gtktogglebutton.h" -#include "gtkdrawingarea.h" -#include "gtkbox.h" -#include "gtkgrid.h" -#include "gtkframe.h" -#include "gtklabel.h" -#include "gtkbuildable.h" -#include "deprecated/gtkmessagedialog.h" -#include "gtkbutton.h" -#include "gtksnapshot.h" -#include "gtkrenderbackgroundprivate.h" -#include "gtkrenderborderprivate.h" -#include -#include "gtkprivate.h" -#include "gtktypebuiltins.h" -#include "deprecated/gtkdialogprivate.h" -#include "gtkwidgetprivate.h" -#include "gtkcsscolorvalueprivate.h" - G_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -390,7 +375,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_PAGE_SETUP, g_param_spec_object ("page-setup", NULL, NULL, GTK_TYPE_PAGE_SETUP, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:current-page: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_current_page org.gtk.Property.set=gtk_print_unix_dialog_set_current_page) @@ -403,7 +388,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) -1, G_MAXINT, -1, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:print-settings: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_settings org.gtk.Property.set=gtk_print_unix_dialog_set_settings) @@ -414,7 +399,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_PRINT_SETTINGS, g_param_spec_object ("print-settings", NULL, NULL, GTK_TYPE_PRINT_SETTINGS, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:selected-printer: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_selected_printer) @@ -425,7 +410,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_SELECTED_PRINTER, g_param_spec_object ("selected-printer", NULL, NULL, GTK_TYPE_PRINTER, - GTK_PARAM_READABLE)); + G_PARAM_READABLE)); /** * GtkPrintUnixDialog:manual-capabilities: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_manual_capabilities org.gtk.Property.set=gtk_print_unix_dialog_set_manual_capabilities) @@ -437,7 +422,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) g_param_spec_flags ("manual-capabilities", NULL, NULL, GTK_TYPE_PRINT_CAPABILITIES, 0, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:support-selection: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_support_selection org.gtk.Property.set=gtk_print_unix_dialog_set_support_selection) @@ -448,7 +433,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_SUPPORT_SELECTION, g_param_spec_boolean ("support-selection", NULL, NULL, FALSE, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:has-selection: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_has_selection org.gtk.Property.set=gtk_print_unix_dialog_set_has_selection) @@ -459,7 +444,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_HAS_SELECTION, g_param_spec_boolean ("has-selection", NULL, NULL, FALSE, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /** * GtkPrintUnixDialog:embed-page-setup: (attributes org.gtk.Property.get=gtk_print_unix_dialog_get_embed_page_setup org.gtk.Property.set=gtk_print_unix_dialog_set_embed_page_setup) @@ -470,7 +455,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) PROP_EMBED_PAGE_SETUP, g_param_spec_boolean ("embed-page-setup", NULL, NULL, FALSE, - GTK_PARAM_READWRITE)); + G_PARAM_READWRITE)); /* Bind class to template */ @@ -1781,7 +1766,8 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog) return; dialog->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog); - gdk_source_set_static_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback"); + g_source_set_static_name (g_main_context_find_source_by_id (NULL, dialog->mark_conflicts_id), + "[gtk] mark_conflicts_callback"); } static void From 30ff35296039946924c977e5d8dd6f767a53d6fa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 00:29:39 -0400 Subject: [PATCH 05/12] print: Maintain compatibility gtkunixprint.h is a public header, that needs to keep being installed in the same location. --- gtk/{print => }/gtkunixprint.h | 0 gtk/meson.build | 9 +++++++-- gtk/print/meson.build | 1 - modules/printbackends/gtkprintbackendcups.c | 2 +- modules/printbackends/gtkprintercups.h | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) rename gtk/{print => }/gtkunixprint.h (100%) diff --git a/gtk/print/gtkunixprint.h b/gtk/gtkunixprint.h similarity index 100% rename from gtk/print/gtkunixprint.h rename to gtk/gtkunixprint.h diff --git a/gtk/meson.build b/gtk/meson.build index 7b8926451b..84e8b0ad89 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -675,8 +675,13 @@ if os_unix and tracker3_dep.found() gtk_sources += 'gtksearchenginetracker3.c' endif +gtk_unix_print_main_header = [ + 'gtkunixprint.h' +] + if os_unix - install_headers(gtk_unix_print_headers, subdir: 'gtk-4.0/unix-print/gtk') + install_headers(gtk_unix_print_main_header, subdir: 'gtk-4.0/unix-print/gtk') + install_headers(gtk_unix_print_headers, subdir: 'gtk-4.0/unix-print/gtk/print') gtk_sources += gtk_unix_print_sources endif @@ -1254,7 +1259,7 @@ if build_gir ] if os_unix - gtk_introspection_sources += [ gtk_unix_print_headers, gtk_unix_print_sources ] + gtk_introspection_sources += [ gtk_unix_print_headers + gtk_unix_print_main_header, gtk_unix_print_sources ] endif if os_win32 diff --git a/gtk/print/meson.build b/gtk/print/meson.build index 79f4d085de..a5263da99d 100644 --- a/gtk/print/meson.build +++ b/gtk/print/meson.build @@ -26,7 +26,6 @@ if os_unix 'gtkprintunixdialog.h', 'gtkprinter.h', 'gtkprintjob.h', - 'gtkunixprint.h', ]) gtk_unix_print_sources += files([ diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c index aa9b515878..0382c8983d 100644 --- a/modules/printbackends/gtkprintbackendcups.c +++ b/modules/printbackends/gtkprintbackendcups.c @@ -45,8 +45,8 @@ #include #include +#include #include -#include #include #include diff --git a/modules/printbackends/gtkprintercups.h b/modules/printbackends/gtkprintercups.h index fb67f6ac83..30edcece27 100644 --- a/modules/printbackends/gtkprintercups.h +++ b/modules/printbackends/gtkprintercups.h @@ -23,7 +23,7 @@ #include #include "gtkcupsutils.h" -#include +#include #include #ifdef HAVE_COLORD From 41d03c68f85fd7f52a5fd4597e51e230e9dc2112 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 07:27:03 -0400 Subject: [PATCH 06/12] Make introspection build --- gtk/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/meson.build b/gtk/meson.build index 84e8b0ad89..80ed4cae16 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -1250,6 +1250,7 @@ if build_gir gtk_introspection_sources = [ gtk_public_headers, gtk_public_sources, + gtk_print_headers, gtk_css_public_headers, gtk_css_public_sources, gtk_deprecated_headers, From 5aa62b6273cb93fe4ad1f5f29654f2e16e61e94b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 07:41:30 -0400 Subject: [PATCH 07/12] Fix a compiler warning Compilers these days are very picky about their NULLs. --- gtk/gtklistitemmanager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtklistitemmanager.c b/gtk/gtklistitemmanager.c index 503149ea7c..b25cac7b06 100644 --- a/gtk/gtklistitemmanager.c +++ b/gtk/gtklistitemmanager.c @@ -1293,7 +1293,7 @@ gtk_list_item_manager_ensure_items (GtkListItemManager *self, start, GTK_LIST_TILE_UNMATCHED_FOOTER, GTK_LIST_TILE_HEADER); - g_assert (header->widget == NULL); + g_assert (header != NULL && header->widget == NULL); header->widget = GTK_WIDGET (gtk_list_item_change_get_header (change)); if (header->widget == NULL) header->widget = GTK_WIDGET (self->create_header_widget (self->widget)); From 216e4151867a054af8ce5a194565d1516be5c46e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 14:41:46 -0400 Subject: [PATCH 08/12] Update POTFILES.in The moving the printing sources needs to be reflected here. --- po/POTFILES.in | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 6a346c0449..4654345c53 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -151,7 +151,7 @@ gtk/gtkcssprovider.c gtk/gtkcssshorthandproperty.c gtk/gtkcssstaticstyle.c gtk/gtkcssstyleproperty.c -gtk/gtkcustompaperunixdialog.c +gtk/print/gtkcustompaperunixdialog.c gtk/gtkdirectorylist.c gtk/gtkdragicon.c gtk/gtkdragsource.c @@ -250,11 +250,11 @@ gtk/gtkorientable.c gtk/gtkoverlay.c gtk/gtkoverlaylayout.c gtk/gtkpadcontroller.c -gtk/gtkpagesetup.c -gtk/gtkpagesetupunixdialog.c +gtk/print/gtkpagesetup.c +gtk/print/gtkpagesetupunixdialog.c gtk/gtkpaned.c gtk/gtkpanedhandle.c -gtk/gtkpapersize.c +gtk/print/gtkpapersize.c gtk/gtkpasswordentry.c gtk/gtkpathbar.c gtk/gtkpicture.c @@ -265,18 +265,18 @@ gtk/gtkpopover.c gtk/gtkpopovercontent.c gtk/gtkpopovermenubar.c gtk/gtkpopovermenu.c -gtk/gtkprintbackend.c -gtk/gtkprinter.c -gtk/gtkprinteroption.c -gtk/gtkprinteroptionset.c -gtk/gtkprinteroptionwidget.c -gtk/gtkprintjob.c -gtk/gtkprintoperation.c -gtk/gtkprintoperation-portal.c -gtk/gtkprintoperationpreview.c -gtk/gtkprintoperation-unix.c -gtk/gtkprintoperation-win32.c -gtk/gtkprintunixdialog.c +gtk/print/gtkprintbackend.c +gtk/print/gtkprinter.c +gtk/print/gtkprinteroption.c +gtk/print/gtkprinteroptionset.c +gtk/print/gtkprinteroptionwidget.c +gtk/print/gtkprintjob.c +gtk/print/gtkprintoperation.c +gtk/print/gtkprintoperation-portal.c +gtk/print/gtkprintoperationpreview.c +gtk/print/gtkprintoperation-unix.c +gtk/print/gtkprintoperation-win32.c +gtk/print/gtkprintunixdialog.c gtk/gtkprogressbar.c gtk/gtkpropertylookuplistmodel.c gtk/gtkrange.c @@ -382,7 +382,7 @@ gtk/inspector/visual.ui gtk/inspector/window.c gtk/inspector/window.ui gtk/open-type-layout.h -gtk/paper_names_offsets.c +gtk/print/paper_names_offsets.c gtk/ui/gtkaboutdialog.ui gtk/ui/gtkappchooserdialog.ui gtk/ui/gtkappchooserwidget.ui From c019eb9eea8f075e78dd3c1f7efa529aee469f28 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 15:35:12 -0400 Subject: [PATCH 09/12] print: Some more include cleanup --- gtk/print/gtkcustompaperunixdialog.c | 1 - gtk/print/gtkpagesetupunixdialog.c | 2 +- gtk/print/gtkprinteroptionwidget.c | 1 - gtk/print/gtkprintoperation.c | 1 - gtk/print/gtkprintoperation.h | 4 ++-- gtk/print/gtkprintunixdialog.c | 2 +- 6 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gtk/print/gtkcustompaperunixdialog.c b/gtk/print/gtkcustompaperunixdialog.c index ccca8e664c..5fb1453f2d 100644 --- a/gtk/print/gtkcustompaperunixdialog.c +++ b/gtk/print/gtkcustompaperunixdialog.c @@ -27,7 +27,6 @@ #include -#include #include "deprecated/gtkdialogprivate.h" #include "gtkcustompaperunixdialog.h" diff --git a/gtk/print/gtkpagesetupunixdialog.c b/gtk/print/gtkpagesetupunixdialog.c index ceddba4ca0..ab4ee7f2a9 100644 --- a/gtk/print/gtkpagesetupunixdialog.c +++ b/gtk/print/gtkpagesetupunixdialog.c @@ -22,7 +22,7 @@ #include #include -#include + #include "deprecated/gtkdialogprivate.h" #include "gtkpagesetupunixdialog.h" diff --git a/gtk/print/gtkprinteroptionwidget.c b/gtk/print/gtkprinteroptionwidget.c index fb0fe1268c..634a7dea30 100644 --- a/gtk/print/gtkprinteroptionwidget.c +++ b/gtk/print/gtkprinteroptionwidget.c @@ -22,7 +22,6 @@ #include #include -#include #include "gtkprinteroptionwidgetprivate.h" diff --git a/gtk/print/gtkprintoperation.c b/gtk/print/gtkprintoperation.c index 6423a890a4..8aa8976a10 100644 --- a/gtk/print/gtkprintoperation.c +++ b/gtk/print/gtkprintoperation.c @@ -26,7 +26,6 @@ #include #include -#include #include "gtkmarshalers.h" #include "gdk/gdkmarshalers.h" #include "gtkprivate.h" diff --git a/gtk/print/gtkprintoperation.h b/gtk/print/gtkprintoperation.h index ccee5d8e16..4676614dec 100644 --- a/gtk/print/gtkprintoperation.h +++ b/gtk/print/gtkprintoperation.h @@ -24,8 +24,8 @@ #endif #include -#include -#include +#include + #include #include #include diff --git a/gtk/print/gtkprintunixdialog.c b/gtk/print/gtkprintunixdialog.c index 7611ea141e..28b9eb4811 100644 --- a/gtk/print/gtkprintunixdialog.c +++ b/gtk/print/gtkprintunixdialog.c @@ -26,7 +26,7 @@ #include #include -#include + #include "gtkmarshalers.h" #include "deprecated/gtkdialogprivate.h" #include "gtkrenderbackgroundprivate.h" From a30e0fad1f9cdc953e21af350cd9134c6262bbf9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Jun 2023 23:47:34 -0400 Subject: [PATCH 10/12] Move resources too --- gtk/gen-gtk-gresources-xml.py | 3 +++ gtk/print/gtkpagesetupunixdialog.c | 2 +- gtk/print/gtkprintunixdialog.c | 2 +- gtk/{ => print}/ui/gtkpagesetupunixdialog.ui | 0 gtk/{ => print}/ui/gtkprintunixdialog.ui | 0 po/POTFILES.in | 4 ++-- 6 files changed, 7 insertions(+), 4 deletions(-) rename gtk/{ => print}/ui/gtkpagesetupunixdialog.ui (100%) rename gtk/{ => print}/ui/gtkprintunixdialog.ui (100%) diff --git a/gtk/gen-gtk-gresources-xml.py b/gtk/gen-gtk-gresources-xml.py index 66d2246343..6179fbf8e1 100644 --- a/gtk/gen-gtk-gresources-xml.py +++ b/gtk/gen-gtk-gresources-xml.py @@ -68,6 +68,9 @@ for f in get_files('theme/Default/assets-hc', '.svg'): for f in get_files('ui', '.ui'): xml += ' ui/{0}\n'.format(f) +for f in get_files('print/ui', '.ui'): + xml += ' print/ui/{0}\n'.format(f) + xml += '\n' xml += ''' diff --git a/gtk/print/gtkpagesetupunixdialog.c b/gtk/print/gtkpagesetupunixdialog.c index ab4ee7f2a9..5879427d3a 100644 --- a/gtk/print/gtkpagesetupunixdialog.c +++ b/gtk/print/gtkpagesetupunixdialog.c @@ -146,7 +146,7 @@ gtk_page_setup_unix_dialog_class_init (GtkPageSetupUnixDialogClass *class) /* Bind class to template */ gtk_widget_class_set_template_from_resource (widget_class, - "/org/gtk/libgtk/ui/gtkpagesetupunixdialog.ui"); + "/org/gtk/libgtk/print/ui/gtkpagesetupunixdialog.ui"); gtk_widget_class_bind_template_child (widget_class, GtkPageSetupUnixDialog, printer_combo); gtk_widget_class_bind_template_child (widget_class, GtkPageSetupUnixDialog, paper_size_combo); diff --git a/gtk/print/gtkprintunixdialog.c b/gtk/print/gtkprintunixdialog.c index 28b9eb4811..5c1c587bb5 100644 --- a/gtk/print/gtkprintunixdialog.c +++ b/gtk/print/gtkprintunixdialog.c @@ -460,7 +460,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) /* Bind class to template */ gtk_widget_class_set_template_from_resource (widget_class, - "/org/gtk/libgtk/ui/gtkprintunixdialog.ui"); + "/org/gtk/libgtk/print/ui/gtkprintunixdialog.ui"); /* GtkTreeView / GtkTreeModel */ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_list); diff --git a/gtk/ui/gtkpagesetupunixdialog.ui b/gtk/print/ui/gtkpagesetupunixdialog.ui similarity index 100% rename from gtk/ui/gtkpagesetupunixdialog.ui rename to gtk/print/ui/gtkpagesetupunixdialog.ui diff --git a/gtk/ui/gtkprintunixdialog.ui b/gtk/print/ui/gtkprintunixdialog.ui similarity index 100% rename from gtk/ui/gtkprintunixdialog.ui rename to gtk/print/ui/gtkprintunixdialog.ui diff --git a/po/POTFILES.in b/po/POTFILES.in index 4654345c53..a88114f290 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -401,10 +401,10 @@ gtk/ui/gtkfontchooserwidget.ui gtk/ui/gtklockbutton.ui gtk/ui/gtkmediacontrols.ui gtk/ui/gtkmessagedialog.ui -gtk/ui/gtkpagesetupunixdialog.ui +gtk/print/ui/gtkpagesetupunixdialog.ui gtk/ui/gtkplacesviewrow.ui gtk/ui/gtkplacesview.ui -gtk/ui/gtkprintunixdialog.ui +gtk/print/ui/gtkprintunixdialog.ui gtk/ui/gtkscalebutton.ui gtk/ui/gtksidebarrow.ui gtk/ui/gtkstatusbar.ui From f22788a3a8429b69f06a27eb4033d6b0dc12a219 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 8 Jun 2023 00:02:05 -0400 Subject: [PATCH 11/12] print: Drop some private api use --- gtk/print/gtkprintoperation-portal.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/gtk/print/gtkprintoperation-portal.c b/gtk/print/gtkprintoperation-portal.c index 6dc36892c9..474d705467 100644 --- a/gtk/print/gtkprintoperation-portal.c +++ b/gtk/print/gtkprintoperation-portal.c @@ -32,7 +32,6 @@ #include #include #include "gtkwindowprivate.h" -#include "gtkprivate.h" #include "gtkprintoperation-private.h" #include "gtkprintoperation-portal.h" @@ -40,12 +39,32 @@ #include "gtkpagesetup.h" #include "gtkprintbackendprivate.h" -#ifndef PORTAL_BUS_NAME #define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop" #define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop" #define PORTAL_REQUEST_INTERFACE "org.freedesktop.portal.Request" #define PORTAL_PRINT_INTERFACE "org.freedesktop.portal.Print" -#endif + +static char * +get_portal_request_path (GDBusConnection *connection, + char **token) +{ + char *sender; + int i; + char *path; + + *token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT)); + /* +1 to skip the leading : */ + sender = g_strdup (g_dbus_connection_get_unique_name (connection) + 1); + for (i = 0; sender[i]; i++) + if (sender[i] == '.') + sender[i] = '_'; + + path = g_strconcat (PORTAL_OBJECT_PATH, "/request/", sender, "/", *token, NULL); + + g_free (sender); + + return path; +} typedef struct { GtkPrintOperation *op; @@ -582,7 +601,7 @@ call_prepare_print (GtkPrintOperation *op, char *token; portal->prepare_print_handle = - gtk_get_portal_request_path (g_dbus_proxy_get_connection (portal->proxy), &token); + get_portal_request_path (g_dbus_proxy_get_connection (portal->proxy), &token); portal->response_signal_id = g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (G_DBUS_PROXY (portal->proxy)), From 8497f97dec8809272672e2b649741a736b6eb00f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 8 Jun 2023 00:24:38 -0400 Subject: [PATCH 12/12] print: Reimplement collate preview Redo this with widgets instead of cairo drawing. The new private widget is called GtkPageThumbnail. --- gtk/print/gtkpagethumbnail.c | 158 ++++++++++++++++++++++++++ gtk/print/gtkpagethumbnailprivate.h | 12 ++ gtk/print/gtkprintunixdialog.c | 165 ++++++++++------------------ gtk/print/meson.build | 1 + gtk/print/ui/gtkprintunixdialog.ui | 44 +++++++- 5 files changed, 273 insertions(+), 107 deletions(-) create mode 100644 gtk/print/gtkpagethumbnail.c create mode 100644 gtk/print/gtkpagethumbnailprivate.h diff --git a/gtk/print/gtkpagethumbnail.c b/gtk/print/gtkpagethumbnail.c new file mode 100644 index 0000000000..a77d4a61a6 --- /dev/null +++ b/gtk/print/gtkpagethumbnail.c @@ -0,0 +1,158 @@ +#include "config.h" + +#include "gtkpagethumbnailprivate.h" + +enum +{ + PROP_PAGE_NUM = 1, + NUM_PROPERTIES, +}; + +static GParamSpec *properties[NUM_PROPERTIES] = { NULL, }; + +struct _GtkPageThumbnail +{ + GtkWidget parent_instance; + + GtkWidget *label; + int page_num; +}; + +struct _GtkPageThumbnailClass +{ + GtkWidgetClass parent_class; +}; + +G_DEFINE_TYPE (GtkPageThumbnail, gtk_page_thumbnail, GTK_TYPE_WIDGET) + +static void +gtk_page_thumbnail_init (GtkPageThumbnail *self) +{ + self->label = gtk_inscription_new ("0"); + gtk_widget_set_parent (self->label, GTK_WIDGET (self)); + gtk_inscription_set_min_chars (GTK_INSCRIPTION (self->label), 1); + gtk_inscription_set_nat_chars (GTK_INSCRIPTION (self->label), 1); +} + +static void +gtk_page_thumbnail_dispose (GObject *object) +{ + GtkPageThumbnail *self = GTK_PAGE_THUMBNAIL (object); + + g_clear_pointer (&self->label, gtk_widget_unparent); + + G_OBJECT_CLASS (gtk_page_thumbnail_parent_class)->dispose (object); +} + +static void +gtk_page_thumbnail_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkPageThumbnail *self = GTK_PAGE_THUMBNAIL (object); + + switch (prop_id) + { + case PROP_PAGE_NUM: + gtk_page_thumbnail_set_page_num (self, g_value_get_int (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gtk_page_thumbnail_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkPageThumbnail *self = GTK_PAGE_THUMBNAIL (object); + + switch (prop_id) + { + case PROP_PAGE_NUM: + g_value_set_int (value, self->page_num); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gtk_page_thumbnail_size_allocate (GtkWidget *widget, + int width, + int height, + int baseline) +{ + GtkPageThumbnail *self = GTK_PAGE_THUMBNAIL (widget); + GtkRequisition nat; + GtkAllocation alloc; + + gtk_widget_get_preferred_size (self->label, NULL, &nat); + alloc.x = width - nat.width; + alloc.y = height - nat.height; + alloc.width = nat.width; + alloc.height = nat.height; + gtk_widget_size_allocate (self->label, &alloc, -1); +} + +static void +gtk_page_thumbnail_class_init (GtkPageThumbnailClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); + + object_class->dispose = gtk_page_thumbnail_dispose; + object_class->set_property = gtk_page_thumbnail_set_property; + object_class->get_property = gtk_page_thumbnail_get_property; + + widget_class->size_allocate = gtk_page_thumbnail_size_allocate; + + properties[PROP_PAGE_NUM] = + g_param_spec_int ("page-num", NULL, NULL, + 0, G_MAXINT, 0, G_PARAM_READWRITE); + + g_object_class_install_properties (object_class, NUM_PROPERTIES, properties); + + gtk_widget_class_set_css_name (widget_class, "page-thumbnail"); +} + +GtkPageThumbnail * +gtk_page_thumbnail_new (void) +{ + return g_object_new (GTK_TYPE_PAGE_THUMBNAIL, NULL); +} + +void +gtk_page_thumbnail_set_page_num (GtkPageThumbnail *self, + int page_num) +{ + g_return_if_fail (GTK_IS_PAGE_THUMBNAIL (self)); + g_return_if_fail (page_num >= 0); + char text[64]; + + if (self->page_num == page_num) + return; + + self->page_num = page_num; + + g_snprintf (text, sizeof (text), "%d", self->page_num); + + gtk_inscription_set_text (GTK_INSCRIPTION (self->label), text); + gtk_widget_queue_draw (GTK_WIDGET (self)); + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PAGE_NUM]); +} + +int +gtk_page_thumbnail_get_page_num (GtkPageThumbnail *self) +{ + g_return_val_if_fail (GTK_IS_PAGE_THUMBNAIL (self), 0); + + return self->page_num; +} diff --git a/gtk/print/gtkpagethumbnailprivate.h b/gtk/print/gtkpagethumbnailprivate.h new file mode 100644 index 0000000000..f30a4fd20f --- /dev/null +++ b/gtk/print/gtkpagethumbnailprivate.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +#define GTK_TYPE_PAGE_THUMBNAIL (gtk_page_thumbnail_get_type ()) +G_DECLARE_FINAL_TYPE (GtkPageThumbnail, gtk_page_thumbnail, GTK, PAGE_THUMBNAIL, GtkWidget) + +GtkPageThumbnail * gtk_page_thumbnail_new (void); +void gtk_page_thumbnail_set_page_num (GtkPageThumbnail *self, + int page_num); +int gtk_page_thumbnail_get_page_num (GtkPageThumbnail *self); + diff --git a/gtk/print/gtkprintunixdialog.c b/gtk/print/gtkprintunixdialog.c index 5c1c587bb5..36639a3097 100644 --- a/gtk/print/gtkprintunixdialog.c +++ b/gtk/print/gtkprintunixdialog.c @@ -40,6 +40,7 @@ #include "gtkprinterprivate.h" #include "gtkprinteroptionwidgetprivate.h" #include "gtkprintutilsprivate.h" +#include "gtkpagethumbnailprivate.h" G_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -147,11 +148,6 @@ static void update_print_at_entry_sensitivity (GtkWidget *button, GtkPrintUnixDialog *dialog); static void update_print_at_option (GtkPrintUnixDialog *dialog); static void update_dialog_from_capabilities (GtkPrintUnixDialog *dialog); -static void draw_collate (GtkDrawingArea *da, - cairo_t *cr, - int width, - int height, - gpointer data); static gboolean is_printer_active (gpointer item, gpointer data); static int default_printer_list_sort_func (gconstpointer a, @@ -258,7 +254,11 @@ struct _GtkPrintUnixDialog GtkWidget *copies_spin; GtkWidget *collate_check; GtkWidget *reverse_check; - GtkWidget *collate_image; + GtkWidget *page_collate_preview; + GtkWidget *page_a1; + GtkWidget *page_a2; + GtkWidget *page_b1; + GtkWidget *page_b2; GtkWidget *page_layout_preview; GtkWidget *scale_spin; GtkWidget *page_set_combo; @@ -351,12 +351,48 @@ is_default_printer (GtkPrintUnixDialog *dialog, return gtk_printer_is_default (printer); } +static const char *css_data = "" + "page-thumbnail {\n" + " border: 1px solid #e6e5e4;\n" + " background: white;\n" + "}\n" + "page-thumbnail > label {\n" + " font-family: Sans;\n" + " font-size: 9pt;\n" + " color: #2e3436;\n" + "}\n"; + +static void +ensure_fallback_style (void) +{ + GdkDisplay *display; + GtkCssProvider *provider; + + display = gdk_display_get_default (); + if (!display) + return; + + provider = gtk_css_provider_new (); + + gtk_css_provider_load_from_string (provider, css_data); + + gtk_style_context_add_provider_for_display (display, + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); + + g_object_unref (provider); +} + static void gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; + ensure_fallback_style (); + + g_type_ensure (GTK_TYPE_PAGE_THUMBNAIL); + object_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; @@ -477,7 +513,11 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class) gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, copies_spin); gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, collate_check); gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, reverse_check); - gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, collate_image); + gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_collate_preview); + gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_a1); + gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_a2); + gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_b1); + gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_b2); gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_layout_preview); gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, scale_spin); gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_set_combo); @@ -857,20 +897,13 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog) gtk_print_load_custom_papers (dialog->custom_paper_list); - gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (dialog->collate_image), - draw_collate, - dialog, NULL); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (dialog->page_layout_preview), draw_page, dialog, NULL); - - gtk_css_node_set_name (gtk_widget_get_css_node (dialog->collate_image), g_quark_from_static_string ("drawing")); gtk_css_node_set_name (gtk_widget_get_css_node (dialog->page_layout_preview), g_quark_from_static_string ("drawing")); dialog->collate_paper_node = gtk_css_node_new(); gtk_css_node_set_name (dialog->collate_paper_node, g_quark_from_static_string ("paper")); - gtk_css_node_set_parent (dialog->collate_paper_node, - gtk_widget_get_css_node (dialog->collate_image)); g_object_unref (dialog->collate_paper_node); dialog->page_layout_paper_node = gtk_css_node_new(); @@ -1914,107 +1947,31 @@ static void update_collate_icon (GtkToggleButton *toggle_button, GtkPrintUnixDialog *dialog) { - gtk_widget_queue_draw (dialog->collate_image); -} - -static void -paint_page (GtkPrintUnixDialog *dialog, - GtkWidget *widget, - cairo_t *cr, - int x, - int y, - const char *text, - int text_x) -{ - GtkCssStyle *style; - int width, height; - int text_y; - GdkRGBA color; - GtkSnapshot *snapshot; - GskRenderNode *node; - GtkCssBoxes boxes; - - width = 20; - height = 26; - text_y = 21; - - style = gtk_css_node_get_style (dialog->collate_paper_node); - - snapshot = gtk_snapshot_new (); - gtk_css_boxes_init_border_box (&boxes, style, x, y, width, height); - gtk_css_style_snapshot_background (&boxes, snapshot); - gtk_css_style_snapshot_border (&boxes, snapshot); - - node = gtk_snapshot_free_to_node (snapshot); - if (node) - { - gsk_render_node_draw (node, cr); - gsk_render_node_unref (node); - } - - color = *gtk_css_color_value_get_rgba (style->core->color); - gdk_cairo_set_source_rgba (cr, &color); - - cairo_select_font_face (cr, "Sans", - CAIRO_FONT_SLANT_NORMAL, - CAIRO_FONT_WEIGHT_NORMAL); - cairo_set_font_size (cr, 9); - cairo_move_to (cr, x + text_x, y + text_y); - cairo_show_text (cr, text); -} - -static void -draw_collate (GtkDrawingArea *da, - cairo_t *cr, - int width, - int height, - gpointer data) -{ - GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (data); - GtkWidget *widget = GTK_WIDGET (da); - gboolean collate, reverse, rtl; + gboolean collate; + gboolean reverse; int copies; - int text_x; - int x, y, x1, x2, p1, p2; collate = dialog_get_collate (dialog); reverse = dialog_get_reverse (dialog); copies = dialog_get_n_copies (dialog); - rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); - - x = (width - 30) / 2; - y = (height - 36) / 2; - if (rtl) + if (collate) { - x1 = x; - x2 = x - 36; - p1 = 0; - p2 = 10; - text_x = 4; + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_a1), reverse ? 1 : 2); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_a2), reverse ? 2 : 1); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_b1), reverse ? 1 : 2); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_b2), reverse ? 2 : 1); } else { - x1 = x; - x2 = x + 36; - p1 = 10; - p2 = 0; - text_x = 11; + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_a1), reverse ? 2 : 1); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_a2), reverse ? 2 : 1); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_b1), reverse ? 1 : 2); + gtk_page_thumbnail_set_page_num (GTK_PAGE_THUMBNAIL (dialog->page_b2), reverse ? 1 : 2); } - if (copies == 1) - { - paint_page (dialog, widget, cr, x1 + p1, y, reverse ? "1" : "2", text_x); - paint_page (dialog, widget, cr, x1 + p2, y + 10, reverse ? "2" : "1", text_x); - } - else - { - paint_page (dialog, widget, cr, x1 + p1, y, collate == reverse ? "1" : "2", text_x); - paint_page (dialog, widget, cr, x1 + p2, y + 10, reverse ? "2" : "1", text_x); - - paint_page (dialog, widget, cr, x2 + p1, y, reverse ? "1" : "2", text_x); - paint_page (dialog, widget, cr, x2 + p2, y + 10, collate == reverse ? "2" : "1", text_x); - } + gtk_widget_set_visible (dialog->page_b1, copies > 1); + gtk_widget_set_visible (dialog->page_b2, copies > 1); } static gboolean @@ -2264,7 +2221,7 @@ dialog_get_collate (GtkPrintUnixDialog *dialog) { if (gtk_widget_is_sensitive (dialog->collate_check)) return gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->collate_check)); - return FALSE; + return TRUE; } static void diff --git a/gtk/print/meson.build b/gtk/print/meson.build index a5263da99d..f113877a5e 100644 --- a/gtk/print/meson.build +++ b/gtk/print/meson.build @@ -31,6 +31,7 @@ if os_unix gtk_unix_print_sources += files([ 'gtkcustompaperunixdialog.c', 'gtkpagesetupunixdialog.c', + 'gtkpagethumbnail.c', 'gtkprintbackend.c', 'gtkprinter.c', 'gtkprinteroption.c', diff --git a/gtk/print/ui/gtkprintunixdialog.ui b/gtk/print/ui/gtkprintunixdialog.ui index d27c585ea2..5233cea309 100644 --- a/gtk/print/ui/gtkprintunixdialog.ui +++ b/gtk/print/ui/gtkprintunixdialog.ui @@ -340,9 +340,47 @@ - - 70 - 50 + + + + 1 + 32 + 40 + + translate(17, 0) + + + + + + 2 + 32 + 40 + + translate(0, 17) + + + + + + 1 + 32 + 40 + + translate(73, 0) + + + + + + 2 + 32 + 40 + + translate(56, 17) + + + 1 1