Deprecate GtkMessageDialog

It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
This commit is contained in:
Matthias Clasen 2022-10-29 10:36:29 -04:00
parent 15572b0183
commit 66b062a976
15 changed files with 53 additions and 23 deletions

View File

@ -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;

View File

@ -10,6 +10,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static void

View File

@ -78,7 +78,7 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gtk_message_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
@ -86,7 +86,7 @@ GtkWidget* gtk_message_dialog_new (GtkWindow *parent,
const char *message_format,
...) G_GNUC_PRINTF (5, 6);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
@ -94,21 +94,21 @@ GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent,
const char *message_format,
...) G_GNUC_PRINTF (5, 6);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
const char *str);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
const char *message_format,
...) G_GNUC_PRINTF (2, 3);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
const char *message_format,
...) G_GNUC_PRINTF (2, 3);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget *gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMessageDialog, g_object_unref)

View File

@ -77,6 +77,7 @@ gtk_deprecated_headers = [
'deprecated/gtkfontchooserwidget.h',
'deprecated/gtkiconview.h',
'deprecated/gtkliststore.h',
'deprecated/gtkmessagedialog.h',
'deprecated/gtkrender.h',
'deprecated/gtkstylecontext.h',
'deprecated/gtktreednd.h',

View File

@ -183,7 +183,7 @@
#include <gtk/gtkmediafile.h>
#include <gtk/gtkmediastream.h>
#include <gtk/gtkmenubutton.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/deprecated/gtkmessagedialog.h>
#include <gtk/gtkmountoperation.h>
#include <gtk/gtkmultifilter.h>
#include <gtk/gtkmultiselection.h>

View File

@ -22,7 +22,7 @@
#include "gtkalertdialog.h"
#include "gtkbutton.h"
#include "gtkmessagedialog.h"
#include "deprecated/gtkmessagedialog.h"
#include <glib/gi18n-lib.h>
/**

View File

@ -25,7 +25,7 @@
#include "config.h"
#include "gtkmessagedialog.h"
#include "deprecated/gtkmessagedialog.h"
#include "gtkbox.h"
#include "gtkbuildable.h"
@ -37,6 +37,8 @@
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkMessageDialog:
*
@ -96,6 +98,8 @@
*
* The `GtkMessageDialog` implementation of the `GtkBuildable` interface exposes
* the message area as an internal child with the name message_area.
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
typedef struct
@ -479,6 +483,8 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
* for more details.
*
* Returns: (transfer none): a new `GtkMessageDialog`
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
GtkWidget*
gtk_message_dialog_new (GtkWindow *parent,
@ -565,6 +571,8 @@ gtk_message_dialog_new (GtkWindow *parent,
* ```
*
* Returns: a new `GtkMessageDialog`
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
**/
GtkWidget*
gtk_message_dialog_new_with_markup (GtkWindow *parent,
@ -602,6 +610,8 @@ gtk_message_dialog_new_with_markup (GtkWindow *parent,
* @str: string with Pango markup
*
* Sets the text of the message dialog.
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
void
gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
@ -622,6 +632,8 @@ gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
* @...: arguments for @message_format
*
* Sets the secondary text of the message dialog.
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
void
gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
@ -679,6 +691,8 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
* "%s", msg);
* g_free (msg);
* ```
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
void
gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
@ -726,6 +740,8 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
*
* Returns: (transfer none): A `GtkBox` corresponding to the
* message area in the @message_dialog
*
* Deprecated: 4.10: Use [class@Gtk.AlertDialog] instead
*/
GtkWidget *
gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog)

View File

@ -31,7 +31,6 @@
#include <glib/gstdio.h>
#include "gtkprintoperation-private.h"
#include "gtkprintoperation-portal.h"
#include "gtkmessagedialog.h"
#include <cairo-pdf.h>
#include <cairo-ps.h>

View File

@ -29,7 +29,7 @@
#include "gtkmarshalers.h"
#include <glib/gi18n-lib.h>
#include "gtkprivate.h"
#include "gtkmessagedialog.h"
#include "deprecated/gtkmessagedialog.h"
#include "gtkwindowgroup.h"
#include "gtktypebuiltins.h"
@ -2848,15 +2848,17 @@ print_pages (GtkPrintOperation *op,
{
GtkWidget *progress;
progress = gtk_message_dialog_new (parent, 0,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_CANCEL,
_("Preparing"));
g_signal_connect (progress, "response",
G_CALLBACK (handle_progress_response), op);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
progress = gtk_message_dialog_new (parent, 0,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_CANCEL,
_("Preparing"));
G_GNUC_END_IGNORE_DEPRECATIONS
g_signal_connect (progress, "response",
G_CALLBACK (handle_progress_response), op);
priv->show_progress_timeout_id =
g_timeout_add (SHOW_PROGRESS_TIME,
priv->show_progress_timeout_id =
g_timeout_add (SHOW_PROGRESS_TIME,
(GSourceFunc) show_progress_timeout,
data);
gdk_source_set_static_name_by_id (priv->show_progress_timeout_id, "[gtk] show_progress_timeout");
@ -2878,6 +2880,7 @@ print_pages (GtkPrintOperation *op,
{
GtkWidget *error_dialog;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
error_dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@ -2886,6 +2889,7 @@ print_pages (GtkPrintOperation *op,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
_("The most probable reason is that a temporary file could not be created."));
G_GNUC_END_IGNORE_DEPRECATIONS
if (parent && gtk_window_has_group (parent))
gtk_window_group_add_window (gtk_window_get_group (parent),

View File

@ -44,7 +44,7 @@
#include "gtkframe.h"
#include "gtklabel.h"
#include "gtkbuildable.h"
#include "gtkmessagedialog.h"
#include "deprecated/gtkmessagedialog.h"
#include "gtkbutton.h"
#include "gtksnapshot.h"
#include "gtkrenderbackgroundprivate.h"
@ -637,6 +637,7 @@ error_dialogs (GtkPrintUnixDialog *dialog,
dirname = g_file_get_parse_name (parent);
g_object_unref (parent);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
message_dialog = gtk_message_dialog_new (toplevel,
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
@ -658,6 +659,7 @@ error_dialogs (GtkPrintUnixDialog *dialog,
GTK_RESPONSE_ACCEPT);
gtk_dialog_set_default_response (GTK_DIALOG (message_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),

View File

@ -47,7 +47,7 @@
#include <glib/gi18n-lib.h>
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmessagedialog.h"
#include "deprecated/gtkmessagedialog.h"
#include "gtkpointerfocusprivate.h"
#include "gtkprivate.h"
#include "gtkroot.h"
@ -6130,6 +6130,7 @@ gtk_window_set_debugging (GdkDisplay *display,
if (warn)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
dialog = gtk_message_dialog_new (GTK_WINDOW (inspector_window),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
@ -6141,6 +6142,7 @@ gtk_window_set_debugging (GdkDisplay *display,
"application to break or crash."));
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
G_GNUC_END_IGNORE_DEPRECATIONS
check = gtk_check_button_new_with_label (_("Dont show this message again"));
gtk_widget_set_margin_start (check, 10);
gtk_widget_show (check);

View File

@ -27,7 +27,6 @@
#include "window.h"
#include "gtktextview.h"
#include "gtkmessagedialog.h"
#include "gtkfilechooserdialog.h"
#include "gtkcheckbutton.h"
#include "gtklabel.h"

View File

@ -535,7 +535,6 @@ gtk_public_headers = files([
'gtkmediafile.h',
'gtkmediastream.h',
'gtkmenubutton.h',
'gtkmessagedialog.h',
'gtkmountoperation.h',
'gtkmultifilter.h',
'gtkmultiselection.h',

View File

@ -35,6 +35,8 @@
# endif
#endif
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#if 0
static GtkWidget *preview_label;
static GtkWidget *preview_image;

View File

@ -17,6 +17,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
value_changed (GtkWidget *button,
double volume,