font chooser: Use editable api on search entry

This commit is contained in:
Matthias Clasen 2019-02-17 14:48:08 -05:00
parent 7d9e63ae38
commit 37b841b59b
2 changed files with 6 additions and 12 deletions

View File

@ -372,11 +372,11 @@ text_changed_cb (GtkEntry *entry,
}
static void
stop_search_cb (GtkEntry *entry,
stop_search_cb (GtkSearchEntry *entry,
GtkFontChooserWidget *fc)
{
if (gtk_entry_get_text (entry)[0] != 0)
gtk_entry_set_text (entry, "");
if (gtk_editable_get_text (GTK_EDITABLE (entry))[0] != 0)
gtk_editable_set_text (GTK_EDITABLE (entry), "");
else
{
GtkWidget *dialog;
@ -623,7 +623,7 @@ gtk_font_chooser_widget_map (GtkWidget *widget)
GtkFontChooserWidget *fontchooser = GTK_FONT_CHOOSER_WIDGET (widget);
GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
gtk_entry_set_text (GTK_ENTRY (priv->search_entry), "");
gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), "");
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "list");
g_simple_action_set_state (G_SIMPLE_ACTION (priv->tweak_action), g_variant_new_boolean (FALSE));
@ -767,7 +767,7 @@ change_tweak (GSimpleAction *action,
}
else
{
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (fontchooser->priv->search_entry));
gtk_widget_grab_focus (fontchooser->priv->search_entry);
gtk_stack_set_visible_child_name (GTK_STACK (fontchooser->priv->stack), "list");
}
@ -1034,7 +1034,7 @@ visible_func (GtkTreeModel *model,
}
/* If there's no filter string we show the item */
search_text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
search_text = gtk_editable_get_text (GTK_EDITABLE (priv->search_entry));
if (strlen (search_text) == 0)
return TRUE;

View File

@ -36,14 +36,8 @@
<property name="column-spacing">6</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="activates-default">1</property>
<property name="primary-icon-name">edit-find-symbolic</property>
<property name="primary-icon-activatable">0</property>
<property name="secondary-icon-activatable">0</property>
<property name="primary-icon-sensitive">0</property>
<property name="secondary-icon-sensitive">0</property>
<property name="placeholder-text" translatable="yes">Search font name</property>
<signal name="search-changed" handler="text_changed_cb" swapped="no"/>
<signal name="stop-search" handler="stop_search_cb" swapped="no"/>