diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-10-26 21:52:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-10-29 13:31:41 -0400 |
commit | a51a6a3ee23e31f868cdbea2b91171b0ddaabc79 (patch) | |
tree | f7c8cfe4bcf414cc90c472b3c10d6d552ecaef24 | |
parent | 8bee62dd3695f3e07d3c0b487b38a5814ed6720a (diff) | |
download | gtk+-a51a6a3ee23e31f868cdbea2b91171b0ddaabc79.tar.gz |
Deprecate GtkColorChooser and implementations
These are being replaced by GtkColorDialog
and GtkColorDialogButton.
This commit only moves the headers for GtkColorChooserWidget
and GtkColorChooserDialog to deprecated/, and keeps the
implementations in gtk/, since they will eventually be
salvaged into a private GtkColorChooserWindow.
22 files changed, 89 insertions, 34 deletions
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c index e406ca3972..fbf28ec305 100644 --- a/demos/gtk-demo/dnd.c +++ b/demos/gtk-demo/dnd.c @@ -726,7 +726,9 @@ do_dnd (GtkWidget *do_widget) GtkCssProvider *provider; GString *css; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS button = gtk_color_button_new (); +G_GNUC_END_IGNORE_DEPRECATIONS g_object_unref (g_object_ref_sink (button)); provider = gtk_css_provider_new (); diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c index ed71354f1d..fd358eb47b 100644 --- a/demos/gtk-demo/font_features.c +++ b/demos/gtk-demo/font_features.c @@ -21,6 +21,8 @@ #include "script-names.h" #include "language-names.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /* {{{ ScriptLang object */ G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject) diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c index 92774b0efb..d60991f981 100644 --- a/demos/gtk-demo/paint.c +++ b/demos/gtk-demo/paint.c @@ -7,6 +7,8 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + enum { COLOR_SET, N_SIGNALS diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index 705606fcfe..b41283d10f 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -1096,7 +1096,9 @@ set_color (GtkListBox *box, GtkListBoxRow *row, GtkColorChooser *chooser) if (gdk_rgba_parse (&rgba, color)) { g_signal_handlers_block_by_func (chooser, rgba_changed, box); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_color_chooser_set_rgba (chooser, &rgba); +G_GNUC_END_IGNORE_DEPRECATIONS g_signal_handlers_unblock_by_func (chooser, rgba_changed, box); } } diff --git a/gtk/gtkcolorbutton.c b/gtk/deprecated/gtkcolorbutton.c index 8d1e4ceb30..6cd40101aa 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/deprecated/gtkcolorbutton.c @@ -46,6 +46,8 @@ #include "gtkwidgetprivate.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkColorButton: * @@ -67,6 +69,8 @@ * `GtkColorButton` has a single CSS node with name colorbutton which * contains a button node. To differentiate it from a plain `GtkButton`, * it gets the .color style class. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ typedef struct _GtkColorButtonClass GtkColorButtonClass; @@ -353,6 +357,8 @@ gtk_color_button_finalize (GObject *object) * color when the user finishes. * * Returns: a new color button + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ GtkWidget * gtk_color_button_new (void) @@ -561,6 +567,8 @@ set_use_alpha (GtkColorButton *button, * @title: String containing new window title * * Sets the title for the color chooser dialog. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ void gtk_color_button_set_title (GtkColorButton *button, @@ -587,6 +595,8 @@ gtk_color_button_set_title (GtkColorButton *button, * Gets the title of the color chooser dialog. * * Returns: An internal string, do not free the return value + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ const char * gtk_color_button_get_title (GtkColorButton *button) @@ -602,6 +612,8 @@ gtk_color_button_get_title (GtkColorButton *button) * @modal: %TRUE to make the dialog modal * * Sets whether the dialog should be modal. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ void gtk_color_button_set_modal (GtkColorButton *button, @@ -627,6 +639,8 @@ gtk_color_button_set_modal (GtkColorButton *button, * Gets whether the dialog is modal. * * Returns: %TRUE if the dialog is modal + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialogButton] instead */ gboolean gtk_color_button_get_modal (GtkColorButton *button) diff --git a/gtk/gtkcolorbutton.h b/gtk/deprecated/gtkcolorbutton.h index a8ac6cbfe6..ce565d6728 100644 --- a/gtk/gtkcolorbutton.h +++ b/gtk/deprecated/gtkcolorbutton.h @@ -48,19 +48,19 @@ typedef struct _GtkColorButton GtkColorButton; GDK_AVAILABLE_IN_ALL GType gtk_color_button_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_color_button_new (void); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_color_button_new_with_rgba (const GdkRGBA *rgba); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_button_set_title (GtkColorButton *button, const char *title); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 const char *gtk_color_button_get_title (GtkColorButton *button); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 gboolean gtk_color_button_get_modal (GtkColorButton *button); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_button_set_modal (GtkColorButton *button, gboolean modal); diff --git a/gtk/gtkcolorchooser.c b/gtk/deprecated/gtkcolorchooser.c index 3e89cd6bc2..c38eb43d5e 100644 --- a/gtk/gtkcolorchooser.c +++ b/gtk/deprecated/gtkcolorchooser.c @@ -36,6 +36,9 @@ * In GTK, the main widgets that implement this interface are * [class@Gtk.ColorChooserWidget], [class@Gtk.ColorChooserDialog] and * [class@Gtk.ColorButton]. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] and [class@Gtk.ColorDialogButton] + * instead of widgets implementing `GtkColorChooser` */ enum @@ -116,6 +119,8 @@ _gtk_color_chooser_color_activated (GtkColorChooser *chooser, * @color: (out): a `GdkRGBA` to fill in with the current color * * Gets the currently-selected color. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ void gtk_color_chooser_get_rgba (GtkColorChooser *chooser, @@ -132,6 +137,8 @@ gtk_color_chooser_get_rgba (GtkColorChooser *chooser, * @color: the new color * * Sets the color. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ void gtk_color_chooser_set_rgba (GtkColorChooser *chooser, @@ -151,6 +158,8 @@ gtk_color_chooser_set_rgba (GtkColorChooser *chooser, * * Returns: %TRUE if the color chooser uses the alpha channel, * %FALSE if not + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ gboolean gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser) @@ -170,6 +179,8 @@ gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser) * @use_alpha: %TRUE if color chooser should use alpha channel, %FALSE if not * * Sets whether or not the color chooser should use the alpha channel. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ void gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser, @@ -207,6 +218,8 @@ gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser, * of removing the default color palette from the color chooser. * * If @colors is %NULL, removes all previously added palettes. + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ void gtk_color_chooser_add_palette (GtkColorChooser *chooser, diff --git a/gtk/gtkcolorchooser.h b/gtk/deprecated/gtkcolorchooser.h index 7a97865b8d..1c573a22d7 100644 --- a/gtk/gtkcolorchooser.h +++ b/gtk/deprecated/gtkcolorchooser.h @@ -63,20 +63,20 @@ struct _GtkColorChooserInterface GDK_AVAILABLE_IN_ALL GType gtk_color_chooser_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_chooser_get_rgba (GtkColorChooser *chooser, GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_chooser_set_rgba (GtkColorChooser *chooser, const GdkRGBA *color); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 gboolean gtk_color_chooser_get_use_alpha (GtkColorChooser *chooser); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser, gboolean use_alpha); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_color_chooser_add_palette (GtkColorChooser *chooser, GtkOrientation orientation, int colors_per_line, diff --git a/gtk/gtkcolorchooserdialog.h b/gtk/deprecated/gtkcolorchooserdialog.h index c5212d912d..a5d0f4ef86 100644 --- a/gtk/gtkcolorchooserdialog.h +++ b/gtk/deprecated/gtkcolorchooserdialog.h @@ -35,7 +35,7 @@ typedef struct _GtkColorChooserDialog GtkColorChooserDialog; GDK_AVAILABLE_IN_ALL GType gtk_color_chooser_dialog_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_color_chooser_dialog_new (const char *title, GtkWindow *parent); diff --git a/gtk/gtkcolorchooserprivate.h b/gtk/deprecated/gtkcolorchooserprivate.h index c4c1c935f9..c4c1c935f9 100644 --- a/gtk/gtkcolorchooserprivate.h +++ b/gtk/deprecated/gtkcolorchooserprivate.h diff --git a/gtk/gtkcolorchooserwidget.h b/gtk/deprecated/gtkcolorchooserwidget.h index 6634f0eb9c..51dfb278e6 100644 --- a/gtk/gtkcolorchooserwidget.h +++ b/gtk/deprecated/gtkcolorchooserwidget.h @@ -35,7 +35,7 @@ typedef struct _GtkColorChooserWidget GtkColorChooserWidget; GDK_AVAILABLE_IN_ALL GType gtk_color_chooser_widget_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_color_chooser_widget_new (void); G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserWidget, g_object_unref) diff --git a/gtk/deprecated/meson.build b/gtk/deprecated/meson.build index cd5b182170..ae5012bb5b 100644 --- a/gtk/deprecated/meson.build +++ b/gtk/deprecated/meson.build @@ -19,6 +19,8 @@ gtk_deprecated_sources = [ 'deprecated/gtkcellrenderertext.c', 'deprecated/gtkcellrenderertoggle.c', 'deprecated/gtkcellview.c', + 'deprecated/gtkcolorbutton.c', + 'deprecated/gtkcolorchooser.c', 'deprecated/gtkcombobox.c', 'deprecated/gtkcomboboxtext.c', 'deprecated/gtkentrycompletion.c', @@ -60,6 +62,10 @@ gtk_deprecated_headers = [ 'deprecated/gtkcellrenderertext.h', 'deprecated/gtkcellrenderertoggle.h', 'deprecated/gtkcellview.h', + 'deprecated/gtkcolorbutton.h', + 'deprecated/gtkcolorchooser.h', + 'deprecated/gtkcolorchooserdialog.h', + 'deprecated/gtkcolorchooserwidget.h', 'deprecated/gtkcombobox.h', 'deprecated/gtkcomboboxtext.h', 'deprecated/gtkentrycompletion.h', @@ -79,10 +79,10 @@ #include <gtk/gtkcenterbox.h> #include <gtk/gtkcenterlayout.h> #include <gtk/gtkcheckbutton.h> -#include <gtk/gtkcolorbutton.h> -#include <gtk/gtkcolorchooser.h> -#include <gtk/gtkcolorchooserdialog.h> -#include <gtk/gtkcolorchooserwidget.h> +#include <gtk/deprecated/gtkcolorbutton.h> +#include <gtk/deprecated/gtkcolorchooser.h> +#include <gtk/deprecated/gtkcolorchooserdialog.h> +#include <gtk/deprecated/gtkcolorchooserwidget.h> #include <gtk/gtkcolordialog.h> #include <gtk/gtkcolordialogbutton.h> #include <gtk/gtkcolorutils.h> diff --git a/gtk/gtkcolorchooserdialog.c b/gtk/gtkcolorchooserdialog.c index 81ac261880..4c3dad79ae 100644 --- a/gtk/gtkcolorchooserdialog.c +++ b/gtk/gtkcolorchooserdialog.c @@ -24,9 +24,11 @@ #include "gtkprivate.h" #include "gtksettings.h" -#include "gtkcolorchooserprivate.h" -#include "gtkcolorchooserdialog.h" -#include "gtkcolorchooserwidget.h" +#include "deprecated/gtkcolorchooserprivate.h" +#include "deprecated/gtkcolorchooserdialog.h" +#include "deprecated/gtkcolorchooserwidget.h" + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS /** * GtkColorChooserDialog: @@ -43,6 +45,8 @@ * To change the initially selected color, use * [method@Gtk.ColorChooser.set_rgba]. To get the selected color use * [method@Gtk.ColorChooser.get_rgba]. + * + * `GtkColorChooserDialog` has been deprecated in favor of [class@Gtk.ColorDialog]. */ typedef struct _GtkColorChooserDialogClass GtkColorChooserDialogClass; @@ -281,6 +285,8 @@ gtk_color_chooser_dialog_iface_init (GtkColorChooserInterface *iface) * Creates a new `GtkColorChooserDialog`. * * Returns: a new `GtkColorChooserDialog` + * + * Deprecated: 4.10: Use [class@Gtk.ColorDialog] instead */ GtkWidget * gtk_color_chooser_dialog_new (const char *title, diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index c6b1a445f1..f1a01054a2 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -18,8 +18,8 @@ #include "config.h" -#include "gtkcolorchooserprivate.h" -#include "gtkcolorchooserwidget.h" +#include "deprecated/gtkcolorchooserprivate.h" +#include "deprecated/gtkcolorchooserwidget.h" #include "gtkcoloreditorprivate.h" #include "gtkcolorswatchprivate.h" #include "gtkgrid.h" @@ -34,6 +34,8 @@ #include <math.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkColorChooserWidget: * @@ -61,6 +63,8 @@ * # CSS names * * `GtkColorChooserWidget` has a single CSS node with name colorchooser. + * + * Deprecated: 4.10: Direct use of `GtkColorChooserWidget` is deprecated. */ typedef struct _GtkColorChooserWidgetClass GtkColorChooserWidgetClass; diff --git a/gtk/gtkcolordialog.c b/gtk/gtkcolordialog.c index 180bba9a4f..ec53c8d0d3 100644 --- a/gtk/gtkcolordialog.c +++ b/gtk/gtkcolordialog.c @@ -21,8 +21,8 @@ #include "gtkcolordialog.h" -#include "gtkcolorchooserdialog.h" -#include "gtkcolorchooser.h" +#include "deprecated/gtkcolorchooserdialog.h" +#include "deprecated/gtkcolorchooser.h" #include "gtkbutton.h" #include "gtkdialogerror.h" #include <glib/gi18n-lib.h> @@ -379,8 +379,10 @@ response_cb (GTask *task, GtkColorChooserDialog *window; GdkRGBA color; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS window = GTK_COLOR_CHOOSER_DIALOG (g_task_get_task_data (task)); gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (window), &color); +G_GNUC_END_IGNORE_DEPRECATIONS g_task_return_pointer (task, gdk_rgba_copy (&color), (GDestroyNotify) gdk_rgba_free); } @@ -407,11 +409,13 @@ create_color_chooser (GtkColorDialog *self, else title = _("Pick a Color"); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS window = gtk_color_chooser_dialog_new (title, parent); if (initial_color) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (window), initial_color); gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (window), self->with_alpha); gtk_window_set_modal (GTK_WINDOW (window), self->modal); +G_GNUC_END_IGNORE_DEPRECATIONS return window; } diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c index a2b03db605..39c95db7b1 100644 --- a/gtk/gtkcoloreditor.c +++ b/gtk/gtkcoloreditor.c @@ -19,7 +19,7 @@ #include "gtkcoloreditorprivate.h" -#include "gtkcolorchooserprivate.h" +#include "deprecated/gtkcolorchooserprivate.h" #include "gtkcolorplaneprivate.h" #include "gtkcolorscaleprivate.h" #include "gtkcolorswatchprivate.h" @@ -38,6 +38,8 @@ #include <math.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + typedef struct _GtkColorEditorClass GtkColorEditorClass; struct _GtkColorEditor diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c index c0456193fd..b054c7eb7f 100644 --- a/gtk/gtkcolorscale.c +++ b/gtk/gtkcolorscale.c @@ -19,7 +19,7 @@ #include "gtkcolorscaleprivate.h" -#include "gtkcolorchooserprivate.h" +#include "deprecated/gtkcolorchooserprivate.h" #include "gtkgesturelongpress.h" #include "gtkgestureclick.h" #include "gtkcolorutils.h" diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 9f1b7d056c..6bce4f3d61 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -20,7 +20,7 @@ #include "gtkcolorswatchprivate.h" #include "gtkbox.h" -#include "gtkcolorchooserprivate.h" +#include "deprecated/gtkcolorchooserprivate.h" #include "gtkdragsource.h" #include "gtkdroptarget.h" #include "gtkgesturelongpress.h" diff --git a/gtk/meson.build b/gtk/meson.build index 1d575fe3b6..d5849712d6 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -31,7 +31,6 @@ gtk_private_sources = files([ 'gtkbuilder-menus.c', 'gtkbuilderprecompile.c', 'gtkbuiltinicon.c', - 'gtkcoloreditor.c', 'gtkcolorplane.c', 'gtkcolorpicker.c', 'gtkcolorpickerkwin.c', @@ -183,8 +182,7 @@ gtk_public_sources = files([ 'gtkcenterbox.c', 'gtkcenterlayout.c', 'gtkcheckbutton.c', - 'gtkcolorbutton.c', - 'gtkcolorchooser.c', + 'gtkcoloreditor.c', 'gtkcolorchooserdialog.c', 'gtkcolorchooserwidget.c', 'gtkcolordialog.c', @@ -446,10 +444,6 @@ gtk_public_headers = files([ 'gtkcenterbox.h', 'gtkcenterlayout.h', 'gtkcheckbutton.h', - 'gtkcolorbutton.h', - 'gtkcolorchooser.h', - 'gtkcolorchooserdialog.h', - 'gtkcolorchooserwidget.h', 'gtkcolordialog.h', 'gtkcolordialogbutton.h', 'gtkcolorutils.h', diff --git a/tests/testdialog.c b/tests/testdialog.c index 660912cf00..3993339f38 100644 --- a/tests/testdialog.c +++ b/tests/testdialog.c @@ -1,6 +1,8 @@ #include <gtk/gtk.h> #include <glib/gstdio.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static void show_message_dialog1 (GtkWindow *parent) { diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c index b2a549942d..aa3c95f9b3 100644 --- a/testsuite/gtk/templates.c +++ b/testsuite/gtk/templates.c @@ -22,6 +22,8 @@ # include <gtk/gtkunixprint.h> #endif +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static gboolean main_loop_quit_cb (gpointer data) { |