diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-10-23 08:32:39 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-10-23 08:57:46 -0400 |
commit | 6f46e95c754c71dc7051714925bdd312b6b6a62d (patch) | |
tree | d9a4124dea2b23efb05aa89c3418a9fbaaccdc7d | |
parent | 799fb41937950e32cace797c142ac66e290b192b (diff) | |
download | gtk+-deprecate-gtkdialog.tar.gz |
Deprecate GtkDialogdeprecate-gtkdialog
GtkDialog API is archaic and over-complicated.
What is needed for dialogs can typically achieved
more easily by adding buttons directly to a window.
40 files changed, 145 insertions, 36 deletions
diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c index 3b355fef3e..b5a709ad38 100644 --- a/demos/gtk-demo/dialog.c +++ b/demos/gtk-demo/dialog.c @@ -8,6 +8,8 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static GtkWidget *window = NULL; static GtkWidget *entry1 = NULL; static GtkWidget *entry2 = NULL; diff --git a/demos/gtk-demo/spinner.c b/demos/gtk-demo/spinner.c index 925f02576e..8cd6b76680 100644 --- a/demos/gtk-demo/spinner.c +++ b/demos/gtk-demo/spinner.c @@ -35,6 +35,7 @@ do_spinner (GtkWidget *do_widget) if (!window) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS window = gtk_dialog_new_with_buttons ("Spinner", GTK_WINDOW (do_widget), 0, @@ -48,6 +49,7 @@ do_spinner (GtkWidget *do_widget) g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); content_area = gtk_dialog_get_content_area (GTK_DIALOG (window)); +G_GNUC_END_IGNORE_DEPRECATIONS vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_widget_set_margin_start (vbox, 5); diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c index 25cf11b48d..519ae48d36 100644 --- a/demos/node-editor/node-editor-window.c +++ b/demos/node-editor/node-editor-window.c @@ -578,7 +578,10 @@ show_open_filechooser (NodeEditorWindow *self) "_Load", GTK_RESPONSE_ACCEPT, NULL); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); GFile *cwd = g_file_new_for_path ("."); @@ -654,7 +657,10 @@ save_cb (GtkWidget *button, "_Save", GTK_RESPONSE_ACCEPT, NULL); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); GFile *cwd = g_file_new_for_path ("."); @@ -773,7 +779,10 @@ export_image_cb (GtkWidget *button, "_Save", GTK_RESPONSE_ACCEPT, NULL); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture); gtk_widget_show (dialog); diff --git a/demos/print-editor/print-editor.c b/demos/print-editor/print-editor.c index ca5d143d06..38f9f6fd54 100644 --- a/demos/print-editor/print-editor.c +++ b/demos/print-editor/print-editor.c @@ -525,7 +525,9 @@ activate_save_as (GSimpleAction *action, "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_OK, NULL); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_widget_show (dialog); @@ -572,7 +574,9 @@ activate_open (GSimpleAction *action, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_OK, NULL); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); +G_GNUC_END_IGNORE_DEPRECATIONS gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_widget_show (dialog); diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index e1881cc5b2..43706a6d06 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -1462,7 +1462,10 @@ close_selection_dialog (GtkWidget *dialog, int response, GtkWidget *tv) if (response == GTK_RESPONSE_CANCEL) return; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS box = gtk_widget_get_first_child (gtk_dialog_get_content_area (GTK_DIALOG (dialog))); +G_GNUC_END_IGNORE_DEPRECATIONS + g_assert (GTK_IS_FLOW_BOX (box)); children = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (box)); diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c index c930a453f7..ea7c4541a8 100644 --- a/examples/bp/bloatpad.c +++ b/examples/bp/bloatpad.c @@ -349,6 +349,8 @@ quit_activated (GSimpleAction *action, g_application_quit (app); } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static void combo_changed (GtkDropDown *combo, GParamSpec *pspec, @@ -466,6 +468,8 @@ edit_accels (GSimpleAction *action, gtk_widget_show (dialog); } +G_GNUC_END_IGNORE_DEPRECATIONS + static gboolean update_time (gpointer user_data) { diff --git a/gtk/deprecated/gtkappchooserbutton.c b/gtk/deprecated/gtkappchooserbutton.c index 3f83f2fde7..569f7c69da 100644 --- a/gtk/deprecated/gtkappchooserbutton.c +++ b/gtk/deprecated/gtkappchooserbutton.c @@ -65,7 +65,7 @@ #include "gtkcellrenderertext.h" #include "gtkcombobox.h" #include "gtkwidgetprivate.h" -#include "gtkdialog.h" +#include "deprecated/gtkdialog.h" #include <glib/gi18n-lib.h> #include "gtkmarshalers.h" #include "gtkliststore.h" diff --git a/gtk/deprecated/gtkappchooserdialog.c b/gtk/deprecated/gtkappchooserdialog.c index 4575c18d68..c245ea3d26 100644 --- a/gtk/deprecated/gtkappchooserdialog.c +++ b/gtk/deprecated/gtkappchooserdialog.c @@ -57,7 +57,7 @@ #include "gtkentry.h" #include "gtktogglebutton.h" #include "gtkheaderbar.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include "gtksearchbar.h" #include "gtksizegroup.h" diff --git a/gtk/deprecated/gtkappchooserdialog.h b/gtk/deprecated/gtkappchooserdialog.h index 80e926932a..5844810ba2 100644 --- a/gtk/deprecated/gtkappchooserdialog.h +++ b/gtk/deprecated/gtkappchooserdialog.h @@ -29,7 +29,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> #include <gio/gio.h> G_BEGIN_DECLS diff --git a/gtk/gtkdialog.c b/gtk/deprecated/gtkdialog.c index d824222b0d..109bcb4206 100644 --- a/gtk/gtkdialog.c +++ b/gtk/deprecated/gtkdialog.c @@ -28,8 +28,8 @@ #include <string.h> #include "gtkbutton.h" -#include "gtkdialog.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialog.h" +#include "deprecated/gtkdialogprivate.h" #include "gtkheaderbar.h" #include "gtkheaderbarprivate.h" #include "gtklabel.h" @@ -43,6 +43,8 @@ #include "gtktypebuiltins.h" #include "gtksizegroup.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkDialog: * @@ -688,6 +690,8 @@ gtk_dialog_close (GtkDialog *dialog) * as described above. * * Returns: the new dialog as a `GtkWidget` + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ GtkWidget* gtk_dialog_new (void) @@ -764,6 +768,8 @@ gtk_dialog_new_empty (const char *title, * ``` * * Returns: a new `GtkDialog` + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ GtkWidget* gtk_dialog_new_with_buttons (const char *title, @@ -855,6 +861,8 @@ get_response_data (GtkDialog *dialog, * * If you want to add a non-activatable widget, simply pack it into * the @action_area field of the `GtkDialog` struct. + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ void gtk_dialog_add_action_widget (GtkDialog *dialog, @@ -896,6 +904,8 @@ gtk_dialog_add_action_widget (GtkDialog *dialog, * The button widget is returned, but usually you don’t need it. * * Returns: (transfer none): the `GtkButton` widget that was added + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ GtkWidget* gtk_dialog_add_button (GtkDialog *dialog, @@ -954,6 +964,8 @@ gtk_dialog_add_buttons_valist (GtkDialog *dialog, * repeatedly. The variable argument list should be %NULL-terminated * as with [ctor@Gtk.Dialog.new_with_buttons]. Each button must have both * text and response ID. + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ void gtk_dialog_add_buttons (GtkDialog *dialog, @@ -981,6 +993,8 @@ gtk_dialog_add_buttons (GtkDialog *dialog, * * Calls `gtk_widget_set_sensitive (widget, @setting)` * for each widget in the dialog’s action area with the given @response_id. + * + * Deprecated: 4.10: Set the sensitivity of your buttons directly */ void gtk_dialog_set_response_sensitive (GtkDialog *dialog, @@ -1007,6 +1021,8 @@ gtk_dialog_set_response_sensitive (GtkDialog *dialog, * Sets the default widget for the dialog based on the response ID. * * Pressing “Enter” normally activates the default widget. + * + * Deprecated: 4.10: Use gtk_window_set_default_widget() */ void gtk_dialog_set_default_response (GtkDialog *dialog, @@ -1035,6 +1051,8 @@ gtk_dialog_set_default_response (GtkDialog *dialog, * Emits the ::response signal with the given response ID. * * Used to indicate that the user has responded to the dialog in some way. + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ void gtk_dialog_response (GtkDialog *dialog, @@ -1058,6 +1076,8 @@ gtk_dialog_response (GtkDialog *dialog, * * Returns: (nullable) (transfer none): the @widget button that uses the given * @response_id + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog, @@ -1087,6 +1107,8 @@ gtk_dialog_get_widget_for_response (GtkDialog *dialog, * * Returns: the response id of @widget, or %GTK_RESPONSE_NONE * if @widget doesn’t have a response id set. + * + * Deprecated: 4.10: Use a GtkWindow and add buttons yourself */ int gtk_dialog_get_response_for_widget (GtkDialog *dialog, @@ -1396,6 +1418,8 @@ gtk_dialog_get_action_area (GtkDialog *dialog) * [property@Gtk.Dialog:use-header-bar] property is %TRUE. * * Returns: (type Gtk.HeaderBar) (transfer none): the header bar + * + * Deprecated: 4.10: Use a GtkWindow and add a GtkHeaderBar yourself */ GtkWidget * gtk_dialog_get_header_bar (GtkDialog *dialog) @@ -1414,6 +1438,8 @@ gtk_dialog_get_header_bar (GtkDialog *dialog) * Returns the content area of @dialog. * * Returns: (type Gtk.Box) (transfer none): the content area `GtkBox`. + * + * Deprecated: 4.10: Use a GtkWindow and populate it yourself */ GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog) diff --git a/gtk/gtkdialog.h b/gtk/deprecated/gtkdialog.h index 4530d518e8..89f2e509cd 100644 --- a/gtk/gtkdialog.h +++ b/gtk/deprecated/gtkdialog.h @@ -127,51 +127,51 @@ struct _GtkDialogClass GDK_AVAILABLE_IN_ALL GType gtk_dialog_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget* gtk_dialog_new (void); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget* gtk_dialog_new_with_buttons (const char *title, GtkWindow *parent, GtkDialogFlags flags, const char *first_button_text, ...) G_GNUC_NULL_TERMINATED; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_dialog_add_action_widget (GtkDialog *dialog, GtkWidget *child, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget* gtk_dialog_add_button (GtkDialog *dialog, const char *button_text, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_dialog_add_buttons (GtkDialog *dialog, const char *first_button_text, ...) G_GNUC_NULL_TERMINATED; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_dialog_set_response_sensitive (GtkDialog *dialog, int response_id, gboolean setting); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_dialog_set_default_response (GtkDialog *dialog, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 int gtk_dialog_get_response_for_widget (GtkDialog *dialog, GtkWidget *widget); /* Emit response signal */ -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_dialog_response (GtkDialog *dialog, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget * gtk_dialog_get_header_bar (GtkDialog *dialog); G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref) diff --git a/gtk/gtkdialogprivate.h b/gtk/deprecated/gtkdialogprivate.h index 1c32daa80c..1c32daa80c 100644 --- a/gtk/gtkdialogprivate.h +++ b/gtk/deprecated/gtkdialogprivate.h diff --git a/gtk/deprecated/meson.build b/gtk/deprecated/meson.build index cd5b182170..c8b315aae9 100644 --- a/gtk/deprecated/meson.build +++ b/gtk/deprecated/meson.build @@ -21,6 +21,7 @@ gtk_deprecated_sources = [ 'deprecated/gtkcellview.c', 'deprecated/gtkcombobox.c', 'deprecated/gtkcomboboxtext.c', + 'deprecated/gtkdialog.c', 'deprecated/gtkentrycompletion.c', 'deprecated/gtkiconview.c', 'deprecated/gtkliststore.c', @@ -62,6 +63,7 @@ gtk_deprecated_headers = [ 'deprecated/gtkcellview.h', 'deprecated/gtkcombobox.h', 'deprecated/gtkcomboboxtext.h', + 'deprecated/gtkdialog.h', 'deprecated/gtkentrycompletion.h', 'deprecated/gtkiconview.h', 'deprecated/gtkliststore.h', @@ -94,7 +94,7 @@ #include <gtk/gtkcustomlayout.h> #include <gtk/gtkcustomsorter.h> #include <gtk/gtkdebug.h> -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> #include <gtk/gtkdirectorylist.h> #include <gtk/gtkdragicon.h> #include <gtk/gtkdragsource.h> diff --git a/gtk/gtkcolorchooserdialog.c b/gtk/gtkcolorchooserdialog.c index 81ac261880..fa185a4c3e 100644 --- a/gtk/gtkcolorchooserdialog.c +++ b/gtk/gtkcolorchooserdialog.c @@ -17,8 +17,8 @@ #include "config.h" -#include "gtkdialog.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialog.h" +#include "deprecated/gtkdialogprivate.h" #include "gtkbutton.h" #include "gtkbox.h" #include "gtkprivate.h" @@ -28,6 +28,8 @@ #include "gtkcolorchooserdialog.h" #include "gtkcolorchooserwidget.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkColorChooserDialog: * diff --git a/gtk/gtkcolorchooserdialog.h b/gtk/gtkcolorchooserdialog.h index c5212d912d..a96ef96184 100644 --- a/gtk/gtkcolorchooserdialog.h +++ b/gtk/gtkcolorchooserdialog.h @@ -22,7 +22,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> G_BEGIN_DECLS diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c index 08238d3642..5c77a13413 100644 --- a/gtk/gtkcustompaperunixdialog.c +++ b/gtk/gtkcustompaperunixdialog.c @@ -37,11 +37,12 @@ #include "gtkcustompaperunixdialog.h" #include "gtkprintbackendprivate.h" #include "gtkprintutils.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #define LEGACY_CUSTOM_PAPER_FILENAME ".gtk-custom-papers" #define CUSTOM_PAPER_FILENAME "custom-papers" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS typedef struct { diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index 853d304952..6652f74bfd 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -31,13 +31,14 @@ #include "gtksettings.h" #include "gtktogglebutton.h" #include "gtkheaderbar.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include "gtklabel.h" #include "gtkfilechooserentry.h" #include "gtkbox.h" #include <stdarg.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS /** * GtkFileChooserDialog: diff --git a/gtk/gtkfilechooserdialog.h b/gtk/gtkfilechooserdialog.h index 6271857cb9..467913ea09 100644 --- a/gtk/gtkfilechooserdialog.h +++ b/gtk/gtkfilechooserdialog.h @@ -23,7 +23,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> #include <gtk/gtkfilechooser.h> G_BEGIN_DECLS diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c index 43418cdce9..0c2e22f733 100644 --- a/gtk/gtkfilechoosernative.c +++ b/gtk/gtkfilechoosernative.c @@ -506,10 +506,15 @@ gtk_file_chooser_native_init (GtkFileChooserNative *self) * This way we can reuse that store, plus we always have a dialog we can use * in case something makes the native one not work (like the custom widgets) */ self->dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG, NULL); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + self->cancel_button = gtk_dialog_add_button (GTK_DIALOG (self->dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); self->accept_button = gtk_dialog_add_button (GTK_DIALOG (self->dialog), _("_Open"), GTK_RESPONSE_ACCEPT); - gtk_dialog_set_default_response (GTK_DIALOG (self->dialog), GTK_RESPONSE_ACCEPT); + +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_hide_on_close (GTK_WINDOW (self->dialog), TRUE); /* This is used, instead of the standard delegate, to ensure that signals are not delegated. */ diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 08220387d5..7cc85eacf1 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -1166,9 +1166,12 @@ confirm_delete (GtkFileChooserWidget *impl, name); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("If you delete an item, it will be permanently lost.")); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Delete"), GTK_RESPONSE_ACCEPT); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS if (gtk_window_has_group (toplevel)) gtk_window_group_add_window (gtk_window_get_group (toplevel), GTK_WINDOW (dialog)); @@ -2113,7 +2116,9 @@ get_accept_action_widget (GtkDialog *dialog, for (i = 0; i < G_N_ELEMENTS (response); i++) { +G_GNUC_BEGIN_IGNORE_DEPRECATIONS widget = gtk_dialog_get_widget_for_response (dialog, response[i]); +G_GNUC_END_IGNORE_DEPRECATIONS if (widget) { if (!sensitive_only) @@ -4937,7 +4942,9 @@ add_custom_button_to_dialog (GtkDialog *dialog, button = gtk_button_new_with_mnemonic (mnemonic_label); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id); +G_GNUC_END_IGNORE_DEPRECATIONS } /* Every time we request a response explicitly, we need to save the selection to @@ -4991,9 +4998,11 @@ confirm_dialog_should_accept_filename (GtkFileChooserWidget *impl, "overwrite its contents."), folder_display_name); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL); add_custom_button_to_dialog (GTK_DIALOG (dialog), _("_Replace"), GTK_RESPONSE_ACCEPT); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS if (gtk_window_has_group (toplevel)) gtk_window_group_add_window (gtk_window_get_group (toplevel), GTK_WINDOW (dialog)); diff --git a/gtk/gtkfontchooserdialog.c b/gtk/gtkfontchooserdialog.c index 147cff8bca..5225d2c5b5 100644 --- a/gtk/gtkfontchooserdialog.c +++ b/gtk/gtkfontchooserdialog.c @@ -32,12 +32,14 @@ #include "gtkprivate.h" #include "gtkwidget.h" #include "gtksettings.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include "gtktogglebutton.h" #include "gtkheaderbar.h" #include "gtkactionable.h" #include "gtkeventcontrollerkey.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + typedef struct _GtkFontChooserDialogClass GtkFontChooserDialogClass; struct _GtkFontChooserDialog diff --git a/gtk/gtkfontchooserdialog.h b/gtk/gtkfontchooserdialog.h index b14ee81c2d..ab66df5109 100644 --- a/gtk/gtkfontchooserdialog.h +++ b/gtk/gtkfontchooserdialog.h @@ -22,7 +22,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> G_BEGIN_DECLS diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index c645739644..b60cf92c89 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -48,7 +48,7 @@ #include "gtktextview.h" #include "gtkwidgetprivate.h" #include "gtksettings.h" -#include "gtkdialog.h" +#include "deprecated/gtkdialog.h" #include "gtkgestureclick.h" #include "gtkeventcontrollerscroll.h" #include "gtkroot.h" @@ -297,10 +297,14 @@ stop_search_cb (GtkSearchEntry *entry, GtkWidget *dialog; GtkWidget *button = NULL; +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + dialog = gtk_widget_get_ancestor (GTK_WIDGET (fc), GTK_TYPE_DIALOG); if (dialog) button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); +G_GNUC_END_IGNORE_DEPRECATIONS + if (button) gtk_widget_activate (button); } diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c index 788077305e..82b27a9931 100644 --- a/gtk/gtkinfobar.c +++ b/gtk/gtkinfobar.c @@ -38,7 +38,7 @@ #include "gtklabel.h" #include "gtkbutton.h" #include "gtkenums.h" -#include "gtkdialog.h" +#include "deprecated/gtkdialog.h" #include "gtkrevealer.h" #include "gtkprivate.h" #include "gtktypebuiltins.h" diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 88b6485bb8..5ef1fb2ffb 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -29,7 +29,7 @@ #include "gtkbox.h" #include "gtkbuildable.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include <glib/gi18n-lib.h> #include "gtklabel.h" #include "gtkprivate.h" @@ -37,6 +37,8 @@ #include <string.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkMessageDialog: * diff --git a/gtk/gtkmessagedialog.h b/gtk/gtkmessagedialog.h index a1de879493..2ff7b202df 100644 --- a/gtk/gtkmessagedialog.h +++ b/gtk/gtkmessagedialog.h @@ -29,7 +29,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gtk/gtkdialog.h> +#include <gtk/deprecated/gtkdialog.h> #include <gtk/gtkenums.h> G_BEGIN_DECLS diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index aeca6e7253..4330da2e98 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -45,7 +45,7 @@ #include "gtkicontheme.h" #include "gtkmain.h" #include "gtksettings.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include "gtkpopover.h" #include "gtksnapshot.h" #include "gdktextureprivate.h" @@ -56,6 +56,7 @@ #include "gtksingleselection.h" #include "gtkpicture.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS /** * GtkMountOperation: diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c index 399d38f29d..3a71b0a921 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/gtkpagesetupunixdialog.c @@ -35,7 +35,9 @@ #include "gtkprintbackendprivate.h" #include "gtkpapersize.h" #include "gtkprintutils.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS /** * GtkPageSetupUnixDialog: diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index c24ad6603f..d8ae798b60 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -574,6 +574,8 @@ store_entry (GtkEntry *entry, *data = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry))); } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static void password_dialog_response (GtkWidget *dialog, int response_id, @@ -732,6 +734,8 @@ request_password (GtkPrintBackend *backend, gtk_widget_show (dialog); } +G_GNUC_END_IGNORE_DEPRECATIONS + void gtk_print_backend_destroy (GtkPrintBackend *backend) { diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index a2823abfdf..b284ae8572 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -52,11 +52,13 @@ #include <glib/gi18n-lib.h> #include "gtkprivate.h" #include "gtktypebuiltins.h" -#include "gtkdialogprivate.h" +#include "deprecated/gtkdialogprivate.h" #include "gtkwidgetprivate.h" #include "gtkcsscolorvalueprivate.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkPrintUnixDialog: * diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 6b4e2d77a7..a7a279ecc7 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -6146,8 +6146,14 @@ gtk_window_set_debugging (GdkDisplay *display, gtk_widget_show (check); gtk_box_append (GTK_BOX (area), check); g_object_set_data (G_OBJECT (dialog), "check", check); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_NO); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_OK"), GTK_RESPONSE_YES); + +G_GNUC_END_IGNORE_DEPRECATIONS + g_signal_connect (dialog, "response", G_CALLBACK (warn_response), inspector_window); g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", dialog); diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c index b1dc9bf701..759beb9ceb 100644 --- a/gtk/inspector/css-editor.c +++ b/gtk/inspector/css-editor.c @@ -248,7 +248,11 @@ save_clicked (GtkButton *button, _("_Save"), GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "custom.css"); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (save_response), ce); gtk_widget_show (dialog); diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index d097f602b6..27841ff11d 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -1867,7 +1867,11 @@ render_node_save (GtkButton *button, g_free (nodename); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename); g_free (filename); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); +G_GNUC_END_IGNORE_DEPRECATIONS + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (render_node_save_response), node); gtk_widget_show (dialog); diff --git a/gtk/meson.build b/gtk/meson.build index d7357d8576..9a2f3ab8c3 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -198,7 +198,6 @@ gtk_public_sources = files([ 'gtkcustomfilter.c', 'gtkcustomlayout.c', 'gtkcustomsorter.c', - 'gtkdialog.c', 'gtkdirectorylist.c', 'gtkdragicon.c', 'gtkdragsource.c', @@ -454,7 +453,6 @@ gtk_public_headers = files([ 'gtkcustomlayout.h', 'gtkcustomsorter.h', 'gtkdebug.h', - 'gtkdialog.h', 'gtkdirectorylist.h', 'gtkdragicon.h', 'gtkdragsource.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/tests/testlockbutton.c b/tests/testlockbutton.c index ff7599b65f..88665bc3b8 100644 --- a/tests/testlockbutton.c +++ b/tests/testlockbutton.c @@ -19,6 +19,8 @@ #include <gtk/gtk.h> #include <gio/gio.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /* a fake permission implementation */ #define G_TYPE_TEST_PERMISSION (g_test_permission_get_type ()) diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c index f61669b204..f280ba2158 100644 --- a/tests/testwindowsize.c +++ b/tests/testwindowsize.c @@ -1,6 +1,8 @@ /* gcc -g -Wall -O2 -o dialog-test dialog-test.c `pkg-config --cflags --libs gtk4` */ #include <gtk/gtk.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static GtkWidget *window; static GtkWidget *width_chars_spin; static GtkWidget *max_width_chars_spin; diff --git a/testsuite/a11y/dialog.c b/testsuite/a11y/dialog.c index b24933c9ce..cd1a7bc65d 100644 --- a/testsuite/a11y/dialog.c +++ b/testsuite/a11y/dialog.c @@ -1,5 +1,7 @@ #include <gtk/gtk.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static void dialog_role (void) { diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c index b2a549942d..76a2e5b407 100644 --- a/testsuite/gtk/templates.c +++ b/testsuite/gtk/templates.c @@ -45,6 +45,7 @@ show_and_wait (GtkWidget *widget) g_main_context_iteration (NULL, FALSE); } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS static void test_dialog_basic (void) { @@ -69,6 +70,7 @@ test_dialog_override_property (void) gtk_window_destroy (GTK_WINDOW (dialog)); } +G_GNUC_END_IGNORE_DEPRECATIONS static void test_message_dialog_basic (void) |