region: Add "clear" secondary icon to search entry
https://bugzilla.gnome.org/show_bug.cgi?id=647717
This commit is contained in:
parent
b532e23532
commit
702fb777b1
2 changed files with 29 additions and 0 deletions
|
@ -151,6 +151,9 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="invisible_char">•</property>
|
<property name="invisible_char">•</property>
|
||||||
|
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||||
|
<property name="secondary-icon-activatable">False</property>
|
||||||
|
<property name="secondary-icon-sensitive">False</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -243,6 +243,15 @@ xkl_layout_add_to_list (XklConfigRegistry * config,
|
||||||
g_free (language_desc);
|
g_free (language_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
xkb_layout_filter_clear (GtkEntry *entry,
|
||||||
|
GtkEntryIconPosition icon_pos,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_entry_set_text (entry, "");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xkb_layout_filter_changed (GtkBuilder * chooser_dialog)
|
xkb_layout_filter_changed (GtkBuilder * chooser_dialog)
|
||||||
{
|
{
|
||||||
|
@ -254,6 +263,20 @@ xkb_layout_filter_changed (GtkBuilder * chooser_dialog)
|
||||||
gtk_entry_get_text (GTK_ENTRY (xkb_layout_filter));
|
gtk_entry_get_text (GTK_ENTRY (xkb_layout_filter));
|
||||||
gchar *upattern = g_utf8_strup (pattern, -1);
|
gchar *upattern = g_utf8_strup (pattern, -1);
|
||||||
|
|
||||||
|
if (!g_strcmp0 (pattern, "")) {
|
||||||
|
g_object_set (G_OBJECT (xkb_layout_filter),
|
||||||
|
"secondary-icon-name", "edit-find-symbolic",
|
||||||
|
"secondary-icon-activatable", FALSE,
|
||||||
|
"secondary-icon-sensitive", FALSE,
|
||||||
|
NULL);
|
||||||
|
} else {
|
||||||
|
g_object_set (G_OBJECT (xkb_layout_filter),
|
||||||
|
"secondary-icon-name", "edit-clear-symbolic",
|
||||||
|
"secondary-icon-activatable", TRUE,
|
||||||
|
"secondary-icon-sensitive", TRUE,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (search_pattern_list != NULL)
|
if (search_pattern_list != NULL)
|
||||||
g_strfreev (search_pattern_list);
|
g_strfreev (search_pattern_list);
|
||||||
|
|
||||||
|
@ -363,6 +386,9 @@ xkb_layout_choose (GtkBuilder * dialog)
|
||||||
(xkb_layout_filter_changed),
|
(xkb_layout_filter_changed),
|
||||||
chooser_dialog);
|
chooser_dialog);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (xkb_layout_filter), "icon-release",
|
||||||
|
G_CALLBACK (xkb_layout_filter_clear), NULL);
|
||||||
|
|
||||||
selection =
|
selection =
|
||||||
gtk_tree_view_get_selection (GTK_TREE_VIEW
|
gtk_tree_view_get_selection (GTK_TREE_VIEW
|
||||||
(xkb_filtered_layouts_list));
|
(xkb_filtered_layouts_list));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue