chiark / gitweb /
Doxygen-clean
[disorder] / disobedience / choose.c
index c0541624edb840e4e10115c125db6dfe9d815474..d1e951571ff04c5888ea64d9c11151d766a9981f 100644 (file)
@@ -2,20 +2,18 @@
  * This file is part of DisOrder
  * Copyright (C) 2008 Richard Kettlewell
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /** @file disobedience/choose.c
  * @brief Hierarchical track selection and search
  * TRACK_COLUMN="" and ISFILE_COLUMN=FALSE (so that they don't get check boxes,
  * lengths, etc).
  *
- * TODO We do a period sweep which kills contracted nodes, putting back
- * placeholders, and updating expanded nodes to keep up with server-side
- * changes.  (We could trigger the latter off rescan complete notifications?)
- * 
  * TODO:
- * - sweep up contracted nodes
- * - update when content may have changed (e.g. after a rescan)
+ * - sweep up contracted nodes, replacing their content with a placeholder
  */
 
 #include "disobedience.h"
@@ -110,7 +103,7 @@ int choose_can_autocollapse(GtkTreeIter *iter) {
 }
 
 /** @brief Remove node @p it and all its children
- * @param Iterator, updated to point to next
+ * @param it Iterator, updated to point to next
  * @return True if iterator remains valid
  *
  * TODO is this necessary?  gtk_tree_store_remove() does not document what
@@ -170,12 +163,12 @@ static void choose_set_state(const char attribute((unused)) *event,
  * @param parent_ref Node to populate or NULL to fill root
  * @param nvec Number of children to add
  * @param vec Children
- * @param files 1 if children are files, 0 if directories
+ * @param isfile 1 if children are files, 0 if directories
  *
  * Adjusts the set of files (or directories) below @p parent_ref to match those
  * listed in @p nvec and @p vec.
  *
- * @parent_ref will be destroyed.
+ * @p parent_ref will be destroyed.
  */
 static void choose_populate(GtkTreeRowReference *parent_ref,
                             int nvec, char **vec,
@@ -337,29 +330,29 @@ skip:
 }
 
 static void choose_dirs_completed(void *v,
-                                  const char *error,
+                                  const char *err,
                                   int nvec, char **vec) {
-  if(error) {
-    popup_protocol_error(0, error);
+  if(err) {
+    popup_protocol_error(0, err);
     return;
   }
   choose_populate(v, nvec, vec, 0/*!isfile*/);
 }
 
 static void choose_files_completed(void *v,
-                                   const char *error,
+                                   const char *err,
                                    int nvec, char **vec) {
-  if(error) {
-    popup_protocol_error(0, error);
+  if(err) {
+    popup_protocol_error(0, err);
     return;
   }
   choose_populate(v, nvec, vec, 1/*isfile*/);
 }
 
 void choose_play_completed(void attribute((unused)) *v,
-                           const char *error) {
-  if(error)
-    popup_protocol_error(0, error);
+                           const char *err) {
+  if(err)
+    popup_protocol_error(0, err);
 }
 
 static void choose_state_toggled
@@ -510,7 +503,7 @@ static void choose_refill(const char attribute((unused)) *event,
  */
 static gboolean choose_key_event(GtkWidget attribute((unused)) *widget,
                                  GdkEventKey *event,
-                                 gpointer attribute((unused)) user_data) {
+                                 gpointer user_data) {
   /*fprintf(stderr, "choose_key_event type=%d state=%#x keyval=%#x\n",
           event->type, event->state, event->keyval);*/
   switch(event->keyval) {
@@ -540,6 +533,7 @@ static gboolean choose_key_event(GtkWidget attribute((unused)) *widget,
     }
     break;
   }
+  /* Anything not handled we redirected to the search entry field */
   gtk_widget_event(user_data, (GdkEvent *)event);
   return TRUE;                          /* Handled it */
 }
@@ -561,9 +555,7 @@ GtkWidget *choose_widget(void) {
   /* Create the view */
   choose_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(choose_store));
   gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(choose_view), TRUE);
-  /* Suppress built-in typeahead find, we do our own search support.
-   * TODO: ^F still brings up the native search box
-   */
+  /* Suppress built-in typeahead find, we do our own search support. */
   gtk_tree_view_set_enable_search(GTK_TREE_VIEW(choose_view), FALSE);
 
   /* Create cell renderers and columns */