*/
#include "disobedience.h"
+#include "charset.h"
/** @brief Horizontal padding for queue cells */
#define HCELLPADDING 4
const char *data) {
D(("column_namepart"));
NW(label);
- return gtk_label_new(namepart(q->track, "display", data));
+ return gtk_label_new(truncate_for_display(namepart(q->track, "display", data),
+ config->short_display));
}
/** @brief Compute the length field */
/** @brief Wrap up a widget for putting into the queue or title
* @param label Label to contain
- * @param color Pointer to color
+ * @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 GdkColor *bgcolor,
- const GdkColor *fgcolor,
+ GtkStyle *style,
int *wp) {
GtkRequisition req;
GtkWidget *bg;
if(req.width > *wp) *wp = req.width;
}
/* Set colors */
- gtk_widget_modify_bg(bg, GTK_STATE_NORMAL, bgcolor);
- gtk_widget_modify_bg(bg, GTK_STATE_SELECTED, &selected_bg);
- gtk_widget_modify_bg(bg, GTK_STATE_PRELIGHT, &selected_bg);
- gtk_widget_modify_fg(label, GTK_STATE_NORMAL, fgcolor);
- gtk_widget_modify_fg(label, GTK_STATE_SELECTED, &selected_fg);
- gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &selected_fg);
+ gtk_widget_set_style(bg, style);
+ gtk_widget_set_style(label, style);
return bg;
}
const struct queue_entry *q,
int row,
int col,
- const GdkColor *bgcolor,
- const GdkColor *fgcolor,
+ 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, bgcolor, fgcolor, 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 GdkColor *bgcolor,
- const GdkColor *fgcolor) {
+static GtkWidget *get_padding_cell(GtkStyle *style) {
D(("get_padding_cell"));
NW(label);
- return wrap_queue_cell(gtk_label_new(""), bgcolor, fgcolor, 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_modify_bg(ql->dragmark, GTK_STATE_NORMAL, &drag_target);
+ 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 GdkColor *bgcolor;
+ 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) bgcolor = &active_bg;
- else bgcolor = row % 2 ? &even_bg : &odd_bg;
+ 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, bgcolor, &item_fg,
- &maxwidths[col]);
+ w = get_queue_cell(ql, q, row, col, style, &maxwidths[col]);
else
- w = get_padding_cell(bgcolor, &item_fg);
+ w = get_padding_cell(style);
ql->cells[row * (ql->ncolumns + 1) + col] = w;
/* Maybe mark it draggable */
if(draggable_row(q)) {
/* Create the layouts */
NW(layout);
ql->mainlayout = gtk_layout_new(0, 0);
- gtk_widget_modify_bg(ql->mainlayout, GTK_STATE_NORMAL, &layout_bg);
+ 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);
titlescroll = scroll_widget(ql->titlelayout);
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, &title_bg, &title_fg, 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(&title_bg, &title_fg);
+ 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);