shift+ctrl+a accelerator the Gimp uses for this operation.
** Disobedience
A bug which would cause a crash if you attempt to rearrange the queue
-while no rtack was playing has been fixed.
+while no rtack was playing has been fixed. There is a new 'deselect all
+tracks' option, mirroring 'select all tracks.
* Changes up to version 2.0
/*
* This file is part of DisOrder
- * Copyright (C) 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2006-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return FALSE;
}
+/** @brief Determine whether the edit menu's select none option should be sensitive
+ *
+ * TODO not implemented, see also choose_selectnone_activate()
+ */
+static int choose_selectnone_sensitive(GtkWidget attribute((unused)) *w) {
+ return FALSE;
+}
+
/** @brief Called when the edit menu's properties option is activated */
static void choose_properties_activate(GtkWidget attribute((unused)) *w) {
activate_track_properties(0, 0);
static void choose_selectall_activate(GtkWidget attribute((unused)) *w) {
}
+/** @brief Called when the edit menu's select none option is activated
+ *
+ * TODO not implemented, see choose_selectnone_sensitive() */
+static void choose_selectnone_activate(GtkWidget attribute((unused)) *w) {
+}
+
/** @brief Main menu callbacks for Choose screen */
static const struct tabtype tabtype_choose = {
choose_properties_sensitive,
choose_selectall_sensitive,
+ choose_selectnone_sensitive,
choose_properties_activate,
choose_selectall_activate,
+ choose_selectnone_activate,
};
/* Public entry points ----------------------------------------------------- */
/*
* This file is part of DisOrder.
- * Copyright (C) 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2006-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
struct tabtype {
int (*properties_sensitive)(GtkWidget *tab);
int (*selectall_sensitive)(GtkWidget *tab);
+ int (*selectnone_sensitive)(GtkWidget *tab);
void (*properties_activate)(GtkWidget *tab);
void (*selectall_activate)(GtkWidget *tab);
+ void (*selectnone_activate)(GtkWidget *tab);
};
/** @brief Button definitions */
* changed */
void queue_select_all(struct queuelike *ql);
-/* Select all on some queue */
+void queue_select_none(struct queuelike *ql);
+/* Select all/none on some queue */
void queue_properties(struct queuelike *ql);
/* Pop up properties of selected items in some queue */
/*
* This file is part of DisOrder.
- * Copyright (C) 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2006-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "disobedience.h"
static GtkWidget *selectall_widget;
+static GtkWidget *selectnone_widget;
static GtkWidget *properties_widget;
/** @brief Main menu widgets */
t->selectall_activate(tab);
}
+/** @brief Called when the select none option is activated
+ *
+ * Calls the per-tab select none function.
+ */
+static void select_none(gpointer attribute((unused)) callback_data,
+ guint attribute((unused)) callback_action,
+ GtkWidget attribute((unused)) *menu_item) {
+ GtkWidget *tab = gtk_notebook_get_nth_page
+ (GTK_NOTEBOOK(tabs), gtk_notebook_current_page(GTK_NOTEBOOK(tabs)));
+ const struct tabtype *t = g_object_get_data(G_OBJECT(tab), "type");
+
+ t->selectnone_activate(tab);
+}
+
/** @brief Called when the track properties option is activated
*
* Calls the per-tab properties function.
&& (disorder_eclient_state(client) & DISORDER_CONNECTED)));
gtk_widget_set_sensitive(selectall_widget,
t->selectall_sensitive(tab));
+ gtk_widget_set_sensitive(selectnone_widget,
+ t->selectnone_sensitive(tab));
}
/** @brief Fetch version in order to display the about... popup */
0, /* item_type */
0 /* extra_data */
},
+ {
+ (char *)"/Edit/Deselect all tracks", /* path */
+ (char *)"<CTRL><SHIFT>A", /* accelerator */
+ select_none, /* callback */
+ 0, /* callback_action */
+ 0, /* item_type */
+ 0 /* extra_data */
+ },
{
(char *)"/Edit/Track properties", /* path */
0, /* accelerator */
gtk_window_add_accel_group(GTK_WINDOW(w), accel);
selectall_widget = gtk_item_factory_get_widget(mainmenufactory,
"<GdisorderMain>/Edit/Select all tracks");
+ selectnone_widget = gtk_item_factory_get_widget(mainmenufactory,
+ "<GdisorderMain>/Edit/Deselect all tracks");
properties_widget = gtk_item_factory_get_widget(mainmenufactory,
"<GdisorderMain>/Edit/Track properties");
assert(selectall_widget != 0);
+ assert(selectnone_widget != 0);
assert(properties_widget != 0);
m = gtk_item_factory_get_widget(mainmenufactory,
"<GdisorderMain>");
/*
* This file is part of DisOrder
- * Copyright (C) 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2006-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
set_widget_states(ql);
}
+/** @brief Deselect all entries in a queue */
+void queue_select_none(struct queuelike *ql) {
+ struct queue_entry *qq;
+
+ for(qq = ql->q; qq; qq = qq->next)
+ selection_set(ql->selection, qq->id, 0);
+ ql->last_click = 0;
+ set_widget_states(ql);
+}
+
/** @brief Pop up properties for selected tracks */
void queue_properties(struct queuelike *ql) {
struct vector v;
queue_select_all(mii->ql);
}
+/** @brief Determine whether the select none menu option should be sensitive */
+static int selectnone_sensitive(struct queuelike *ql,
+ struct queue_menuitem attribute((unused)) *m,
+ struct queue_entry attribute((unused)) *q) {
+ /* Sensitive if there is anything selected */
+ return hash_count(ql->selection) != 0;
+}
+
+/** @brief Select no tracks */
+static void selectnone_activate(GtkMenuItem attribute((unused)) *menuitem,
+ gpointer user_data) {
+ const struct menuiteminfo *mii = user_data;
+ queue_select_none(mii->ql);
+}
+
/** @brief Determine whether the play menu option should be sensitive */
static int play_sensitive(struct queuelike *ql,
struct queue_menuitem attribute((unused)) *m,
static struct queue_menuitem queue_menu[] = {
{ "Track properties", properties_activate, properties_sensitive, 0, 0 },
{ "Select all tracks", selectall_activate, selectall_sensitive, 0, 0 },
+ { "Deselect all tracks", selectnone_activate, selectnone_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 queue_menuitem recent_menu[] = {
{ "Track properties", properties_activate, properties_sensitive,0, 0 },
{ "Select all tracks", selectall_activate, selectall_sensitive, 0, 0 },
+ { "Deselect all tracks", selectnone_activate, selectnone_sensitive, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
{ "Track properties", properties_activate, properties_sensitive, 0, 0 },
{ "Play track", play_activate, play_sensitive, 0, 0 },
{ "Select all tracks", selectall_activate, selectall_sensitive, 0, 0 },
+ { "Deselect all tracks", selectnone_activate, selectnone_sensitive, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
return !!queue_count_entries(g_object_get_data(G_OBJECT(w), "queue"));
}
+static int queue_selectnone_sensitive(GtkWidget *w) {
+ struct queuelike *const ql = g_object_get_data(G_OBJECT(w), "queue");
+
+ return hash_count(ql->selection) != 0;
+}
+
static void queue_properties_activate(GtkWidget *w) {
queue_properties(g_object_get_data(G_OBJECT(w), "queue"));
}
queue_select_all(g_object_get_data(G_OBJECT(w), "queue"));
}
+static void queue_selectnone_activate(GtkWidget *w) {
+ queue_select_none(g_object_get_data(G_OBJECT(w), "queue"));
+}
+
static const struct tabtype tabtype_queue = {
queue_properties_sensitive,
queue_selectall_sensitive,
+ queue_selectnone_sensitive,
queue_properties_activate,
queue_selectall_activate,
+ queue_selectnone_activate,
};
/* Other entry points ------------------------------------------------------ */