2 * This file is part of DisOrder
3 * Copyright (C) 2006-2009 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 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU 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, see <http://www.gnu.org/licenses/>.
18 /** @file disobedience/queue-generic.h
19 * @brief Disobedience queue widgets
21 #ifndef QUEUE_GENERIC_H
22 #define QUEUE_GENERIC_H
24 /** @brief Definition of a column */
26 /** @brief Column name */
29 /** @brief Compute value for this column */
30 const char *(*value)(const struct queue_entry *q,
33 /** @brief Passed to value() */
36 /** @brief Flags word */
40 /** @brief Ellipsize column if too wide */
41 #define COL_ELLIPSIZE 0x0001
43 /** @brief Set expand property */
44 #define COL_EXPAND 0x0002
46 /** @brief Right-algin column */
47 #define COL_RIGHT 0x0004
49 /** @brief Definition of a queue-like window */
52 /* Things filled in by the caller: */
54 /** @brief Name for this tab */
57 /** @brief Initialization function */
58 void (*init)(struct queuelike *ql);
61 const struct queue_column *columns;
63 /** @brief Number of columns in this queuelike */
66 /** @brief Items for popup menu */
67 struct menuitem *menuitems;
69 /** @brief Number of menu items */
74 /** @brief The head of the queue */
75 struct queue_entry *q;
77 /* Things created by the implementation: */
79 /** @brief The list store */
82 /** @brief The tree view */
85 /** @brief The selection */
86 GtkTreeSelection *selection;
88 /** @brief The popup menu */
91 /** @brief Menu callbacks */
92 struct tabtype tabtype;
94 /** @brief Drag-drop callback, or NULL for no drag+drop
95 * @param ql Owning queuelike
96 * @param ntracks Number of tracks to be dropped
97 * @param tracks List of track names
98 * @param ids List of track IDs
99 * @param after_me Drop after this or NULL to drop at head
101 * If the rearrangement is impossible then the displayed queue must be put
104 void (*drop)(struct queuelike *ql, int ntracks, char **tracks, char **ids,
105 struct queue_entry *after_me);
107 /** @brief Source target list */
108 const GtkTargetEntry *drag_source_targets;
110 /** @brief Drag source actions */
111 GdkDragAction drag_source_actions;
113 /** @brief Destination target list */
114 const GtkTargetEntry *drag_dest_targets;
116 /** @brief Drag destination actions */
117 GdkDragAction drag_dest_actions;
127 #define PLAYABLE_TRACKS (char *)"text/x-disorder-playable-tracks"
128 #define QUEUED_TRACKS (char *)"text/x-disorder-queued-tracks"
129 #define PLAYLIST_TRACKS (char *)"text/x-disorder-playlist-tracks"
139 #define BG_PLAYING "#e0ffe0"
140 #define FG_PLAYING "black"
142 extern struct queuelike ql_queue;
143 extern struct queuelike ql_recent;
144 extern struct queuelike ql_added;
146 extern time_t last_playing;
148 int ql_selectall_sensitive(void *extra);
149 void ql_selectall_activate(GtkMenuItem *menuitem,
151 int ql_selectnone_sensitive(void *extra);
152 void ql_selectnone_activate(GtkMenuItem *menuitem,
154 int ql_properties_sensitive(void *extra);
155 void ql_properties_activate(GtkMenuItem *menuitem,
157 int ql_scratch_sensitive(void *extra);
158 void ql_scratch_activate(GtkMenuItem *menuitem,
160 int ql_remove_sensitive(void *extra);
161 void ql_remove_activate(GtkMenuItem *menuitem,
163 int ql_play_sensitive(void *extra);
164 void ql_play_activate(GtkMenuItem *menuitem,
166 int ql_adopt_sensitive(void *extra);
167 void ql_adopt_activate(GtkMenuItem *menuitem,
169 gboolean ql_button_release(GtkWidget *widget,
170 GdkEventButton *event,
172 GtkWidget *init_queuelike(struct queuelike *ql);
173 void destroy_queuelike(struct queuelike *ql);
174 void ql_update_list_store(struct queuelike *ql) ;
175 void ql_update_row(struct queue_entry *q,
177 void ql_new_queue(struct queuelike *ql,
178 struct queue_entry *newq);
179 const char *column_when(const struct queue_entry *q,
181 const char *column_who(const struct queue_entry *q,
183 const char *column_namepart(const struct queue_entry *q,
185 const char *column_length(const struct queue_entry *q,
187 struct tabtype *ql_tabtype(struct queuelike *ql);
188 struct queue_entry *ql_iter_to_q(GtkTreeModel *model,
190 struct queue_entry *ql_path_to_q(GtkTreeModel *model,
193 #endif /* QUEUE_GENERIC_H */