[gtk+/gtk-3-22] ColorButton: Don’t destroy dialog @ ::delete-event
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] ColorButton: Don’t destroy dialog @ ::delete-event
- Date: Tue, 12 Sep 2017 20:18:50 +0000 (UTC)
commit e7fbfdd067cd3f811fd657ce3e72f2f73518e987
Author: Hiroyuki Ito <ZXB01226 nifty com>
Date: Mon Sep 11 12:02:13 2017 +0000
ColorButton: Don’t destroy dialog @ ::delete-event
Without specifically connecting ::delete-event to something, the dialog
will be destroyed when it is closed, for example by pressing Esc. This
meant that when dismissing it this way, unlike by pressing Cancel, any
custom palette would be lost when the dialog was next opened, and so on.
Resolve this by making ::delete-event just do GTK_RESPONSE_CANCEL, so
closing the dialog has the same effect as clicking its Cancel button.
https://bugzilla.gnome.org/show_bug.cgi?id=787444
gtk/gtkcolorbutton.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index b77ea28..a990ad5 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -495,6 +495,16 @@ gtk_color_button_new_with_rgba (const GdkRGBA *rgba)
}
static gboolean
+dialog_delete_event (GtkWidget *dialog,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ g_signal_emit_by_name (dialog, "response", GTK_RESPONSE_CANCEL);
+
+ return TRUE;
+}
+
+static gboolean
dialog_destroy (GtkWidget *widget,
gpointer data)
{
@@ -561,6 +571,8 @@ ensure_dialog (GtkColorButton *button)
G_CALLBACK (dialog_response), button);
g_signal_connect (dialog, "destroy",
G_CALLBACK (dialog_destroy), button);
+ g_signal_connect (dialog, "delete-event",
+ G_CALLBACK (dialog_delete_event), button);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]