static void redisplay_queue(struct queuelike *ql) {
struct queue_entry *q;
int row, col;
- GList *c;
+ GList *c, *children;
const char *name;
GtkRequisition req;
GtkWidget *w;
D(("redisplay_queue"));
/* Eliminate all the existing widgets and start from scratch */
- for(c = gtk_container_get_children(GTK_CONTAINER(ql->mainlayout));
+ for(c = children = gtk_container_get_children(GTK_CONTAINER(ql->mainlayout));
c;
c = c->next) {
/* Destroy both the label and the eventbox */
DW(event_box);
gtk_widget_destroy(GTK_WIDGET(c->data));
}
+ g_list_free(children);
/* Adjust the row count */
for(q = ql->q, ql->nrows = 0; q; q = q->next)
++ql->nrows;
struct menuitem attribute((unused)) *m,
struct queue_entry attribute((unused)) *q) {
/* We can scratch if the playing track is selected */
- return playing_track && selection_selected(ql->selection, playing_track->id);
+ return (playing_track
+ && (disorder_eclient_state(client) & DISORDER_CONNECTED)
+ && selection_selected(ql->selection, playing_track->id));
}
static void scratch_activate(GtkMenuItem attribute((unused)) *menuitem,
struct queue_entry *q) {
/* We can remove if we're hovering over a particular track or any non-playing
* tracks are selected */
- return (q && q != playing_track) || count_selected_nonplaying(ql);
+ return ((disorder_eclient_state(client) & DISORDER_CONNECTED)
+ && ((q
+ && q != playing_track)
+ || count_selected_nonplaying(ql)));
}
static void remove_activate(GtkMenuItem attribute((unused)) *menuitem,
struct menuitem attribute((unused)) *m,
struct queue_entry attribute((unused)) *q) {
/* "Properties" is sensitive if at least something is selected */
- return hash_count(ql->selection) > 0;
+ return (hash_count(ql->selection) > 0
+ && (disorder_eclient_state(client) & DISORDER_CONNECTED));
}
static void properties_activate(GtkMenuItem attribute((unused)) *menuitem,
/* Popup menu for the queue. Put the properties first so that finger trouble
* is less dangerous. */
static struct menuitem queue_menu[] = {
- { "Properties", properties_activate, properties_sensitive, 0, 0 },
- { "Select all", selectall_activate, selectall_sensitive, 0, 0 },
- { "Scratch", scratch_activate, scratch_sensitive, 0, 0 },
- { "Remove", remove_activate, remove_sensitive, 0, 0 },
+ { "Track properties", properties_activate, properties_sensitive, 0, 0 },
+ { "Select all tracks", selectall_activate, selectall_sensitive, 0, 0 },
+ { "Scratch track", scratch_activate, scratch_sensitive, 0, 0 },
+ { "Remove track from queue", remove_activate, remove_sensitive, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
}
static struct menuitem recent_menu[] = {
- { "Properties", properties_activate, properties_sensitive,0, 0 },
- { "Select all", selectall_activate, selectall_sensitive, 0, 0 },
+ { "Track properties", properties_activate, properties_sensitive,0, 0 },
+ { "Select all tracks", selectall_activate, selectall_sensitive, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
/* Main menu plumbing ------------------------------------------------------ */
static int queue_properties_sensitive(GtkWidget *w) {
- return !!queue_count_selected(g_object_get_data(G_OBJECT(w), "queue"));
+ return (!!queue_count_selected(g_object_get_data(G_OBJECT(w), "queue"))
+ && (disorder_eclient_state(client) & DISORDER_CONNECTED));
}
static int queue_selectall_sensitive(GtkWidget *w) {