Disable esc keybinding on tabbed utils

This commit is contained in:
TingPing 2013-04-05 17:33:35 -03:00
parent cca8ab4640
commit c2a5b4fb7d
1 changed files with 14 additions and 7 deletions

View File

@ -323,14 +323,21 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
static gboolean static gboolean
gtkutil_esc_destroy (GtkWidget * win, GdkEventKey * key, gpointer userdata) gtkutil_esc_destroy (GtkWidget * win, GdkEventKey * key, gpointer userdata)
{ {
GtkWidget *wid = win; GtkWidget *wid;
/* Kill the window of detached utils */ /* Destroy the window of detached utils */
if (gtk_window_get_type_hint (GTK_WINDOW (gtk_widget_get_parent (win))) == GDK_WINDOW_TYPE_HINT_DIALOG) if (!gtk_widget_is_toplevel (win))
{
if (gdk_window_get_type_hint (gtk_widget_get_window (win)) == GDK_WINDOW_TYPE_HINT_DIALOG)
wid = gtk_widget_get_parent (win); wid = gtk_widget_get_parent (win);
else
return FALSE;
}
else
wid = win;
if (key->keyval == GDK_Escape) if (key->keyval == GDK_Escape)
gtk_widget_destroy (wid); /* FIXME: leaves empty tabs */ gtk_widget_destroy (wid);
return FALSE; return FALSE;
} }