* ql_added.
*/
struct queuelike {
- /** @brief Name of this queue */
- const char *name;
-
/** @brief Called when an update completes */
void (*notify)(void);
- /** @brief Called to fix up the queue after update
+ /** @brief Called to fix up the queue after update
* @param q The list passed back from the server
* @return Assigned to @c ql->q
*/
static void namepart_completed_or_failed(void) {
D(("namepart_completed_or_failed"));
--namepart_lookups_outstanding;
- if(!namepart_lookups_outstanding || namepart_completions_deferred > 24) {
+ if(!namepart_lookups_outstanding) {
redisplay_queue(&ql_queue);
redisplay_queue(&ql_recent);
redisplay_queue(&ql_added);
selection_cleanup(ql->selection);
}
-/** @brief Wrap up a widget for putting into the queue or title */
+/** @brief Wrap up a widget for putting into the queue or title
+ * @param label Label to contain
+ * @param style Pointer to style to use
+ * @param wp Updated with maximum width (or NULL)
+ * @return New widget
+ */
static GtkWidget *wrap_queue_cell(GtkWidget *label,
- const char *name,
+ GtkStyle *style,
int *wp) {
GtkRequisition req;
GtkWidget *bg;
gtk_widget_size_request(label, &req);
if(req.width > *wp) *wp = req.width;
}
- /* Set widget names */
- gtk_widget_set_name(bg, name);
- gtk_widget_set_name(label, name);
+ /* Set colors */
+ gtk_widget_set_style(bg, style);
+ gtk_widget_set_style(label, style);
return bg;
}
const struct queue_entry *q,
int row,
int col,
- const char *name,
+ GtkStyle *style,
int *wp) {
GtkWidget *label;
D(("get_queue_cell %d %d", row, col));
label = ql->columns[col].widget(ql, q, ql->columns[col].data);
gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
- return wrap_queue_cell(label, name, wp);
+ return wrap_queue_cell(label, style, wp);
}
/** @brief Add a padding cell to the end of a row */
-static GtkWidget *get_padding_cell(const char *name) {
+static GtkWidget *get_padding_cell(GtkStyle *style) {
D(("get_padding_cell"));
NW(label);
- return wrap_queue_cell(gtk_label_new(""), name, 0);
+ return wrap_queue_cell(gtk_label_new(""), style, 0);
}
/* User button press and menu ---------------------------------------------- */
g_signal_connect(ql->dragmark, "destroy",
G_CALLBACK(gtk_widget_destroyed), &ql->dragmark);
gtk_widget_set_size_request(ql->dragmark, 10240, row ? 4 : 2);
- gtk_widget_set_name(ql->dragmark, "queue-drag");
+ gtk_widget_set_style(ql->dragmark, drag_style);
gtk_layout_put(GTK_LAYOUT(ql->mainlayout), ql->dragmark, 0,
(row + 1) * ql->mainrowheight - !!row);
} else
struct queue_entry *q;
int row, col;
GList *c, *children;
- const char *name;
+ GtkStyle *style;
GtkRequisition req;
GtkWidget *w;
int maxwidths[MAXCOLUMNS], x, y, titlerowheight;
/* Construct the widgets */
for(q = ql->q, row = 0; q; q = q->next, ++row) {
/* Figure out the widget name for this row */
- if(q == playing_track) name = "row-playing";
- else name = row % 2 ? "row-even" : "row-odd";
+ if(q == playing_track) style = active_style;
+ else style = row % 2 ? even_style : odd_style;
/* Make the widget for each column */
for(col = 0; col <= ql->ncolumns; ++col) {
/* Create and store the widget */
if(col < ql->ncolumns)
- w = get_queue_cell(ql, q, row, col, name, &maxwidths[col]);
+ w = get_queue_cell(ql, q, row, col, style, &maxwidths[col]);
else
- w = get_padding_cell(name);
+ w = get_padding_cell(style);
ql->cells[row * (ql->ncolumns + 1) + col] = w;
/* Maybe mark it draggable */
if(draggable_row(q)) {
struct queue_entry *(*fixup)(struct queue_entry *),
void (*notify)(void),
struct queue_menuitem *menuitems,
- const char *name,
const struct column *columns,
int ncolumns) {
GtkWidget *vbox, *mainscroll, *titlescroll, *label;
ql->fixup = fixup;
ql->notify = notify;
ql->menuitems = menuitems;
- ql->name = name;
ql->mainrowheight = !0; /* else division by 0 */
ql->selection = selection_new();
ql->columns = columns;
/* Create the layouts */
NW(layout);
ql->mainlayout = gtk_layout_new(0, 0);
+ gtk_widget_set_style(ql->mainlayout, layout_style);
NW(layout);
ql->titlelayout = gtk_layout_new(0, 0);
+ gtk_widget_set_style(ql->titlelayout, title_style);
/* Scroll the layouts */
- ql->mainscroll = mainscroll = scroll_widget(ql->mainlayout, name);
- titlescroll = scroll_widget(ql->titlelayout, name);
+ ql->mainscroll = mainscroll = scroll_widget(ql->mainlayout);
+ titlescroll = scroll_widget(ql->titlelayout);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(titlescroll),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
mainadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(mainscroll));
NW(label);
label = gtk_label_new(ql->columns[col].name);
gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
- ql->titlecells[col] = wrap_queue_cell(label, "row-title", 0);
+ ql->titlecells[col] = wrap_queue_cell(label, title_style, 0);
gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
}
- ql->titlecells[col] = get_padding_cell("row-title");
+ ql->titlecells[col] = get_padding_cell(title_style);
gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
/* Pack the lot together in a vbox */
NW(vbox);
g_signal_connect(ql->mainlayout, "button-press-event",
G_CALLBACK(mainlayout_button), ql);
#endif
+ set_tool_colors(ql->menu);
return vbox;
}
/* Arrange periodic update of the so-far played field */
g_timeout_add(1000/*ms*/, adjust_sofar, 0);
/* Arrange a callback whenever the playing state changes */
- register_monitor(playing_update, 0, DISORDER_PLAYING|DISORDER_TRACK_PAUSED);
+ register_monitor(playing_update, 0, DISORDER_PLAYING|DISORDER_TRACK_PAUSED);
register_reset(queue_update);
/* We pass choose_update() as our notify function since the choose screen
* marks tracks that are playing/in the queue. */
return queuelike(&ql_queue, fixup_queue, choose_update, queue_menu,
- "queue", maincolumns, NMAINCOLUMNS);
+ maincolumns, NMAINCOLUMNS);
}
/** @brief Arrange an update of the queue widget
GtkWidget *recent_widget(void) {
D(("recent_widget"));
register_reset(recent_update);
- return queuelike(&ql_recent, fixup_recent, 0, recent_menu, "recent",
+ return queuelike(&ql_recent, fixup_recent, 0, recent_menu,
maincolumns, NMAINCOLUMNS);
}
GtkWidget *added_widget(void) {
D(("added_widget"));
register_reset(added_update);
- return queuelike(&ql_added, 0/*fixup*/, 0/*notify*/, added_menu, "added",
+ return queuelike(&ql_added, 0/*fixup*/, 0/*notify*/, added_menu,
addedcolumns, NADDEDCOLUMNS);
}