+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
+Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkdialog.c: Change the Escape key binding to only close
+ if the dialog contains a cancel button. (Patch from
+ James Willcox, #74221)
+
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (compare_cmpl_dir): Use
#include "gtkintl.h"
#include "gtkbindings.h"
+typedef struct _ResponseData ResponseData;
+
+struct _ResponseData
+{
+ gint response_id;
+};
+
static void gtk_dialog_class_init (GtkDialogClass *klass);
static void gtk_dialog_init (GtkDialog *dialog);
static void gtk_dialog_close (GtkDialog *dialog);
+static ResponseData* get_response_data (GtkWidget *widget);
+
enum {
PROP_0,
PROP_HAS_SEPARATOR
update_spacings (GTK_DIALOG (widget));
}
+static gboolean
+dialog_has_cancel (GtkDialog *dialog)
+{
+ GList *children, *tmp_list;
+ gboolean ret = FALSE;
+
+ children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
+
+ for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
+ {
+ ResponseData *rd = get_response_data (tmp_list->data);
+
+ if (rd && rd->response_id == GTK_RESPONSE_CANCEL)
+ {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ g_list_free (children);
+
+ return ret;
+}
+
static void
gtk_dialog_close (GtkDialog *dialog)
{
/* Synthesize delete_event to close dialog. */
- GdkEvent *event = gdk_event_new (GDK_DELETE);
- GtkWidget *widget;
+ GtkWidget *widget = GTK_WIDGET (dialog);
+ GdkEvent *event;
- widget = GTK_WIDGET (dialog);
+ if (!dialog_has_cancel (dialog))
+ return;
+
+ event = gdk_event_new (GDK_DELETE);
event->any.window = g_object_ref (widget->window);
event->any.send_event = TRUE;
return GTK_WIDGET (dialog);
}
-typedef struct _ResponseData ResponseData;
-
-struct _ResponseData
-{
- gint response_id;
-};
-
static ResponseData*
get_response_data (GtkWidget *widget)
{