From 727397e34ae97aef0bf1fb6ae7ec6f0a9176cc4a Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 16 Feb 2022 15:30:36 +0000 Subject: [PATCH] New upstream version --- .gitignore | 1 + 0001-trivial-post-release-version-bump.patch | 79 -- 0002-Update-the-example-spec-file.patch | 93 --- ...Make-introspection-optional-in-meson.patch | 44 -- ...ld-Rename-gtk-meson-variable-to-gtk3.patch | 73 -- 0005-Add-a-GTK4-variant.patch | 706 ------------------ 0006-build-Make-GTK3-build-optional-too.patch | 296 -------- colord-gtk.spec | 15 +- sources | 2 +- 9 files changed, 7 insertions(+), 1302 deletions(-) delete mode 100644 0001-trivial-post-release-version-bump.patch delete mode 100644 0002-Update-the-example-spec-file.patch delete mode 100644 0003-Make-introspection-optional-in-meson.patch delete mode 100644 0004-build-Rename-gtk-meson-variable-to-gtk3.patch delete mode 100644 0005-Add-a-GTK4-variant.patch delete mode 100644 0006-build-Make-GTK3-build-optional-too.patch diff --git a/.gitignore b/.gitignore index f7c620c..e744084 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /colord-gtk-0.1.25.tar.xz /colord-gtk-0.1.26.tar.xz /colord-gtk-0.2.0.tar.xz +/colord-gtk-0.3.0.tar.xz diff --git a/0001-trivial-post-release-version-bump.patch b/0001-trivial-post-release-version-bump.patch deleted file mode 100644 index c068418..0000000 --- a/0001-trivial-post-release-version-bump.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a3be441c61d4c9225a7fa7cefb0cb2eb8928607a Mon Sep 17 00:00:00 2001 -From: Richard Hughes -Date: Thu, 20 Jun 2019 16:28:08 +0100 -Subject: [PATCH 1/6] trivial: post release version bump - ---- - RELEASE | 22 +++++++++++----------- - meson.build | 2 +- - 2 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/RELEASE b/RELEASE -index 7235273..f143cd5 100644 ---- a/RELEASE -+++ b/RELEASE -@@ -2,11 +2,11 @@ colord-gtk Release Notes - - 1. Write NEWS entries for colord in the same format as usual. - --git shortlog COLORD_GTK_0_1_25.. | grep -i -v trivial | grep -v Merge > NEWS.new -+git shortlog COLORD_GTK_0_2_0.. | grep -i -v trivial | grep -v Merge > NEWS.new - --Version 0.1.27 --~~~~~~~~~~~~~~ --Released: 2014-xx-xx -+Version 0.2.1 -+~~~~~~~~~~~~~ -+Released: 2019-xx-xx - - New Features: - Bugfixes: -@@ -14,8 +14,8 @@ Bugfixes: - 2. Commit changes to git: - - # MAKE SURE THESE ARE CORRECT --export release_version="0.1.27" --export release_tag="COLORD_GTK_0_1_27" -+export release_version="0.2.0" -+export release_tag="COLORD_GTK_0_2_0" - - git commit -a -m "Release colord-gtk ${release_version}" - git tag -s -f -m "Release colord-gtk ${release_version}" "${release_tag}" -@@ -25,18 +25,18 @@ git push - - 3. Generate the tarball: - --make dist -+ninja dist - - 3a. Generate the additon verification metadata - --sha1sum colord-gtk-${release_version}.tar.xz > colord-gtk-${release_version}.tar.xz.sha1 --gpg -b -a colord-gtk-${release_version}.tar.xz -+sha1sum meson-dist/colord-gtk-${release_version}.tar.xz > colord-gtk-${release_version}.tar.xz.sha1 -+gpg -b -a meson-dist/colord-gtk-${release_version}.tar.xz - - 4. Upload tarball: - --scp colord-gtk-${release_version}.tar.* hughsient@annarchy.freedesktop.org:/srv/www.freedesktop.org/www/software/colord/releases/ -+scp meson-dist/colord-gtk-${release_version}.tar.* hughsient@annarchy.freedesktop.org:/srv/www.freedesktop.org/www/software/colord/releases/ - --5. Do post release version bump in configure.ac -+5. Do post release version bump in meson.build - - 6. Commit changes: - -diff --git a/meson.build b/meson.build -index 8215618..9dc56c5 100644 ---- a/meson.build -+++ b/meson.build -@@ -1,5 +1,5 @@ - project('colord-gtk', 'c', -- version : '0.2.0', -+ version : '0.2.1', - license : 'LGPL-2.1+', - meson_version : '>=0.46.0', - default_options : ['c_std=c99'] --- -2.35.1 - diff --git a/0002-Update-the-example-spec-file.patch b/0002-Update-the-example-spec-file.patch deleted file mode 100644 index c7860ff..0000000 --- a/0002-Update-the-example-spec-file.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 29768c2fc6d170fb11103c977bde24ac759db993 Mon Sep 17 00:00:00 2001 -From: Richard Hughes -Date: Thu, 20 Jun 2019 19:57:02 +0100 -Subject: [PATCH 2/6] Update the example spec file - ---- - contrib/colord-gtk.spec.in | 32 +++++++++----------------------- - 1 file changed, 9 insertions(+), 23 deletions(-) - -diff --git a/contrib/colord-gtk.spec.in b/contrib/colord-gtk.spec.in -index 81cbb58..19807ea 100644 ---- a/contrib/colord-gtk.spec.in -+++ b/contrib/colord-gtk.spec.in -@@ -8,15 +8,15 @@ License: LGPLv2+ - URL: http://www.freedesktop.org/software/colord/ - Source0: http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz - --BuildRequires: docbook-utils -+BuildRequires: meson -+BuildRequires: docbook5-style-xsl - BuildRequires: gettext >= 0.19.8 - BuildRequires: glib2-devel --BuildRequires: colord-devel -+BuildRequires: colord-devel >= 0.1.23 - BuildRequires: lcms2-devel >= 2.2 - BuildRequires: gobject-introspection-devel - BuildRequires: vala-tools - BuildRequires: gtk3-devel --BuildRequires: gtk2-devel - BuildRequires: gtk-doc - - %description -@@ -31,44 +31,29 @@ Requires: %{name}%{?_isa} = %{version}-%{release} - Files for development with %{name}. - - %prep --%setup -q -+%autosetup -p1 - - %build --%configure \ -- --enable-gtk-doc \ -- --enable-vala \ -- --enable-gtk2 \ -- --disable-static \ -- --disable-rpath \ -- --disable-dependency-tracking -- --make %{?_smp_mflags} -+%meson -Ddocs=true -Dgtk2=false -Dman=true -Dtests=false -Dvapi=true -+%meson_build - - %install --make install DESTDIR=$RPM_BUILD_ROOT -- --# Remove static libs and libtool archives. --find %{buildroot} -name '*.la' -exec rm -f {} ';' --find %{buildroot} -name '*.a' -exec rm -f {} ';' -+%meson_install - - %find_lang %{name} - --%post -p /sbin/ldconfig --%postun -p /sbin/ldconfig -+%ldconfig_scriptlets - - %files -f %{name}.lang - %doc README AUTHORS NEWS COPYING - %{_bindir}/* - %{_mandir}/man1/*.1.gz - %{_libdir}/libcolord-gtk.so.* --%{_libdir}/libcolord-gtk2.so.* - %{_libdir}/girepository-1.0/ColordGtk-1.0.typelib - - %files devel - %{_libdir}/libcolord-gtk.so --%{_libdir}/libcolord-gtk2.so - %{_libdir}/pkgconfig/colord-gtk.pc --%{_libdir}/pkgconfig/colord-gtk2.pc - %dir %{_includedir}/colord-1 - %{_includedir}/colord-1/colord-gtk.h - %dir %{_includedir}/colord-1/colord-gtk -@@ -77,6 +62,7 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';' - %{_datadir}/gir-1.0/ColordGtk-1.0.gir - %doc %{_datadir}/gtk-doc/html/colord-gtk - %{_datadir}/vala/vapi/colord-gtk.vapi -+%{_datadir}/vala/vapi/colord-gtk.deps - %dir %{_datadir}/gtk-doc - %dir %{_datadir}/gtk-doc/html - --- -2.35.1 - diff --git a/0003-Make-introspection-optional-in-meson.patch b/0003-Make-introspection-optional-in-meson.patch deleted file mode 100644 index 1474602..0000000 --- a/0003-Make-introspection-optional-in-meson.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0fb3425873a04ba100b57d59449d27bba6768ff3 Mon Sep 17 00:00:00 2001 -From: David Michael -Date: Sat, 9 Jan 2021 14:42:39 -0500 -Subject: [PATCH 3/6] Make introspection optional in meson - -It defaults to enabled to preserve existing behavior. ---- - libcolord-gtk/meson.build | 2 ++ - meson_options.txt | 1 + - 2 files changed, 3 insertions(+) - -diff --git a/libcolord-gtk/meson.build b/libcolord-gtk/meson.build -index c4fe704..18f36a0 100644 ---- a/libcolord-gtk/meson.build -+++ b/libcolord-gtk/meson.build -@@ -61,6 +61,7 @@ pkgg.generate( - description : 'colord-gtk is GTK integration for libcolord', - ) - -+if get_option('introspection') - libcolord_gtk_gir = gnome.generate_gir( - colord_gtk, - sources : [ -@@ -97,6 +98,7 @@ libcolord_gtk_gir = gnome.generate_gir( - ], - install : true - ) -+endif - - if get_option('vapi') - gnome.generate_vapi( -diff --git a/meson_options.txt b/meson_options.txt -index 1c3cecc..a4efa84 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -1,4 +1,5 @@ - option('gtk2', type : 'boolean', value : false, description : 'Build Gtk2 library') -+option('introspection', type : 'boolean', value : true, description : 'Build gobject-introspection typelib files') - option('vapi', type : 'boolean', value : false, description : 'Build vala bindings') - option('tests', type : 'boolean', value : true, description : 'Build self tests') - option('man', type : 'boolean', value : true, description : 'Generate man pages') --- -2.35.1 - diff --git a/0004-build-Rename-gtk-meson-variable-to-gtk3.patch b/0004-build-Rename-gtk-meson-variable-to-gtk3.patch deleted file mode 100644 index 66128d6..0000000 --- a/0004-build-Rename-gtk-meson-variable-to-gtk3.patch +++ /dev/null @@ -1,73 +0,0 @@ -From fd05fb0a18b9719ae5652afe1aa22d71acce99f2 Mon Sep 17 00:00:00 2001 -From: Georges Basile Stavracas Neto -Date: Fri, 22 Oct 2021 11:20:28 -0300 -Subject: [PATCH 4/6] build: Rename 'gtk' meson variable to 'gtk3' - -We'll be introducing a gtk4 variable soon, so it's good to be -more explicit with the variable naming. ---- - client/meson.build | 2 +- - libcolord-gtk/meson.build | 6 +++--- - meson.build | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/client/meson.build b/client/meson.build -index 9c65a9d..d2e9ec9 100644 ---- a/client/meson.build -+++ b/client/meson.build -@@ -10,7 +10,7 @@ executable( - dependencies : [ - glib, - gio, -- gtk, -+ gtk3, - colord, - ], - link_with : colord_gtk, -diff --git a/libcolord-gtk/meson.build b/libcolord-gtk/meson.build -index 18f36a0..612f991 100644 ---- a/libcolord-gtk/meson.build -+++ b/libcolord-gtk/meson.build -@@ -38,7 +38,7 @@ colord_gtk = shared_library( - dependencies : [ - glib, - gio, -- gtk, -+ gtk3, - colord, - ], - c_args : [ -@@ -87,7 +87,7 @@ libcolord_gtk_gir = gnome.generate_gir( - dependencies : [ - glib, - gio, -- gtk, -+ gtk3, - colord, - ], - includes : [ -@@ -156,7 +156,7 @@ if get_option('tests') - dependencies : [ - glib, - gio, -- gtk, -+ gtk3, - colord, - ], - link_with : colord_gtk, -diff --git a/meson.build b/meson.build -index 9dc56c5..c282ee9 100644 ---- a/meson.build -+++ b/meson.build -@@ -94,7 +94,7 @@ endforeach - - glib = dependency('glib-2.0', version : '>= 2.28.0') - gio = dependency('gio-2.0', version : '>= 2.25.9Z') --gtk = dependency('gtk+-3.0') -+gtk3 = dependency('gtk+-3.0') - colord = dependency('colord', version : '>= 0.1.27') - - if get_option('gtk2') --- -2.35.1 - diff --git a/0005-Add-a-GTK4-variant.patch b/0005-Add-a-GTK4-variant.patch deleted file mode 100644 index 0fb9d72..0000000 --- a/0005-Add-a-GTK4-variant.patch +++ /dev/null @@ -1,706 +0,0 @@ -From ce096b5fa63a1c99d123248d4679969c032f06f4 Mon Sep 17 00:00:00 2001 -From: Georges Basile Stavracas Neto -Date: Fri, 22 Oct 2021 12:12:30 -0300 -Subject: [PATCH 5/6] Add a GTK4 variant - -This commits adds a GTK4 variant, libcolord-gtk4. An effort was made -to keep the changes as separate and self-contained as possible. - -The new GTK4 code of the sample window and widget is introduced in -separated files, reusing the cd-sample-{window,widget}.h headers. -There was only one place in CdWindow that required split GTK3 / GTK4 -paths, and fortunately it is a rather trivial one. ---- - libcolord-gtk/cd-sample-widget-gtk4.c | 209 ++++++++++++++++++++++++++ - libcolord-gtk/cd-sample-window-gtk4.c | 189 +++++++++++++++++++++++ - libcolord-gtk/cd-self-test-gtk4.c | 133 ++++++++++++++++ - libcolord-gtk/cd-window.c | 14 ++ - libcolord-gtk/meson.build | 62 ++++++++ - meson.build | 4 + - meson_options.txt | 1 + - 7 files changed, 612 insertions(+) - create mode 100644 libcolord-gtk/cd-sample-widget-gtk4.c - create mode 100644 libcolord-gtk/cd-sample-window-gtk4.c - create mode 100644 libcolord-gtk/cd-self-test-gtk4.c - -diff --git a/libcolord-gtk/cd-sample-widget-gtk4.c b/libcolord-gtk/cd-sample-widget-gtk4.c -new file mode 100644 -index 0000000..a5abffa ---- /dev/null -+++ b/libcolord-gtk/cd-sample-widget-gtk4.c -@@ -0,0 +1,209 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2021 Georges Basile Stavracas Neto -+ * 2012 Richard Hughes -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "config.h" -+ -+#include -+#include -+ -+#include "cd-sample-widget.h" -+ -+struct CdSampleWidgetPrivate -+{ -+ cairo_t *cr; -+ CdColorRGB color; -+}; -+ -+G_DEFINE_TYPE_WITH_CODE (CdSampleWidget, cd_sample_widget, GTK_TYPE_DRAWING_AREA, -+ G_ADD_PRIVATE (CdSampleWidget)); -+ -+enum -+{ -+ PROP_0, -+ PROP_COLOR, -+}; -+ -+/** -+ * up_sample_get_property: -+ **/ -+static void -+up_sample_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -+{ -+ CdSampleWidget *sample = CD_SAMPLE_WIDGET (object); -+ CdSampleWidgetPrivate *priv = cd_sample_widget_get_instance_private (sample); -+ switch (prop_id) { -+ case PROP_COLOR: -+ g_value_set_boxed (value, &priv->color); -+ break; -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ break; -+ } -+} -+ -+/** -+ * up_sample_set_property: -+ **/ -+static void -+up_sample_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -+{ -+ CdColorRGB *tmp; -+ CdSampleWidget *sample = CD_SAMPLE_WIDGET (object); -+ CdSampleWidgetPrivate *priv = cd_sample_widget_get_instance_private (sample); -+ -+ switch (prop_id) { -+ case PROP_COLOR: -+ tmp = g_value_get_boxed (value); -+ cd_color_rgb_copy (tmp, &priv->color); -+ break; -+ default: -+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); -+ break; -+ } -+ -+ /* refresh widget */ -+ gtk_widget_hide (GTK_WIDGET (sample)); -+ gtk_widget_show (GTK_WIDGET (sample)); -+} -+ -+/** -+ * cd_sample_widget_draw_rounded_rectangle: -+ **/ -+static void -+cd_sample_widget_draw_rounded_rectangle (cairo_t *cr, -+ gdouble x, -+ gdouble y, -+ gdouble width, -+ gdouble height, -+ gdouble corner_radius) -+{ -+ gdouble aspect = width / height; -+ gdouble radius = corner_radius / aspect; -+ gdouble degrees = G_PI / 180.0; -+ -+ cairo_new_sub_path (cr); -+ cairo_arc (cr, x + width - radius, y + radius, -+ radius, -90 * degrees, 0 * degrees); -+ cairo_arc (cr, x + width - radius, y + height - radius, -+ radius, 0 * degrees, 90 * degrees); -+ cairo_arc (cr, x + radius, y + height - radius, -+ radius, 90 * degrees, 180 * degrees); -+ cairo_arc (cr, x + radius, y + radius, -+ radius, 180 * degrees, 270 * degrees); -+ cairo_close_path (cr); -+} -+ -+/** -+ * cd_sample_widget_draw: -+ **/ -+static void -+cd_sample_widget_draw (GtkDrawingArea *drawing_area, -+ cairo_t *cr, -+ int width, -+ int height, -+ gpointer user_data) -+{ -+ CdSampleWidget *sample = CD_SAMPLE_WIDGET (drawing_area); -+ CdSampleWidgetPrivate *priv = cd_sample_widget_get_instance_private (sample); -+ CdColorRGB *color; -+ -+ color = &priv->color; -+ cairo_save (cr); -+ cairo_set_source_rgb (cr, color->R, color->G, color->B); -+ cd_sample_widget_draw_rounded_rectangle (cr, 0, 0, width, height, 10.5); -+ cairo_fill_preserve (cr); -+ cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 1.0); -+ cairo_set_line_width (cr, 1.0); -+ cairo_stroke (cr); -+ cairo_restore (cr); -+} -+ -+/** -+ * cd_sample_widget_class_init: -+ **/ -+static void -+cd_sample_widget_class_init (CdSampleWidgetClass *class) -+{ -+ GObjectClass *object_class = G_OBJECT_CLASS (class); -+ -+ object_class->get_property = up_sample_get_property; -+ object_class->set_property = up_sample_set_property; -+ -+ /* properties */ -+ g_object_class_install_property (object_class, -+ PROP_COLOR, -+ g_param_spec_boxed ("color", NULL, NULL, -+ CD_TYPE_COLOR_RGB, -+ G_PARAM_READWRITE)); -+} -+ -+/** -+ * cd_sample_widget_init: -+ **/ -+static void -+cd_sample_widget_init (CdSampleWidget *sample) -+{ -+ CdSampleWidgetPrivate *priv = cd_sample_widget_get_instance_private (sample); -+ -+ gtk_widget_set_cursor (GTK_WIDGET (sample), gdk_cursor_new_from_name ("blank", NULL)); -+ cd_color_rgb_set (&priv->color, 1.0, 1.0, 1.0); -+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (sample), -+ cd_sample_widget_draw, -+ sample, NULL); -+} -+ -+/** -+ * cd_sample_widget_set_color: -+ * @sample: This class instance -+ * @color: A color -+ * -+ * Sets the color for the sample widget -+ * -+ * Since: 0.1.24 -+ **/ -+void -+cd_sample_widget_set_color (CdSampleWidget *sample, const CdColorRGB *color) -+{ -+ CdSampleWidgetPrivate *priv; -+ -+ g_return_if_fail (color != NULL); -+ g_return_if_fail (CD_IS_SAMPLE_WIDGET (sample)); -+ -+ priv = cd_sample_widget_get_instance_private (sample); -+ -+ /* set new color and refresh */ -+ cd_color_rgb_copy (color, &priv->color); -+ gtk_widget_queue_draw (GTK_WIDGET (sample)); -+} -+ -+/** -+ * cd_sample_widget_new: -+ * -+ * Return value: A new #CdSampleWidget object. -+ * -+ * Since: 0.1.24 -+ **/ -+GtkWidget * -+cd_sample_widget_new (void) -+{ -+ return g_object_new (CD_TYPE_SAMPLE_WIDGET, NULL); -+} -diff --git a/libcolord-gtk/cd-sample-window-gtk4.c b/libcolord-gtk/cd-sample-window-gtk4.c -new file mode 100644 -index 0000000..a7e09bc ---- /dev/null -+++ b/libcolord-gtk/cd-sample-window-gtk4.c -@@ -0,0 +1,189 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2021 Georges Basile Stavracas Neto -+ * 2009-2012 Richard Hughes -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "config.h" -+ -+#include -+ -+#include -+ -+#include "cd-sample-widget.h" -+#include "cd-sample-window.h" -+ -+static void cd_sample_window_finalize (GObject *object); -+ -+#define CD_SAMPLE_WINDOW_PULSE_DELAY 80 /* ms */ -+ -+/** -+ * CdSampleWindowPrivate: -+ * -+ * Private #CdSampleWindow data -+ **/ -+struct _CdSampleWindowPrivate -+{ -+ GtkWidget *sample_widget; -+ GtkWidget *progress_bar; -+ guint pulse_id; -+}; -+ -+G_DEFINE_TYPE_WITH_CODE (CdSampleWindow, cd_sample_window, GTK_TYPE_WINDOW, -+ G_ADD_PRIVATE (CdSampleWindow)) -+ -+/** -+ * cd_sample_window_pulse_cb: -+ **/ -+static gboolean -+cd_sample_window_pulse_cb (CdSampleWindow *sample_window) -+{ -+ CdSampleWindowPrivate *priv = cd_sample_window_get_instance_private (sample_window); -+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar)); -+ return TRUE; -+} -+ -+/** -+ * cd_sample_window_set_fraction: -+ * @sample_window: a valid #CdSampleWindow instance -+ * @fraction: the fraction value to show, or -1 for pulsing. -+ * -+ * Sets the percentage value on the window. -+ * -+ * Since: 0.1.22 -+ **/ -+void -+cd_sample_window_set_fraction (CdSampleWindow *sample_window, -+ gdouble fraction) -+{ -+ CdSampleWindowPrivate *priv = cd_sample_window_get_instance_private (sample_window); -+ -+ /* make pulse */ -+ if (fraction == -1) { -+ if (priv->pulse_id == 0) { -+ priv->pulse_id = g_timeout_add (CD_SAMPLE_WINDOW_PULSE_DELAY, -+ (GSourceFunc) cd_sample_window_pulse_cb, -+ sample_window); -+ } -+ return; -+ } -+ -+ /* no more pulsing */ -+ if (priv->pulse_id != 0) { -+ g_source_remove (priv->pulse_id); -+ priv->pulse_id = 0; -+ } -+ -+ /* set static value */ -+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar), fraction); -+} -+ -+/** -+ * cd_sample_window_set_color: -+ * @sample_window: a valid #CdSampleWindow instance -+ * @color: the color -+ * -+ * Sets the window to a specific color. -+ * -+ * Since: 0.1.22 -+ **/ -+void -+cd_sample_window_set_color (CdSampleWindow *sample_window, -+ const CdColorRGB *color) -+{ -+ CdSampleWindowPrivate *priv = cd_sample_window_get_instance_private (sample_window); -+ -+ g_debug ("setting RGB: %f, %f, %f", color->R, color->G, color->B); -+ cd_sample_widget_set_color (CD_SAMPLE_WIDGET (priv->sample_widget), color); -+ -+ /* force redraw */ -+ gtk_widget_set_visible (priv->sample_widget, FALSE); -+ gtk_widget_set_visible (priv->sample_widget, TRUE); -+} -+ -+/** -+ * cd_sample_window_class_init: -+ **/ -+static void -+cd_sample_window_class_init (CdSampleWindowClass *klass) -+{ -+ GObjectClass *object_class = G_OBJECT_CLASS (klass); -+ object_class->finalize = cd_sample_window_finalize; -+} -+ -+/** -+ * cd_sample_window_init: -+ **/ -+static void -+cd_sample_window_init (CdSampleWindow *sample_window) -+{ -+ CdSampleWindowPrivate *priv = cd_sample_window_get_instance_private (sample_window); -+ GtkWindow *window = GTK_WINDOW (sample_window); -+ GtkWidget *vbox; -+ priv->sample_widget = cd_sample_widget_new (); -+ priv->progress_bar = gtk_progress_bar_new (); -+ -+ /* pack in two widgets into the window */ -+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -+ gtk_window_set_child (window, vbox); -+ gtk_box_append (GTK_BOX (vbox), priv->sample_widget); -+ gtk_box_append (GTK_BOX (vbox), priv->progress_bar); -+ gtk_widget_set_size_request (priv->sample_widget, 400, 400); -+ -+ gtk_widget_set_cursor (GTK_WIDGET (window), gdk_cursor_new_from_name ("blank", NULL)); -+} -+ -+/** -+ * cd_sample_window_finalize: -+ **/ -+static void -+cd_sample_window_finalize (GObject *object) -+{ -+ CdSampleWindow *sample_window = CD_SAMPLE_WINDOW (object); -+ CdSampleWindowPrivate *priv = cd_sample_window_get_instance_private (sample_window); -+ -+ if (priv->pulse_id != 0) -+ g_source_remove (priv->pulse_id); -+ -+ G_OBJECT_CLASS (cd_sample_window_parent_class)->finalize (object); -+} -+ -+/** -+ * cd_sample_window_new: -+ * -+ * Return value: a new #CdSampleWindow object. -+ * -+ * Since: 0.1.22 -+ **/ -+GtkWindow * -+cd_sample_window_new (void) -+{ -+ CdSampleWindow *sample_window; -+ sample_window = g_object_new (CD_TYPE_SAMPLE_WINDOW, -+ "decorated", FALSE, -+ "default-height", 400, -+ "default-width", 400, -+ "deletable", FALSE, -+ "destroy-with-parent", TRUE, -+ "icon-name", "icc-profile", -+ "resizable", FALSE, -+ "title", "calibration square", -+ NULL); -+ return GTK_WINDOW (sample_window); -+} -diff --git a/libcolord-gtk/cd-self-test-gtk4.c b/libcolord-gtk/cd-self-test-gtk4.c -new file mode 100644 -index 0000000..a8a6e4b ---- /dev/null -+++ b/libcolord-gtk/cd-self-test-gtk4.c -@@ -0,0 +1,133 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2021 Georges Basile Stavracas Neto -+ * 2010-2012 Richard Hughes -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "config.h" -+ -+#include -+#include -+#include -+#include -+ -+#include "cd-sample-window.h" -+#include "cd-window.h" -+ -+static void -+cd_window_get_profile_cb (GObject *source, -+ GAsyncResult *res, -+ gpointer user_data) -+{ -+ CdWindow *window = CD_WINDOW (source); -+ GtkWidget *widget = GTK_WIDGET (user_data); -+ GError *error = NULL; -+ CdProfile *profile; -+ -+ profile = cd_window_get_profile_finish (window, -+ res, -+ &error); -+ g_assert_no_error (error); -+ g_assert (profile != NULL); -+ g_debug ("profile was %s", cd_profile_get_filename (profile)); -+ g_object_unref (profile); -+ -+ /* kill the dialog */ -+ gtk_window_destroy (GTK_WINDOW (widget)); -+} -+ -+static void -+map_cb (GtkWidget *this_widget, gpointer user_data) -+{ -+ CdWindow *window = CD_WINDOW (user_data); -+ -+ /* get the profile for this widget */ -+ cd_window_get_profile (window, -+ this_widget, -+ NULL, -+ cd_window_get_profile_cb, -+ this_widget); -+} -+ -+static void -+colord_window_func (void) -+{ -+ CdWindow *window; -+ GtkWidget *dialog; -+ -+ window = cd_window_new (); -+ dialog = gtk_message_dialog_new (NULL, -+ GTK_DIALOG_MODAL, -+ GTK_MESSAGE_INFO, -+ GTK_BUTTONS_OK, -+ "%s", "Hello world"); -+ g_signal_connect (dialog, "map", -+ G_CALLBACK (map_cb), -+ window); -+ gtk_window_present (GTK_WINDOW (dialog)); -+} -+ -+static gboolean -+colord_sample_window_loop_cb (GMainLoop *loop) -+{ -+ g_main_loop_quit (loop); -+ return FALSE; -+} -+ -+static void -+colord_sample_window_func (void) -+{ -+ GtkWindow *window; -+ GMainLoop *loop; -+ CdColorRGB source; -+ -+ window = cd_sample_window_new (); -+ g_assert (window != NULL); -+ source.R = 1.0f; -+ source.G = 1.0f; -+ source.B = 0.0f; -+ cd_sample_window_set_color (CD_SAMPLE_WINDOW (window), &source); -+ cd_sample_window_set_fraction (CD_SAMPLE_WINDOW (window), -1); -+ -+ /* move to the center of device lvds1 */ -+ gtk_window_present (window); -+ -+ loop = g_main_loop_new (NULL, FALSE); -+ g_timeout_add_seconds (5, (GSourceFunc) colord_sample_window_loop_cb, loop); -+ g_main_loop_run (loop); -+ -+ g_main_loop_unref (loop); -+ gtk_window_destroy (GTK_WINDOW (window)); -+} -+ -+int -+main (int argc, char **argv) -+{ -+ g_test_init (&argc, &argv, NULL); -+ gtk_init (); -+ -+ /* only critical and error are fatal */ -+ g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); -+ -+ /* tests go here */ -+ g_test_add_func ("/colord/window", colord_window_func); -+ g_test_add_func ("/colors/sample-window", colord_sample_window_func); -+ return g_test_run (); -+} -+ -diff --git a/libcolord-gtk/cd-window.c b/libcolord-gtk/cd-window.c -index 75351b1..45f65ad 100644 ---- a/libcolord-gtk/cd-window.c -+++ b/libcolord-gtk/cd-window.c -@@ -377,6 +377,8 @@ cd_window_update_widget_plug_name (CdWindow *window, - { - CdWindowPrivate *priv = window->priv; - gchar *plug_name; -+ -+#ifndef BUILD_COLORD_GTK4 - GdkScreen *screen; - GdkWindow *gdk_window; - gint monitor_num; -@@ -388,6 +390,18 @@ cd_window_update_widget_plug_name (CdWindow *window, - monitor_num = gdk_screen_get_monitor_at_window (screen, - gdk_window); - plug_name = gdk_screen_get_monitor_plug_name (screen, monitor_num); -+#else -+ GdkSurface *surface; -+ GdkDisplay *display; -+ GdkMonitor *monitor; -+ GtkNative *native; -+ -+ native = gtk_widget_get_native (widget); -+ surface = gtk_native_get_surface (native); -+ display = gtk_widget_get_display (widget); -+ monitor = gdk_display_get_monitor_at_surface (display, surface); -+ plug_name = g_strdup (gdk_monitor_get_connector (monitor)); -+#endif - - /* ignoring MAP as plug_name has not changed */ - if (g_strcmp0 (plug_name, priv->plug_name) == 0) { -diff --git a/libcolord-gtk/meson.build b/libcolord-gtk/meson.build -index 612f991..5815f2a 100644 ---- a/libcolord-gtk/meson.build -+++ b/libcolord-gtk/meson.build -@@ -144,6 +144,68 @@ if get_option('gtk2') - ) - endif - -+if get_option('gtk4') -+ colord_gtk4 = shared_library( -+ 'colord-gtk4', -+ sources : [ -+ 'cd-sample-widget-gtk4.c', -+ 'cd-sample-window-gtk4.c', -+ 'cd-window.c', -+ 'cd-window-sync.c', -+ ], -+ soversion : lt_current, -+ version : lt_version, -+ dependencies : [ -+ glib, -+ gio, -+ gtk4, -+ colord, -+ ], -+ c_args : [ -+ cargs, -+ '-DBUILD_COLORD_GTK4', -+ ], -+ include_directories : [ -+ root_incdir, -+ ], -+ install : true -+ ) -+ -+ pkgg.generate( -+ libraries : colord_gtk4, -+ requires : [ 'colord', 'gtk4' ], -+ subdirs : 'colord-1', -+ version : meson.project_version(), -+ name : 'colord-gtk4', -+ filebase : 'colord-gtk4', -+ description : 'colord-gtk4 is GTK4 integration for libcolord', -+ ) -+ -+ if get_option('tests') -+ e = executable( -+ 'colord-gtk4-test', -+ sources : [ -+ 'cd-self-test-gtk4.c', -+ ], -+ include_directories : [ -+ root_incdir, -+ ], -+ dependencies : [ -+ glib, -+ gio, -+ gtk4, -+ colord, -+ ], -+ link_with : colord_gtk4, -+ c_args : [ -+ cargs, -+ ] -+ ) -+ test('colord-gtk4-test-private', e) -+ endif -+ -+endif -+ - if get_option('tests') - e = executable( - 'colord-gtk-test', -diff --git a/meson.build b/meson.build -index c282ee9..e947c84 100644 ---- a/meson.build -+++ b/meson.build -@@ -102,6 +102,10 @@ if get_option('gtk2') - conf.set('HAVE_GTK2', '1') - endif - -+if get_option('gtk4') -+ gtk4 = dependency('gtk4', version : '>= 4.4') -+endif -+ - gnome = import('gnome') - i18n = import('i18n') - -diff --git a/meson_options.txt b/meson_options.txt -index a4efa84..53a03ea 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -1,3 +1,4 @@ -+option('gtk4', type : 'boolean', value : true, description : 'Build Gtk4 library') - option('gtk2', type : 'boolean', value : false, description : 'Build Gtk2 library') - option('introspection', type : 'boolean', value : true, description : 'Build gobject-introspection typelib files') - option('vapi', type : 'boolean', value : false, description : 'Build vala bindings') --- -2.35.1 - diff --git a/0006-build-Make-GTK3-build-optional-too.patch b/0006-build-Make-GTK3-build-optional-too.patch deleted file mode 100644 index f2261a2..0000000 --- a/0006-build-Make-GTK3-build-optional-too.patch +++ /dev/null @@ -1,296 +0,0 @@ -From 9006c04021018368cd79b2feda962ee5a5370c64 Mon Sep 17 00:00:00 2001 -From: Georges Basile Stavracas Neto -Date: Fri, 22 Oct 2021 12:29:10 -0300 -Subject: [PATCH 6/6] build: Make GTK3 build optional too - -This allows pure GTK4 builds of the library. The conversion -tool (cd-convert) isn't built when the GTK3 build is disabled. ---- - libcolord-gtk/meson.build | 213 +++++++++++++++++++------------------- - meson.build | 9 +- - meson_options.txt | 1 + - 3 files changed, 116 insertions(+), 107 deletions(-) - -diff --git a/libcolord-gtk/meson.build b/libcolord-gtk/meson.build -index 5815f2a..351cbb9 100644 ---- a/libcolord-gtk/meson.build -+++ b/libcolord-gtk/meson.build -@@ -25,89 +25,7 @@ install_headers([ - subdir : 'colord-1/colord-gtk', - ) - --colord_gtk = shared_library( -- 'colord-gtk', -- sources : [ -- 'cd-sample-widget.c', -- 'cd-sample-window.c', -- 'cd-window.c', -- 'cd-window-sync.c', -- ], -- soversion : lt_current, -- version : lt_version, -- dependencies : [ -- glib, -- gio, -- gtk3, -- colord, -- ], -- c_args : [ -- cargs, -- ], -- include_directories : [ -- root_incdir, -- ], -- install : true --) -- - pkgg = import('pkgconfig') --pkgg.generate( -- libraries : colord_gtk, -- requires : [ 'colord', 'gtk+-3.0' ], -- subdirs : 'colord-1', -- version : meson.project_version(), -- name : 'colord-gtk', -- filebase : 'colord-gtk', -- description : 'colord-gtk is GTK integration for libcolord', --) -- --if get_option('introspection') --libcolord_gtk_gir = gnome.generate_gir( -- colord_gtk, -- sources : [ -- 'cd-sample-widget.c', -- 'cd-sample-widget.h', -- 'cd-sample-window.c', -- 'cd-sample-window.h', -- 'cd-window.c', -- 'cd-window.h', -- 'cd-window-sync.c', -- 'cd-window-sync.h', -- colord_gtk_version_h, -- ], -- nsversion : '1.0', -- namespace : 'ColordGtk', -- symbol_prefix : 'cd', -- identifier_prefix : 'Cd', -- export_packages : 'colord-gtk', -- extra_args : [ -- '--c-include=colord-gtk.h', -- '-DCD_COMPILATION', -- ], -- dependencies : [ -- glib, -- gio, -- gtk3, -- colord, -- ], -- includes : [ -- 'GObject-2.0', -- 'Gio-2.0', -- 'Gtk-3.0', -- 'Colord-1.0', -- ], -- install : true --) --endif -- --if get_option('vapi') -- gnome.generate_vapi( -- 'colord-gtk', -- sources: libcolord_gtk_gir[0], -- packages: [ 'glib-2.0', 'gio-2.0', 'gtk+-3.0', 'colord' ], -- install: true, -- ) --endif - - if get_option('gtk2') - colord_gtk2 = shared_library( -@@ -144,6 +62,114 @@ if get_option('gtk2') - ) - endif - -+if get_option('gtk3') -+ colord_gtk = shared_library( -+ 'colord-gtk', -+ sources : [ -+ 'cd-sample-widget.c', -+ 'cd-sample-window.c', -+ 'cd-window.c', -+ 'cd-window-sync.c', -+ ], -+ soversion : lt_current, -+ version : lt_version, -+ dependencies : [ -+ glib, -+ gio, -+ gtk3, -+ colord, -+ ], -+ c_args : [ -+ cargs, -+ ], -+ include_directories : [ -+ root_incdir, -+ ], -+ install : true -+ ) -+ -+ pkgg.generate( -+ libraries : colord_gtk, -+ requires : [ 'colord', 'gtk+-3.0' ], -+ subdirs : 'colord-1', -+ version : meson.project_version(), -+ name : 'colord-gtk', -+ filebase : 'colord-gtk', -+ description : 'colord-gtk is GTK integration for libcolord', -+ ) -+ -+ if get_option('introspection') -+ libcolord_gtk_gir = gnome.generate_gir( -+ colord_gtk, -+ sources : [ -+ 'cd-sample-widget.c', -+ 'cd-sample-widget.h', -+ 'cd-sample-window.c', -+ 'cd-sample-window.h', -+ 'cd-window.c', -+ 'cd-window.h', -+ 'cd-window-sync.c', -+ 'cd-window-sync.h', -+ colord_gtk_version_h, -+ ], -+ nsversion : '1.0', -+ namespace : 'ColordGtk', -+ symbol_prefix : 'cd', -+ identifier_prefix : 'Cd', -+ export_packages : 'colord-gtk', -+ extra_args : [ -+ '--c-include=colord-gtk.h', -+ '-DCD_COMPILATION', -+ ], -+ dependencies : [ -+ glib, -+ gio, -+ gtk3, -+ colord, -+ ], -+ includes : [ -+ 'GObject-2.0', -+ 'Gio-2.0', -+ 'Gtk-3.0', -+ 'Colord-1.0', -+ ], -+ install : true -+ ) -+ endif -+ -+ if get_option('vapi') -+ gnome.generate_vapi( -+ 'colord-gtk', -+ sources: libcolord_gtk_gir[0], -+ packages: [ 'glib-2.0', 'gio-2.0', 'gtk+-3.0', 'colord' ], -+ install: true, -+ ) -+ endif -+ -+ if get_option('tests') -+ e = executable( -+ 'colord-gtk-test', -+ sources : [ -+ 'cd-self-test.c', -+ ], -+ include_directories : [ -+ root_incdir, -+ ], -+ dependencies : [ -+ glib, -+ gio, -+ gtk3, -+ colord, -+ ], -+ link_with : colord_gtk, -+ c_args : [ -+ cargs, -+ ] -+ ) -+ test('colord-test-private', e) -+ endif -+endif -+ - if get_option('gtk4') - colord_gtk4 = shared_library( - 'colord-gtk4', -@@ -205,26 +231,3 @@ if get_option('gtk4') - endif - - endif -- --if get_option('tests') -- e = executable( -- 'colord-gtk-test', -- sources : [ -- 'cd-self-test.c', -- ], -- include_directories : [ -- root_incdir, -- ], -- dependencies : [ -- glib, -- gio, -- gtk3, -- colord, -- ], -- link_with : colord_gtk, -- c_args : [ -- cargs, -- ] -- ) --test('colord-test-private', e) --endif -diff --git a/meson.build b/meson.build -index e947c84..118257e 100644 ---- a/meson.build -+++ b/meson.build -@@ -94,7 +94,6 @@ endforeach - - glib = dependency('glib-2.0', version : '>= 2.28.0') - gio = dependency('gio-2.0', version : '>= 2.25.9Z') --gtk3 = dependency('gtk+-3.0') - colord = dependency('colord', version : '>= 0.1.27') - - if get_option('gtk2') -@@ -102,6 +101,10 @@ if get_option('gtk2') - conf.set('HAVE_GTK2', '1') - endif - -+if get_option('gtk3') -+ gtk3 = dependency('gtk+-3.0') -+endif -+ - if get_option('gtk4') - gtk4 = dependency('gtk4', version : '>= 4.4') - endif -@@ -144,7 +147,9 @@ root_incdir = include_directories('.') - subdir('libcolord-gtk') - subdir('po') - --subdir('client') -+if get_option('gtk3') -+ subdir('client') -+endif - if get_option('docs') - subdir('doc') - endif -diff --git a/meson_options.txt b/meson_options.txt -index 53a03ea..87bf7c0 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -1,4 +1,5 @@ - option('gtk4', type : 'boolean', value : true, description : 'Build Gtk4 library') -+option('gtk3', type : 'boolean', value : true, description : 'Build Gtk3 library') - option('gtk2', type : 'boolean', value : false, description : 'Build Gtk2 library') - option('introspection', type : 'boolean', value : true, description : 'Build gobject-introspection typelib files') - option('vapi', type : 'boolean', value : false, description : 'Build vala bindings') --- -2.35.1 - diff --git a/colord-gtk.spec b/colord-gtk.spec index 24d1ff5..6fc7553 100644 --- a/colord-gtk.spec +++ b/colord-gtk.spec @@ -1,19 +1,11 @@ Summary: GTK+ 3 support library for colord Name: colord-gtk -Version: 0.2.0 -Release: 9%{?dist} +Version: 0.3.0 +Release: 1%{?dist} License: LGPLv2+ URL: http://www.freedesktop.org/software/colord/ Source0: http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz -# Patches to git 9006c040 for GTK+4 support -Patch0001: 0001-trivial-post-release-version-bump.patch -Patch0002: 0002-Update-the-example-spec-file.patch -Patch0003: 0003-Make-introspection-optional-in-meson.patch -Patch0004: 0004-build-Rename-gtk-meson-variable-to-gtk3.patch -Patch0005: 0005-Add-a-GTK4-variant.patch -Patch0006: 0006-build-Make-GTK3-build-optional-too.patch - BuildRequires: meson BuildRequires: docbook5-style-xsl BuildRequires: gettext >= 0.19.8 @@ -98,6 +90,9 @@ Files for GTK 4 development with %{name}4. %changelog +* Wed Feb 16 2022 Richard Hughes 0.3.0-1 +- New upstream version. + * Tue Feb 15 2022 Adam Williamson - 0.2.0-9 - Add GTK+ 4 build diff --git a/sources b/sources index deddafc..77eaf2d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (colord-gtk-0.2.0.tar.xz) = 797eebfd4451fcae4cf70835f5de3d9bdc9e8401ddb82a2fef2310002f28bf523b599c587ff35eb89ceff38a245a6311129ad90b107f837ac4f42f268c9aad97 +SHA512 (colord-gtk-0.3.0.tar.xz) = 95ea9e8925d56462b8e5230a6737ca8e75d2273b2803e00f7aa2f933d22f88373194dccc00117fce85579274cc0daf88876fa265510580b1610734bb45220896