2 * This file is part of DisOrder
3 * Copyright (C) 2006-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 #ifndef QUEUE_GENERIC_H
21 #define QUEUE_GENERIC_H
23 /** @brief Definition of a column */
25 /** @brief Column name */
28 /** @brief Compute value for this column */
29 const char *(*value
)(const struct queue_entry
*q
,
32 /** @brief Passed to value() */
35 /** @brief Flags word */
39 /** @brief Ellipsize column if too wide */
40 #define COL_ELLIPSIZE 0x0001
42 /** @brief Set expand property */
43 #define COL_EXPAND 0x0002
45 /** @brief Right-algin column */
46 #define COL_RIGHT 0x0004
48 /** @brief An item in the queue's popup menu */
49 struct queue_menuitem
{
50 /** @brief Menu item name */
53 /** @brief Called to activate the menu item */
54 void (*activate
)(GtkMenuItem
*menuitem
,
57 /** @brief Called to determine whether the menu item is usable.
59 * Returns @c TRUE if it should be sensitive and @c FALSE otherwise.
61 int (*sensitive
)(struct queuelike
*ql
);
63 /** @brief Signal handler ID */
66 /** @brief Widget for menu item */
70 /** @brief Definition of a queue-like window */
73 /* Things filled in by the caller: */
75 /** @brief Initialization function */
79 const struct queue_column
*columns
;
81 /** @brief Number of columns in this queuelike */
84 /** @brief Items for popup menu */
85 struct queue_menuitem
*menuitems
;
87 /** @brief Number of menu items */
92 /** @brief The head of the queue */
93 struct queue_entry
*q
;
95 /* Things created by the implementation: */
97 /** @brief The list store */
100 /** @brief The tree view */
103 /** @brief The selection */
104 GtkTreeSelection
*selection
;
106 /** @brief The popup menu */
110 extern struct queuelike ql_queue
;
111 extern struct queuelike ql_recent
;
112 extern struct queuelike ql_added
;
114 extern time_t last_playing
;
116 int ql_selectall_sensitive(struct queuelike
*ql
);
117 void ql_selectall_activate(GtkMenuItem
*menuitem
,
119 int ql_selectnone_sensitive(struct queuelike
*ql
);
120 void ql_selectnone_activate(GtkMenuItem
*menuitem
,
122 int ql_properties_sensitive(struct queuelike
*ql
);
123 void ql_properties_activate(GtkMenuItem
*menuitem
,
125 int ql_scratch_sensitive(struct queuelike
*ql
);
126 void ql_scratch_activate(GtkMenuItem
*menuitem
,
128 int ql_remove_sensitive(struct queuelike
*ql
);
129 void ql_remove_activate(GtkMenuItem
*menuitem
,
131 int ql_play_sensitive(struct queuelike
*ql
);
132 void ql_play_activate(GtkMenuItem
*menuitem
,
134 gboolean
ql_button_release(GtkWidget
*widget
,
135 GdkEventButton
*event
,
137 GtkWidget
*init_queuelike(struct queuelike
*ql
);
138 void ql_update_list_store(struct queuelike
*ql
) ;
139 void ql_update_row(struct queue_entry
*q
,
141 void ql_new_queue(struct queuelike
*ql
,
142 struct queue_entry
*newq
);
143 const char *column_when(const struct queue_entry
*q
,
145 const char *column_who(const struct queue_entry
*q
,
147 const char *column_namepart(const struct queue_entry
*q
,
149 const char *column_length(const struct queue_entry
*q
,
152 #endif /* QUEUE_GENERIC_H */