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 */
* field is */
time(&last_playing);
queuelike_completed(&ql_queue, 0, actual_queue);
+ /* Notify any interested parties */
+ event_raise("playing-track-changed", q);
}
}
/* 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 */
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,
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 */
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 */
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) {
queue_properties_activate,
queue_selectall_activate,
queue_selectnone_activate,
+ 0
};
/* Other entry points ------------------------------------------------------ */