chiark / gitweb /
Choose next/prev/cancel button teleport focus back to the main view,
[disorder] / disobedience / choose-search.c
index 44321519e966d5294b76aa752d6c84fc53e7d7a6..77ad813a8b93afa73c8e19e64a66296b3d9759ae 100644 (file)
@@ -19,9 +19,6 @@
  */
 /** @file disobedience/search.c
  * @brief Search support
- *
- * TODO:
- * - cleverer focus to implement typeahead find
  */
 #include "disobedience.h"
 #include "choose.h"
@@ -436,6 +433,7 @@ static gboolean choose_get_visible_range(GtkTreeView *tree_view,
 
 void choose_next_clicked(GtkButton attribute((unused)) *button,
                          gpointer attribute((unused)) userdata) {
+  gtk_widget_grab_focus(choose_view);
   if(!choose_n_search_results)
     return;
   /* Find the last visible row */
@@ -473,6 +471,7 @@ void choose_next_clicked(GtkButton attribute((unused)) *button,
 
 void choose_prev_clicked(GtkButton attribute((unused)) *button,
                          gpointer attribute((unused)) userdata) {
+  gtk_widget_grab_focus(choose_view);
   /* TODO can we de-dupe with choose_next_clicked?  Probably yes. */
   if(!choose_n_search_results)
     return;
@@ -513,6 +512,7 @@ void choose_prev_clicked(GtkButton attribute((unused)) *button,
 static void choose_clear_clicked(GtkButton attribute((unused)) *button,
                                  gpointer attribute((unused)) userdata) {
   gtk_entry_set_text(GTK_ENTRY(choose_search_entry), "");
+  gtk_widget_grab_focus(choose_view);
   /* We start things off straight away in this case */
   initiate_search();
 }