2 * This file is part of DisOrder
3 * Copyright (C) 2008 Richard Kettlewell
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 #include "disobedience.h"
24 /** @brief Popup menu */
25 static GtkWidget *choose_menu;
27 static int choose_selectall_sensitive(void attribute((unused)) *extra) {
31 static void choose_selectall_activate(GtkMenuItem attribute((unused)) *item,
32 gpointer attribute((unused)) userdata) {
33 gtk_tree_selection_select_all(choose_selection);
36 static int choose_selectnone_sensitive(void attribute((unused)) *extra) {
37 return gtk_tree_selection_count_selected_rows(choose_selection) > 0;
40 static void choose_selectnone_activate(GtkMenuItem attribute((unused)) *item,
41 gpointer attribute((unused)) userdata) {
42 gtk_tree_selection_unselect_all(choose_selection);
45 static int choose_play_sensitive(void attribute((unused)) *extra) {
46 return FALSE; /* TODO */
49 static void choose_play_activate(GtkMenuItem attribute((unused)) *item,
50 gpointer attribute((unused)) userdata) {
54 static int choose_properties_sensitive(void attribute((unused)) *extra) {
55 return FALSE; /* TODO */
58 static void choose_properties_activate(GtkMenuItem attribute((unused)) *item,
59 gpointer attribute((unused)) userdata) {
63 /** @brief Pop-up menu for choose */
64 static struct menuitem choose_menuitems[] = {
68 choose_play_sensitive,
74 choose_properties_activate,
75 choose_properties_sensitive,
81 choose_selectall_activate,
82 choose_selectall_sensitive,
87 "Deselect all tracks",
88 choose_selectnone_activate,
89 choose_selectnone_sensitive,
95 const struct tabtype choose_tabtype = {
96 choose_properties_sensitive,
97 choose_selectall_sensitive,
98 choose_selectnone_sensitive,
99 choose_properties_activate,
100 choose_selectall_activate,
101 choose_selectnone_activate,
106 /** @brief Called when a mouse button is pressed or released */
107 gboolean choose_button_event(GtkWidget attribute((unused)) *widget,
108 GdkEventButton *event,
109 gpointer attribute((unused)) user_data) {
110 if(event->type == GDK_BUTTON_RELEASE && event->button == 2) {
111 /* Middle click release - play track */
112 //ensure_selected(choose_view, event);
114 } else if(event->type == GDK_BUTTON_PRESS && event->button == 3) {
115 /* Right click press - pop up the menu */
116 ensure_selected(GTK_TREE_VIEW(choose_view), event);
117 popup(&choose_menu, event,
118 choose_menuitems, sizeof choose_menuitems / sizeof *choose_menuitems,