chiark / gitweb /
Add documentation and administrivia about `disorder-gstdecode'.
[disorder] / disobedience / queue-generic.c
index e2fd48a7ff8966d3d683c7ee42f081880a5d32a0..2c0ac190e221978a02d826076de4fe9ebf6c9b09 100644 (file)
@@ -227,6 +227,10 @@ void ql_update_list_store(struct queuelike *ql) {
   }
 }
 
+/** @brief Old and new queue data
+ *
+ * Used when updating a @ref queuelike with new data from the server.
+ */
 struct newqueue_data {
   struct queue_entry *old, *new;
 };
@@ -323,6 +327,8 @@ void ql_new_queue(struct queuelike *ql,
                          ql->ncolumns + QUEUEPOINTER_COLUMN, nqd->new,
                          -1);
       it = gtk_tree_model_iter_next(GTK_TREE_MODEL(ql->store), iter);
+      /* We'll need the new start time */
+      nqd->new->when = q->when;
       ++kept;
     } else {
       /* Delete this row (and move iter to the next one) */
@@ -634,7 +640,7 @@ static void ql_drag_data_get_collect(GtkTreeModel *model,
  * @param w Source widget (the tree view)
  * @param dc Drag context
  * @param data Where to put the answer
- * @param info_ Target @c info parameter
+ * @param info Target @c info parameter
  * @param time_ Time data requested (for some reason not a @c time_t)
  * @param user_data The queuelike
  *
@@ -650,13 +656,13 @@ static void ql_drag_data_get_collect(GtkTreeModel *model,
 static void ql_drag_data_get(GtkWidget attribute((unused)) *w,
                              GdkDragContext attribute((unused)) *dc,
                              GtkSelectionData *data,
-                             guint info,
+                             guint attribute((unused)) info,
                              guint attribute((unused)) time_,
                              gpointer user_data) {
   struct queuelike *const ql = user_data;
   struct dynstr result[1];
 
-  fprintf(stderr, "ql_drag_data_get %s info=%d\n", ql->name, info);
+  //fprintf(stderr, "ql_drag_data_get %s info=%d\n", ql->name, info);
   dynstr_init(result);
   gtk_tree_selection_selected_foreach(ql->selection,
                                       ql_drag_data_get_collect,
@@ -697,7 +703,7 @@ static void ql_drag_data_received(GtkWidget attribute((unused)) *w,
   struct vector ids[1], tracks[1];
   int parity = 0;
 
-  fprintf(stderr, "drag-data-received: %d,%d info_=%u\n", x, y, info_);
+  //fprintf(stderr, "drag-data-received: %d,%d info=%u\n", x, y, info_);
   /* Get the selection string */
   p = result = (char *)gtk_selection_data_get_text(data);
   if(!result) {
@@ -730,18 +736,21 @@ static void ql_drag_data_received(GtkWidget attribute((unused)) *w,
   GtkTreePath *path = ql_drop_path(w, GTK_TREE_MODEL(ql->store), x, y, &pos);
   if(path) {
     q = ql_path_to_q(GTK_TREE_MODEL(ql->store), path);
+    //fprintf(stderr, "  drop path: %s q=%p pos=%d\n",
+    //        gtk_tree_path_to_string(path), q, pos);
   } else {
     /* This generally means a drop past the end of the queue.  We find the last
      * element in the queue and ask to move after that. */
     for(q = ql->q; q && q->next; q = q->next)
       ;
+    //fprintf(stderr, "  after end.  q=%p.  pos=%d\n", q, pos);
   }
   switch(pos) {
   case GTK_TREE_VIEW_DROP_BEFORE:
   case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
     if(q) {
       q = q->prev;
-      //fprintf(stderr, "  ...but we like to drop near %s\n",
+      //fprintf(stderr, "  but we like to drop near %s\n",
       //        q ? q->id : "NULL");
     }
     break;
@@ -803,7 +812,7 @@ GtkWidget *init_queuelike(struct queuelike *ql) {
       (ql->columns[n].name,
        r,
        "text", n,
-       "background", ql->ncolumns + BACKGROUND_COLUMN,
+       "cell-background", ql->ncolumns + BACKGROUND_COLUMN,
        "foreground", ql->ncolumns + FOREGROUND_COLUMN,
        (char *)0);
     gtk_tree_view_column_set_resizable(c, TRUE);