chiark / gitweb /
Move RTP check. This seems to improve matters - formerly the RTP
[disorder] / disobedience / queue.c
index 8ff6b6fcd3c2ba5663ed7a2ec35df5aad0c8d9b8..026c492464a410fd6662650cc6753212a5e8ab53 100644 (file)
@@ -225,7 +225,7 @@ static struct queuelike ql_queue; /**< @brief The main queue */
 static struct queuelike ql_recent; /*< @brief Recently-played tracks */
 static struct queuelike ql_added; /*< @brief Newly added tracks */
 static struct queue_entry *actual_queue; /**< @brief actual queue */
-static struct queue_entry *playing_track;     /**< @brief currenty playing */
+struct queue_entry *playing_track;       /**< @brief currently playing */
 static time_t last_playing = (time_t)-1; /**< @brief when last got playing */
 static int namepart_lookups_outstanding;
 static int  namepart_completions_deferred; /* # of completions not processed */
@@ -1083,6 +1083,8 @@ static void playing_completed(void attribute((unused)) *v,
      * field is */
     time(&last_playing);
     queuelike_completed(&ql_queue, 0, actual_queue);
+    /* Notify any interested parties */
+    event_raise("playing-track-changed", q);
   }
 }
 
@@ -1202,7 +1204,8 @@ static int scratch_sensitive(struct queuelike attribute((unused)) *ql,
   /* We can scratch if the playing track is selected */
   return (playing_track
           && (disorder_eclient_state(client) & DISORDER_CONNECTED)
-          && selection_selected(ql->selection, playing_track->id));
+          && selection_selected(ql->selection, playing_track->id)
+          && right_scratchable(last_rights, config->username, playing_track));
 }
 
 /** @brief Called when disorder_eclient_scratch completes */
@@ -1228,7 +1231,8 @@ static int remove_sensitive(struct queuelike *ql,
   return ((disorder_eclient_state(client) & DISORDER_CONNECTED)
           && ((q
                && q != playing_track)
-              || count_selected_nonplaying(ql)));
+              || count_selected_nonplaying(ql))
+          && right_removable(last_rights, config->username, q));
 }
 
 static void remove_completed(void attribute((unused)) *v,
@@ -1260,7 +1264,8 @@ static int properties_sensitive(struct queuelike *ql,
                                 struct queue_entry attribute((unused)) *q) {
   /* "Properties" is sensitive if at least something is selected */
   return (hash_count(ql->selection) > 0
-          && (disorder_eclient_state(client) & DISORDER_CONNECTED));
+          && (disorder_eclient_state(client) & DISORDER_CONNECTED)
+          && (last_rights & RIGHT_PREFS));
 }
 
 /** @brief Pop up properties for the selected tracks */
@@ -1307,7 +1312,8 @@ static int play_sensitive(struct queuelike *ql,
                           struct queue_entry attribute((unused)) *q) {
   /* "Play" is sensitive if at least something is selected */
   return (hash_count(ql->selection) > 0
-          && (disorder_eclient_state(client) & DISORDER_CONNECTED));
+          && (disorder_eclient_state(client) & DISORDER_CONNECTED)
+          && (last_rights & RIGHT_PLAY));
 }
 
 /** @brief Play the selected tracks */
@@ -1524,7 +1530,8 @@ static void added_changed(const char attribute((unused)) *event,
 
 static int queue_properties_sensitive(GtkWidget *w) {
   return (!!queue_count_selected(g_object_get_data(G_OBJECT(w), "queue"))
-          && (disorder_eclient_state(client) & DISORDER_CONNECTED));
+          && (disorder_eclient_state(client) & DISORDER_CONNECTED)
+          && (last_rights & RIGHT_PREFS));
 }
 
 static int queue_selectall_sensitive(GtkWidget *w) {
@@ -1556,6 +1563,7 @@ static const struct tabtype tabtype_queue = {
   queue_properties_activate,
   queue_selectall_activate,
   queue_selectnone_activate,
+  0
 };
 
 /* Other entry points ------------------------------------------------------ */