font chooser: Make Escape stop search

This commit is contained in:
Matthias Clasen 2015-08-10 20:15:26 +02:00
parent e548c71394
commit 61ffb517bc
2 changed files with 10 additions and 2 deletions

View File

@ -301,12 +301,18 @@ gtk_font_chooser_widget_refilter_font_list (GtkFontChooserWidget *fontchooser)
static void
text_changed_cb (GtkEntry *entry,
GParamSpec *pspec,
GtkFontChooserWidget *fc)
{
gtk_font_chooser_widget_refilter_font_list (fc);
}
static void
stop_search_cb (GtkEntry *entry,
GtkFontChooserWidget *fc)
{
gtk_entry_set_text (entry, "");
}
static void
size_change_cb (GtkAdjustment *adjustment,
gpointer user_data)
@ -580,6 +586,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, size_slider);
gtk_widget_class_bind_template_callback (widget_class, text_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, stop_search_cb);
gtk_widget_class_bind_template_callback (widget_class, cursor_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, row_activated_cb);
gtk_widget_class_bind_template_callback (widget_class, gtk_font_chooser_widget_set_cell_size);

View File

@ -48,7 +48,8 @@
<property name="primary_icon_sensitive">False</property>
<property name="secondary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Search font name</property>
<signal name="notify::text" handler="text_changed_cb" swapped="no"/>
<signal name="search-changed" handler="text_changed_cb" swapped="no"/>
<signal name="stop-search" handler="stop_search_cb" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>