[gnome-builder/wip/search] search: focus first element on GDK_KEY_Down in search box.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/search] search: focus first element on GDK_KEY_Down in search box.
- Date: Sun, 18 Jan 2015 07:53:05 +0000 (UTC)
commit 797493467a0c137f3319a7c64ada5cb7d9091b3f
Author: Christian Hergert <christian hergert me>
Date: Sat Jan 17 23:52:51 2015 -0800
search: focus first element on GDK_KEY_Down in search box.
src/search/gb-search-display.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/search/gb-search-display.c b/src/search/gb-search-display.c
index 92b22a9..5524fa3 100644
--- a/src/search/gb-search-display.c
+++ b/src/search/gb-search-display.c
@@ -448,6 +448,22 @@ gb_search_display_set_context (GbSearchDisplay *display,
}
static void
+gb_search_display_grab_focus (GtkWidget *widget)
+{
+ GbSearchDisplay *self = (GbSearchDisplay *)widget;
+
+ g_return_if_fail (GB_IS_SEARCH_DISPLAY (self));
+
+ if (self->priv->providers->len)
+ {
+ ProviderEntry *ptr;
+
+ ptr = &g_array_index (self->priv->providers, ProviderEntry, 0);
+ gtk_widget_child_focus (GTK_WIDGET (ptr->group), GTK_DIR_DOWN);
+ }
+}
+
+static void
gb_search_display_dispose (GObject *object)
{
GbSearchDisplayPrivate *priv = GB_SEARCH_DISPLAY (object)->priv;
@@ -501,6 +517,9 @@ static void
gb_search_display_class_init (GbSearchDisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->grab_focus = gb_search_display_grab_focus;
object_class->dispose = gb_search_display_dispose;
object_class->get_property = gb_search_display_get_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]