]> git.0d.be Git - empathy.git/commitdiff
live-search: fix keyboard navigation using Home/End (#632787)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 20 May 2011 13:32:33 +0000 (15:32 +0200)
committerXavier Claessens <xclaesse@gmail.com>
Fri, 20 May 2011 13:48:13 +0000 (15:48 +0200)
libempathy-gtk/empathy-live-search.c

index 7296eb7c6cd0748a21b7d4bf7d8ed639f0c6e936..21aefed902e2e29a93e4131a574185f28765bf64 100644 (file)
@@ -276,6 +276,16 @@ live_search_entry_key_pressed_cb (GtkEntry *entry,
        return fire_key_navigation_sig (self, event);
      }
 
+  if (event->keyval == GDK_KEY_Home || event->keyval == GDK_KEY_End)
+    {
+      /* If the live search is visible, the entry should catch the Home/End
+       * events */
+      if (!gtk_widget_get_visible (GTK_WIDGET (self)))
+        {
+          return fire_key_navigation_sig (self, event);
+        }
+    }
+
   return FALSE;
 }
 
@@ -342,6 +352,14 @@ live_search_key_press_event_cb (GtkWidget *widget,
    if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_Down)
      return FALSE;
 
+   if (event->keyval == GDK_KEY_Home || event->keyval == GDK_KEY_End)
+     {
+       /* Home/End keys have to be forwarded to the entry only if the live
+        * search is visible (to move the cursor inside the entry). */
+       if (!gtk_widget_get_visible (GTK_WIDGET (self)))
+         return FALSE;
+     }
+
   /* realize the widget if it is not realized yet */
   gtk_widget_realize (priv->search_entry);
   if (!gtk_widget_has_focus (priv->search_entry))