summaryrefslogtreecommitdiff
path: root/gtk/gtkdialog.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-01-01 15:24:16 -0500
committerMatthias Clasen <mclasen@redhat.com>2018-01-16 14:14:09 -0500
commita739ee690517da1a53258a5d0ca58e22b47400f5 (patch)
tree56f586d997a82a1575820f9cd9adde299ba3fea9 /gtk/gtkdialog.c
parent1c3f8ba2522b3e8b917a46e6a453ace545ed24de (diff)
downloadgtk+-a739ee690517da1a53258a5d0ca58e22b47400f5.tar.gz
Replace GtkWidget::delete-event by GtkWindow::close-request
The event is not useful at all, so we are better off with a signal that doesn't have it, and it is only relevant on toplevel windows, so we don't need it on GtkWidget. With this commit, delete events no longer go through the ::event, ::delete-event, ::event-after widget signals, but just cause the ::close-request signal on GtkWindow to be emitted.
Diffstat (limited to 'gtk/gtkdialog.c')
-rw-r--r--gtk/gtkdialog.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index adebb3db01..25e0d927a8 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -191,8 +191,7 @@ static void gtk_dialog_add_buttons_valist (GtkDialog *dialog,
const gchar *first_button_text,
va_list args);
-static gboolean gtk_dialog_delete_event (GtkWidget *widget,
- GdkEventAny *event);
+static gboolean gtk_dialog_close_request (GtkWindow *window);
static void gtk_dialog_map (GtkWidget *widget);
static void gtk_dialog_close (GtkDialog *dialog);
@@ -510,10 +509,12 @@ gtk_dialog_class_init (GtkDialogClass *class)
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
+ GtkWindowClass *window_class;
GtkBindingSet *binding_set;
gobject_class = G_OBJECT_CLASS (class);
widget_class = GTK_WIDGET_CLASS (class);
+ window_class = GTK_WINDOW_CLASS (class);
gobject_class->constructed = gtk_dialog_constructed;
gobject_class->set_property = gtk_dialog_set_property;
@@ -521,7 +522,8 @@ gtk_dialog_class_init (GtkDialogClass *class)
gobject_class->finalize = gtk_dialog_finalize;
widget_class->map = gtk_dialog_map;
- widget_class->delete_event = gtk_dialog_delete_event;
+
+ window_class->close_request = gtk_dialog_close_request;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DIALOG);
@@ -622,13 +624,12 @@ gtk_dialog_buildable_interface_init (GtkBuildableIface *iface)
}
static gboolean
-gtk_dialog_delete_event (GtkWidget *widget,
- GdkEventAny *event)
+gtk_dialog_close_request (GtkWindow *window)
{
/* emit response signal, this will shut down the loop if we are in gtk_dialog_run */
- gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_DELETE_EVENT);
+ gtk_dialog_response (GTK_DIALOG (window), GTK_RESPONSE_DELETE_EVENT);
- return GTK_WIDGET_CLASS (gtk_dialog_parent_class)->delete_event (widget, event);
+ return GTK_WINDOW_CLASS (gtk_dialog_parent_class)->close_request (window);
}
static GList *