From: Richard Kettlewell Date: Tue, 1 Dec 2009 18:50:57 +0000 (+0000) Subject: New compact mode for Disobediene. X-Git-Tag: 5.0~27 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/a89e0ecf7c67ef6af6678985060a0d8e7bae5fba?hp=37e94d5c1c37a101d1e806da3b7e8a8ee26cfbdd New compact mode for Disobediene. Queue tab now shows playing track with green background, like the web interface. --- diff --git a/CHANGES.html b/CHANGES.html index e5b2457..e631294 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -110,7 +110,8 @@ span.command { “Recent”, “Added” and “Choose” tabs to the queue.

-

Disobedience now supports playlist editing.

+

Disobedience now supports playlist editing and has a compact mode, + available from the Control menu.

Disobedience has a new manual.

diff --git a/disobedience/disobedience.c b/disobedience/disobedience.c index 95949f6..8ca36e5 100644 --- a/disobedience/disobedience.c +++ b/disobedience/disobedience.c @@ -172,6 +172,10 @@ static GtkWidget *notebook(void) { return tabs; } +/* Tracking of window sizes */ +static int toplevel_width = 640, toplevel_height = 480; +static int mini_width = 480, mini_height = 140; + static void main_minimode(const char attribute((unused)) *event, void attribute((unused)) *evendata, void attribute((unused)) *callbackdata) { @@ -180,9 +184,24 @@ static void main_minimode(const char attribute((unused)) *event, gtk_widget_hide(playing_mini); /* Show the queue (bit confusing otherwise!) */ gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs), 0); + gtk_window_resize(GTK_WINDOW(toplevel), toplevel_width, toplevel_height); } else { gtk_widget_hide(tabs); gtk_widget_show(playing_mini); + gtk_window_resize(GTK_WINDOW(toplevel), mini_width, mini_height); + } +} + +/* Called when the window size is allocate */ +static void toplevel_size_allocate(GtkWidget attribute((unused)) *w, + GtkAllocation *a, + gpointer attribute((unused)) user_data) { + if(full_mode) { + toplevel_width = a->width; + toplevel_height = a->height; + } else { + mini_width = a->width; + mini_height = a->height; } } @@ -194,10 +213,14 @@ static void make_toplevel_window(void) { D(("top_window")); toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* default size is too small */ - gtk_window_set_default_size(GTK_WINDOW(toplevel), 640, 480); + gtk_window_set_default_size(GTK_WINDOW(toplevel), + toplevel_width, toplevel_height); /* terminate on close */ g_signal_connect(G_OBJECT(toplevel), "delete_event", G_CALLBACK(delete_event), NULL); + /* track size */ + g_signal_connect(G_OBJECT(toplevel), "size-allocate", + G_CALLBACK(toplevel_size_allocate), NULL); /* lay out the window */ gtk_window_set_title(GTK_WINDOW(toplevel), "Disobedience"); gtk_container_add(GTK_CONTAINER(toplevel), vbox); diff --git a/disobedience/menu.c b/disobedience/menu.c index f54fe4a..8947426 100644 --- a/disobedience/menu.c +++ b/disobedience/menu.c @@ -352,7 +352,6 @@ GtkWidget *menubar(GtkWidget *w) { (char *)"", /* item_type */ 0 /* extra_data */ }, -#if 0 { (char *)"/Control/Compact mode", /* path */ (char *)"M", /* accelerator */ @@ -361,7 +360,6 @@ GtkWidget *menubar(GtkWidget *w) { (char *)"", /* item_type */ 0 /* extra_data */ }, -#endif { (char *)"/Control/Activate playlist", /* path */ 0, /* accelerator */ diff --git a/disobedience/queue-generic.c b/disobedience/queue-generic.c index 5d44ffa..333187a 100644 --- a/disobedience/queue-generic.c +++ b/disobedience/queue-generic.c @@ -808,7 +808,7 @@ GtkWidget *init_queuelike(struct queuelike *ql) { (ql->columns[n].name, r, "text", n, - "background", ql->ncolumns + BACKGROUND_COLUMN, + "cell-background", ql->ncolumns + BACKGROUND_COLUMN, "foreground", ql->ncolumns + FOREGROUND_COLUMN, (char *)0); gtk_tree_view_column_set_resizable(c, TRUE); diff --git a/disobedience/queue-generic.h b/disobedience/queue-generic.h index efd6400..b774f22 100644 --- a/disobedience/queue-generic.h +++ b/disobedience/queue-generic.h @@ -136,15 +136,8 @@ enum { EXTRA_COLUMNS }; -/* TODO probably need to set "horizontal-separator" to 0, but can't find any - * coherent description of how to set style properties in isolation. */ -#define BG_PLAYING 0 -#define FG_PLAYING 0 - -#ifndef BG_PLAYING -# define BG_PLAYING "#e0ffe0" -# define FG_PLAYING "black" -#endif +#define BG_PLAYING "#e0ffe0" +#define FG_PLAYING "black" extern struct queuelike ql_queue; extern struct queuelike ql_recent;