[gtk+/wip/combo: 6/11] Various fixes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/combo: 6/11] Various fixes
- Date: Fri, 26 Dec 2014 05:20:57 +0000 (UTC)
commit 570c301d861670f9e2c80ac95e9668977d586125
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 25 21:40:26 2014 -0500
Various fixes
Avoid excess top margin due to the non-hidden revealer, and fix
various issues with keynav.
gtk/gtkcombo.c | 21 ++++++++++++++-------
gtk/ui/gtkcombo.ui | 1 -
2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index cdd436c..f5773fe 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -704,9 +704,6 @@ list_filter_func (GtkListBoxRow *row,
gchar *search_text;
gboolean ret;
- if (!gtk_revealer_get_child_revealed (GTK_REVEALER (combo->search_revealer)))
- return TRUE;
-
text = gtk_entry_get_text (GTK_ENTRY (combo->search_entry));
if (text[0] == '\0')
return TRUE;
@@ -789,6 +786,7 @@ reset_popover (GtkWidget *widget,
{
gtk_stack_set_visible_child_name (GTK_STACK (combo->stack), "list");
gtk_entry_set_text (GTK_ENTRY (combo->search_entry), "");
+ gtk_widget_hide (combo->search_revealer);
collapse_list (combo);
gtk_entry_set_text (GTK_ENTRY (combo->custom_entry), "");
}
@@ -1150,8 +1148,7 @@ popover_key_press (GtkWidget *widget,
gboolean res;
gchar *old_text, *new_text;
- if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (combo->stack)), "custom") == 0 ||
- gtk_revealer_get_reveal_child (GTK_REVEALER (combo->search_revealer)) ||
+ if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (combo->stack)), "list") != 0 ||
!gdk_event_get_keyval (event, &keyval) ||
is_keynav_event (event, keyval) ||
keyval == GDK_KEY_space ||
@@ -1175,6 +1172,7 @@ popover_key_press (GtkWidget *widget,
if ((res && g_strcmp0 (new_text, old_text) != 0) || preedit_changed)
{
handled = GDK_EVENT_STOP;
+ gtk_widget_show (combo->search_revealer);
gtk_revealer_set_reveal_child (GTK_REVEALER (combo->search_revealer), TRUE);
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (combo->search_entry));
}
@@ -1190,8 +1188,17 @@ button_key_press (GtkWidget *widget,
GdkEvent *event,
GtkCombo *combo)
{
- gtk_widget_show (combo->popover);
- return popover_key_press (combo->popover, event, combo);
+ gboolean handled;
+
+ handled = popover_key_press (combo->popover, event, combo);
+
+ if (handled == GDK_EVENT_STOP)
+ {
+ gtk_widget_show (combo->popover);
+ gtk_editable_select_region (GTK_EDITABLE (combo->search_entry), -1, -1);
+ }
+
+ return handled;
}
diff --git a/gtk/ui/gtkcombo.ui b/gtk/ui/gtkcombo.ui
index 496c368..77f636a 100644
--- a/gtk/ui/gtkcombo.ui
+++ b/gtk/ui/gtkcombo.ui
@@ -53,7 +53,6 @@
<property name="spacing">10</property>
<child>
<object class="GtkRevealer" id="search_revealer">
- <property name="visible">True</property>
<property name="transition-type">slide-down</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]