/** @brief Parsed server version */
long server_version_bytes;
+static GtkWidget *queue;
+
+static GtkWidget *notebook_box;
+
+static int main_current_fullmode = 1;
+
static void check_rtp_address(const char *event,
void *eventdata,
void *callbackdata);
* produces not too dreadful appearance */
gtk_widget_set_style(tabs, tool_style);
g_signal_connect(tabs, "switch-page", G_CALLBACK(tab_switched), 0);
- gtk_notebook_append_page(GTK_NOTEBOOK(tabs), queue_widget(),
+ gtk_notebook_append_page(GTK_NOTEBOOK(tabs), queue = queue_widget(),
gtk_label_new("Queue"));
gtk_notebook_append_page(GTK_NOTEBOOK(tabs), recent_widget(),
gtk_label_new("Recent"));
return tabs;
}
+static void main_minimode(const char attribute((unused)) *event,
+ void attribute((unused)) *evendata,
+ void attribute((unused)) *callbackdata) {
+ if(full_mode == main_current_fullmode)
+ return;
+ if(full_mode) {
+ /* Remove queue from display */
+ g_object_ref(queue);
+ gtk_container_remove(GTK_CONTAINER(notebook_box), queue);
+ /* Add queue to notebook */
+ gtk_notebook_prepend_page(GTK_NOTEBOOK(tabs), queue,
+ gtk_label_new("Queue"));
+ g_object_unref(queue);
+ /* Add notebook to display */
+ gtk_container_add(GTK_CONTAINER(notebook_box), tabs);
+ g_object_unref(tabs);
+ /* Show the queue (bit confusing otherwise!) */
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs), 0);
+ } else {
+ /* Remove notebook from display */
+ g_object_ref(tabs);
+ gtk_container_remove(GTK_CONTAINER(notebook_box), tabs);
+ /* Remove queue from notebook */
+ g_object_ref(queue);
+ gtk_container_remove(GTK_CONTAINER(tabs), queue);
+ /* Add queue to display */
+ gtk_container_add(GTK_CONTAINER(notebook_box), queue);
+ g_object_unref(queue);
+ }
+ main_current_fullmode = full_mode;
+}
+
/** @brief Create and populate the main window */
static void make_toplevel_window(void) {
GtkWidget *const vbox = gtk_vbox_new(FALSE, 1);
FALSE, /* expand */
FALSE, /* fill */
0);
- gtk_container_add(GTK_CONTAINER(vbox), notebook());
+ notebook_box = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(notebook_box), notebook());
+ gtk_container_add(GTK_CONTAINER(vbox), notebook_box);
gtk_box_pack_end(GTK_BOX(vbox),
rb,
FALSE, /* expand */
FALSE, /* fill */
0);
gtk_widget_set_style(toplevel, tool_style);
+ event_register("mini-mode-changed", main_minimode, 0);
}
static void userinfo_rights_completed(void attribute((unused)) *v,
GtkItemFactory *mainmenufactory;
/** @brief Set for full mode, clear for mini mode */
-int full_mode;
+int full_mode = 1;
static void about_popup_got_version(void *v,
const char *err,
static void toggled_minimode(GtkCheckMenuItem *item,
gpointer attribute((unused)) userdata) {
- full_mode = !gtk_check_menu_item_get_active(item);
- event_raise("mini-mode-changed", NULL);
+ int new_full_mode = !gtk_check_menu_item_get_active(item);
+ if(full_mode != new_full_mode) {
+ full_mode = new_full_mode;
+ event_raise("mini-mode-changed", NULL);
+ }
}
/*
break;
if(q) {
disorder_eclient_playing(client, playing_completed, 0);
- disorder_eclient_queue(client, queue_completed, 0);
+ if(full_mode)
+ disorder_eclient_queue(client, queue_completed, 0);
return;
}
}
popup_protocol_error(0, err);
return;
}
- actual_queue = q;
+ if(full_mode)
+ actual_queue = q;
+ else
+ actual_queue = NULL;
queue_playing_changed();
}
void attribute((unused)) *eventdata,
void attribute((unused)) *callbackdata) {
D(("queue_changed"));
+ if(!full_mode)
+ return;
gtk_label_set_text(GTK_LABEL(report_label), "updating queue");
disorder_eclient_queue(client, queue_completed, 0);
}
return FALSE; /* Propagate */
}
+static void queue_minimode(const char attribute((unused)) *event,
+ void attribute((unused)) *evendata,
+ void attribute((unused)) *callbackdata) {
+ if(full_mode) {
+ /* We will need to refetch the queue */
+ disorder_eclient_queue(client, queue_completed, 0);
+ } else {
+ /* We will need to hide the queue */
+ if(actual_queue)
+ queue_completed(NULL, NULL, NULL);
+ }
+}
+
GtkWidget *queue_widget(void) {
GtkWidget *const w = init_queuelike(&ql_queue);
/* Catch keypresses */
g_signal_connect(ql_queue.view, "key-press-event",
G_CALLBACK(queue_key_press), &ql_queue);
+
+ event_register("mini-mode-changed", queue_minimode, 0);
return w;
}