font chooser: Make repeated Escape cancel the dialog
The first Escape clears the search entry, the second Escape closes the dialog.
This commit is contained in:
parent
5f44339ce3
commit
aa9dd72e8f
@ -47,6 +47,7 @@
|
|||||||
#include "gtktreeview.h"
|
#include "gtktreeview.h"
|
||||||
#include "gtkwidget.h"
|
#include "gtkwidget.h"
|
||||||
#include "gtksettings.h"
|
#include "gtksettings.h"
|
||||||
|
#include "gtkdialog.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gtkfontchooserwidget
|
* SECTION:gtkfontchooserwidget
|
||||||
@ -310,7 +311,20 @@ static void
|
|||||||
stop_search_cb (GtkEntry *entry,
|
stop_search_cb (GtkEntry *entry,
|
||||||
GtkFontChooserWidget *fc)
|
GtkFontChooserWidget *fc)
|
||||||
{
|
{
|
||||||
gtk_entry_set_text (entry, "");
|
if (gtk_entry_get_text (entry)[0] != 0)
|
||||||
|
gtk_entry_set_text (entry, "");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkWidget *dialog;
|
||||||
|
GtkWidget *button = NULL;
|
||||||
|
|
||||||
|
dialog = gtk_widget_get_ancestor (GTK_WIDGET (fc), GTK_TYPE_DIALOG);
|
||||||
|
if (dialog)
|
||||||
|
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
|
||||||
|
|
||||||
|
if (button)
|
||||||
|
gtk_widget_activate (button);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user