Commit 59f712ad authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Change the Escape key binding to only close if the dialog contains a

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)
parent 137ad5b9
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
......
......@@ -35,6 +35,13 @@
#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);
......@@ -60,6 +67,8 @@ static void gtk_dialog_map (GtkWidget *widget);
static void gtk_dialog_close (GtkDialog *dialog);
static ResponseData* get_response_data (GtkWidget *widget);
enum {
PROP_0,
PROP_HAS_SEPARATOR
......@@ -345,15 +354,42 @@ gtk_dialog_style_set (GtkWidget *widget,
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;
......@@ -459,13 +495,6 @@ gtk_dialog_new_with_buttons (const gchar *title,
return GTK_WIDGET (dialog);
}
typedef struct _ResponseData ResponseData;
struct _ResponseData
{
gint response_id;
};
static ResponseData*
get_response_data (GtkWidget *widget)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment