[gnome-builder/wip/greeter] greeter: allow keynav between list boxes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/greeter] greeter: allow keynav between list boxes
- Date: Mon, 11 May 2015 05:41:45 +0000 (UTC)
commit 700b8407adcebdeeb2b885572711f7d445a95b11
Author: Christian Hergert <christian hergert me>
Date: Sun May 10 22:41:32 2015 -0700
greeter: allow keynav between list boxes
src/greeter/gb-greeter-window.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/greeter/gb-greeter-window.c b/src/greeter/gb-greeter-window.c
index e0e9b54..3d983e9 100644
--- a/src/greeter/gb-greeter-window.c
+++ b/src/greeter/gb-greeter-window.c
@@ -348,6 +348,28 @@ gb_greeter_window__row_activated (GbGreeterWindow *self,
g_object_ref (self));
}
+static gboolean
+gb_greeter_window__keynav_failed (GbGreeterWindow *self,
+ GtkDirectionType dir,
+ GtkListBox *list_box)
+{
+ g_assert (GB_IS_GREETER_WINDOW (self));
+ g_assert (GTK_IS_LIST_BOX (list_box));
+
+ if ((list_box == self->my_projects_list_box) && (dir == GTK_DIR_DOWN))
+ {
+ gtk_widget_child_focus (GTK_WIDGET (self->other_projects_list_box), GTK_DIR_DOWN);
+ return GDK_EVENT_STOP;
+ }
+ else if ((list_box == self->other_projects_list_box) && (dir == GTK_DIR_UP))
+ {
+ gtk_widget_child_focus (GTK_WIDGET (self->my_projects_list_box), GTK_DIR_UP);
+ return GDK_EVENT_STOP;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
static void
gb_greeter_window_constructed (GObject *object)
{
@@ -471,12 +493,24 @@ gb_greeter_window_init (GbGreeterWindow *self)
self,
G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->my_projects_list_box,
+ "keynav-failed",
+ G_CALLBACK (gb_greeter_window__keynav_failed),
+ self,
+ G_CONNECT_SWAPPED);
+
g_signal_connect_object (self->other_projects_list_box,
"row-activated",
G_CALLBACK (gb_greeter_window__row_activated),
self,
G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->other_projects_list_box,
+ "keynav-failed",
+ G_CALLBACK (gb_greeter_window__keynav_failed),
+ self,
+ G_CONNECT_SWAPPED);
+
gtk_list_box_set_header_func (self->my_projects_list_box,
gb_gtk_list_box_row_separator_func,
NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]