diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c index d484e856cb..9491588f8d 100644 --- a/demos/gtk-demo/infobar.c +++ b/demos/gtk-demo/infobar.c @@ -7,6 +7,8 @@ #include #include +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static void on_bar_response (GtkInfoBar *info_bar, int response_id, diff --git a/docs/reference/gtk/migrating-4to5.md b/docs/reference/gtk/migrating-4to5.md index 6c2110aa33..a6bf2262d8 100644 --- a/docs/reference/gtk/migrating-4to5.md +++ b/docs/reference/gtk/migrating-4to5.md @@ -97,3 +97,11 @@ is much reduced, and it has awkward, archaice APIs. Therefore, it is dropped. The recommended replacement is to just create your own window and add buttons as required, either in the header or elsewhere. + +## GtkInfoBar is going away + +GtkInfoBar had a dialog API, and with dialogs going away, it was time to +retire it. If you need such a widget, it is relatively trivial to create one +using a [class@Gtk.Revealer] with labels and buttons. + +Other libraries, such as libadwaita, may provide replacements as well. diff --git a/gtk/gtkinfobar.c b/gtk/deprecated/gtkinfobar.c similarity index 98% rename from gtk/gtkinfobar.c rename to gtk/deprecated/gtkinfobar.c index 82b27a9931..cc2c0c1d73 100644 --- a/gtk/gtkinfobar.c +++ b/gtk/deprecated/gtkinfobar.c @@ -46,6 +46,8 @@ #include "gtkbinlayout.h" #include "gtkgestureclick.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + /** * GtkInfoBar: * @@ -122,6 +124,11 @@ * on the message type. * If the info bar shows a close button, that button will have the .close * style class applied. + * + * Deprecated: 4.10: There is no replacement in GTK for an "info bar" widget; + * you can use [class@Gtk.Revealer] with a [class@GtkBox] containing a + * [class@Gtk.Label] and an optional [class@Gtk.Button], according to + * your application's design. */ enum @@ -532,6 +539,8 @@ action_widget_activated (GtkWidget *widget, * [signal@Gtk.InfoBar::response] signal on the message area * when the widget is activated. The widget is appended to the * end of the message areas action area. + * + * Deprecated: 4.10 */ void gtk_info_bar_add_action_widget (GtkInfoBar *info_bar, @@ -577,6 +586,8 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar, * * The widget must have been put there by a call to * [method@Gtk.InfoBar.add_action_widget] or [method@Gtk.InfoBar.add_button]. + * + * Deprecated: 4.10 */ void gtk_info_bar_remove_action_widget (GtkInfoBar *info_bar, @@ -606,6 +617,8 @@ gtk_info_bar_remove_action_widget (GtkInfoBar *info_bar, * * Returns: (transfer none) (type Gtk.Button): the `GtkButton` widget * that was added + * + * Deprecated: 4.10 */ GtkWidget* gtk_info_bar_add_button (GtkInfoBar *info_bar, @@ -668,6 +681,8 @@ add_buttons_valist (GtkInfoBar *info_bar, * repeatedly. The variable argument list should be %NULL-terminated * as with [ctor@Gtk.InfoBar.new_with_buttons]. Each button must have both * text and response ID. + * + * Deprecated: 4.10 */ void gtk_info_bar_add_buttons (GtkInfoBar *info_bar, @@ -687,6 +702,8 @@ gtk_info_bar_add_buttons (GtkInfoBar *info_bar, * Creates a new `GtkInfoBar` object. * * Returns: a new `GtkInfoBar` object + * + * Deprecated: 4.10 */ GtkWidget * gtk_info_bar_new (void) @@ -710,6 +727,8 @@ gtk_info_bar_new (void) * response ID. * * Returns: a new `GtkInfoBar` + * + * Deprecated: 4.10 */ GtkWidget* gtk_info_bar_new_with_buttons (const char *first_button_text, @@ -752,6 +771,8 @@ update_default_response (GtkInfoBar *info_bar, * Calls `gtk_widget_set_sensitive (widget, setting)` for each * widget in the info bars’s action area with the given @response_id. * A convenient way to sensitize/desensitize buttons. + * + * Deprecated: 4.10 */ void gtk_info_bar_set_response_sensitive (GtkInfoBar *info_bar, @@ -788,6 +809,8 @@ gtk_info_bar_set_response_sensitive (GtkInfoBar *info_bar, * * Note that this function currently requires @info_bar to * be added to a widget hierarchy. + * + * Deprecated: 4.10 */ void gtk_info_bar_set_default_response (GtkInfoBar *info_bar, @@ -824,6 +847,8 @@ gtk_info_bar_set_default_response (GtkInfoBar *info_bar, * @response_id: a response ID * * Emits the “response” signal with the given @response_id. + * + * Deprecated: 4.10 */ void gtk_info_bar_response (GtkInfoBar *info_bar, @@ -1070,6 +1095,8 @@ gtk_info_bar_buildable_add_child (GtkBuildable *buildable, * Sets the message type of the message area. * * GTK uses this type to determine how the message is displayed. + * + * Deprecated: 4.10 */ void gtk_info_bar_set_message_type (GtkInfoBar *info_bar, @@ -1108,6 +1135,8 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar, * Returns the message type of the message area. * * Returns: the message type of the message area. + * + * Deprecated: 4.10 */ GtkMessageType gtk_info_bar_get_message_type (GtkInfoBar *info_bar) @@ -1126,6 +1155,8 @@ gtk_info_bar_get_message_type (GtkInfoBar *info_bar) * If true, a standard close button is shown. * * When clicked it emits the response %GTK_RESPONSE_CLOSE. + * + * Deprecated: 4.10 */ void gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar, @@ -1147,6 +1178,8 @@ gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar, * Returns whether the widget will display a standard close button. * * Returns: %TRUE if the widget displays standard close button + * + * Deprecated: 4.10 */ gboolean gtk_info_bar_get_show_close_button (GtkInfoBar *info_bar) @@ -1169,6 +1202,8 @@ gtk_info_bar_get_show_close_button (GtkInfoBar *info_bar) * Note: this does not show or hide @info_bar in the * [property@Gtk.Widget:visible] sense, so revealing has no effect * if [property@Gtk.Widget:visible] is %FALSE. + * + * Deprecated: 4.10 */ void gtk_info_bar_set_revealed (GtkInfoBar *info_bar, @@ -1190,6 +1225,8 @@ gtk_info_bar_set_revealed (GtkInfoBar *info_bar, * Returns whether the info bar is currently revealed. * * Returns: the current value of the [property@Gtk.InfoBar:revealed] property + * + * Deprecated: 4.10 */ gboolean gtk_info_bar_get_revealed (GtkInfoBar *info_bar) @@ -1205,6 +1242,8 @@ gtk_info_bar_get_revealed (GtkInfoBar *info_bar) * @widget: the child to be added * * Adds a widget to the content area of the info bar. + * + * Deprecated: 4.10 */ void gtk_info_bar_add_child (GtkInfoBar *info_bar, @@ -1222,6 +1261,8 @@ gtk_info_bar_add_child (GtkInfoBar *info_bar, * @widget: a child that has been added to the content area * * Removes a widget from the content area of the info bar. + * + * Deprecated: 4.10 */ void gtk_info_bar_remove_child (GtkInfoBar *info_bar, diff --git a/gtk/gtkinfobar.h b/gtk/deprecated/gtkinfobar.h similarity index 91% rename from gtk/gtkinfobar.h rename to gtk/deprecated/gtkinfobar.h index 11c8529b41..d88d5955fc 100644 --- a/gtk/gtkinfobar.h +++ b/gtk/deprecated/gtkinfobar.h @@ -46,63 +46,63 @@ typedef struct _GtkInfoBar GtkInfoBar; GDK_AVAILABLE_IN_ALL GType gtk_info_bar_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget *gtk_info_bar_new (void); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget *gtk_info_bar_new_with_buttons (const char *first_button_text, ...); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_add_action_widget (GtkInfoBar *info_bar, GtkWidget *child, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_remove_action_widget (GtkInfoBar *info_bar, GtkWidget *widget); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkWidget *gtk_info_bar_add_button (GtkInfoBar *info_bar, const char *button_text, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_add_buttons (GtkInfoBar *info_bar, const char *first_button_text, ...); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_add_child (GtkInfoBar *info_bar, GtkWidget *widget); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_remove_child (GtkInfoBar *info_bar, GtkWidget *widget); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_set_response_sensitive (GtkInfoBar *info_bar, int response_id, gboolean setting); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_set_default_response (GtkInfoBar *info_bar, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_response (GtkInfoBar *info_bar, int response_id); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_set_message_type (GtkInfoBar *info_bar, GtkMessageType message_type); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 GtkMessageType gtk_info_bar_get_message_type (GtkInfoBar *info_bar); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_set_show_close_button (GtkInfoBar *info_bar, gboolean setting); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 gboolean gtk_info_bar_get_show_close_button (GtkInfoBar *info_bar); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 void gtk_info_bar_set_revealed (GtkInfoBar *info_bar, gboolean revealed); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_10 gboolean gtk_info_bar_get_revealed (GtkInfoBar *info_bar); G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkInfoBar, g_object_unref) diff --git a/gtk/deprecated/meson.build b/gtk/deprecated/meson.build index 4749be6085..600934b02d 100644 --- a/gtk/deprecated/meson.build +++ b/gtk/deprecated/meson.build @@ -29,6 +29,7 @@ gtk_deprecated_sources = [ 'deprecated/gtkfontbutton.c', 'deprecated/gtkfontchooser.c', 'deprecated/gtkiconview.c', + 'deprecated/gtkinfobar.c', 'deprecated/gtkliststore.c', 'deprecated/gtkrender.c', 'deprecated/gtkstylecontext.c', @@ -83,6 +84,7 @@ gtk_deprecated_headers = [ 'deprecated/gtkfontchooserdialog.h', 'deprecated/gtkfontchooserwidget.h', 'deprecated/gtkiconview.h', + 'deprecated/gtkinfobar.h', 'deprecated/gtkliststore.h', 'deprecated/gtkmessagedialog.h', 'deprecated/gtkrender.h', diff --git a/gtk/gtk.h b/gtk/gtk.h index 10c03f3086..16263a59d9 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -163,7 +163,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/gtk/meson.build b/gtk/meson.build index 648d56cea9..971d59fd8c 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -261,7 +261,6 @@ gtk_public_sources = files([ 'gtkimcontextsimple.c', 'gtkimmodule.c', 'gtkimmulticontext.c', - 'gtkinfobar.c', 'gtkinscription.c', 'gtklabel.c', 'gtklayoutchild.c', @@ -509,7 +508,6 @@ gtk_public_headers = files([ 'gtkimcontextsimple.h', 'gtkimmodule.h', 'gtkimmulticontext.h', - 'gtkinfobar.h', 'gtkinscription.h', 'gtklabel.h', 'gtklayoutchild.h', diff --git a/po/POTFILES.in b/po/POTFILES.in index 86b86af74a..dce5c8db58 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -211,7 +211,7 @@ gtk/gtkimcontext.c gtk/gtkimcontextsimple.c gtk/gtkimmodule.c gtk/gtkimmulticontext.c -gtk/gtkinfobar.c +gtk/deprecated/gtkinfobar.c gtk/gtklabel.c gtk/gtklevelbar.c gtk/gtklinkbutton.c