chiark / gitweb /
Encourage choose tab's input focus to the search box a bit. Really we
authorRichard Kettlewell <rjk@greenend.org.uk>
Mon, 9 Jun 2008 08:54:34 +0000 (09:54 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Mon, 9 Jun 2008 08:54:34 +0000 (09:54 +0100)
want up+down keys to go to the scrollable layout and everything else
to the search box but this is a start.

disobedience/choose.c
disobedience/disobedience.c
disobedience/disobedience.h
disobedience/queue.c

index 941e89756301c3586a01774f395e7e468c7c4e61..353ed98dfe8749420c2f9e02642ea1fd2989a09d 100644 (file)
@@ -784,6 +784,8 @@ static void initiate_search(void) {
 static void clearsearch_clicked(GtkButton attribute((unused)) *button,
                                 gpointer attribute((unused)) userdata) {
   gtk_entry_set_text(GTK_ENTRY(searchentry), "");
+  /* Put the input focus back */
+  gtk_widget_grab_focus(searchentry);
 }
 
 /** @brief Called when the 'next search result' button is clicked */
@@ -1417,6 +1419,11 @@ static void choose_selectall_activate(GtkWidget attribute((unused)) *w) {
 static void choose_selectnone_activate(GtkWidget attribute((unused)) *w) {
 }
 
+/** @brief Called when the choose tab is selected */
+static void choose_tab_selected(void) {
+  gtk_widget_grab_focus(searchentry);
+}
+
 /** @brief Main menu callbacks for Choose screen */
 static const struct tabtype tabtype_choose = {
   choose_properties_sensitive,
@@ -1425,6 +1432,7 @@ static const struct tabtype tabtype_choose = {
   choose_properties_activate,
   choose_selectall_activate,
   choose_selectnone_activate,
+  choose_tab_selected,
 };
 
 /* Public entry points ----------------------------------------------------- */
index e8bbc400bbe5cf7a9c991dc05f621aff6d56e6db..443eaa42ca1671435059b4c0c15b718bb64df534 100644 (file)
@@ -116,11 +116,15 @@ static gboolean delete_event(GtkWidget attribute((unused)) *widget,
  *
  * Updates the menu settings to correspond to the new page.
  */
-static void tab_switched(GtkNotebook attribute((unused)) *notebook,
+static void tab_switched(GtkNotebook *notebook,
                          GtkNotebookPage attribute((unused)) *page,
                          guint page_num,
                          gpointer attribute((unused)) user_data) {
   menu_update(page_num);
+  GtkWidget *const tab = gtk_notebook_get_nth_page(notebook, page_num);
+  const struct tabtype *const t = g_object_get_data(G_OBJECT(tab), "type");
+  if(t->selected)
+    t->selected();
 }
 
 /** @brief Create the report box */
index 938a69ef48dc5331e42348933ee7ea3894854e4f..29215cd88b08d1f708891ac200747a96a4e826f8 100644 (file)
@@ -92,6 +92,7 @@ struct tabtype {
   void (*properties_activate)(GtkWidget *tab);
   void (*selectall_activate)(GtkWidget *tab);
   void (*selectnone_activate)(GtkWidget *tab);
+  void (*selected)(void);
 };
 
 /** @brief Button definitions */
index 48c43fb70f030a2a3c208a1716dce94f80bbd0a8..1bda1119da1ffa6efce87768e0e92ef167796443 100644 (file)
@@ -1561,6 +1561,7 @@ static const struct tabtype tabtype_queue = {
   queue_properties_activate,
   queue_selectall_activate,
   queue_selectnone_activate,
+  0
 };
 
 /* Other entry points ------------------------------------------------------ */