chiark / gitweb /
Improve playlists section of disobedience manual
[disorder] / disobedience / disobedience.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
fb009628 3 * Copyright (C) 2006-2008 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
9 *
e7eb3a27
RK
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.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
2c348789
RK
18/** @file disobedience/disobedience.h
19 * @brief Header file for Disobedience, the DisOrder GTK+ client
20 */
460b9539 21
22#ifndef DISOBEDIENCE_H
23#define DISOBEDIENCE_H
24
05b75f8d 25#include "common.h"
460b9539 26
460b9539 27#include <time.h>
460b9539 28#include <ctype.h>
29#include <errno.h>
30#include <math.h>
31
32#include "mem.h"
33#include "log.h"
34#include "eclient.h"
35#include "printf.h"
36#include "cache.h"
37#include "queue.h"
38#include "printf.h"
39#include "vector.h"
40#include "trackname.h"
41#include "syscalls.h"
42#include "defs.h"
43#include "configuration.h"
44#include "hash.h"
45#include "selection.h"
53fa91bb 46#include "kvp.h"
3569ddb8 47#include "eventdist.h"
6856f665 48#include "split.h"
9eeb9f12 49#include "timeval.h"
b50cfb8a 50#include "uaudio.h"
460b9539 51
52#include <glib.h>
53#include <gtk/gtk.h>
54#include <gdk-pixbuf/gdk-pixbuf.h>
453bdfe0 55#include <gdk/gdkkeysyms.h>
460b9539 56
57/* Types ------------------------------------------------------------------- */
58
59struct queuelike;
60struct choosenode;
c3df9503 61struct progress_window;
460b9539 62
2c348789
RK
63/** @brief Per-tab callbacks
64 *
65 * Some of the options in the main menu depend on which tab is displayed, so we
66 * have some callbacks to set them appropriately.
67 */
460b9539 68struct tabtype {
ee7552f8
RK
69 int (*properties_sensitive)(void *extra);
70 int (*selectall_sensitive)(void *extra);
71 int (*selectnone_sensitive)(void *extra);
6982880f
RK
72 void (*properties_activate)(GtkMenuItem *menuitem,
73 gpointer user_data);
74 void (*selectall_activate)(GtkMenuItem *menuitem,
75 gpointer user_data);
76 void (*selectnone_activate)(GtkMenuItem *menuitem,
77 gpointer user_data);
2a3fe554 78 void (*selected)(void);
ee7552f8 79 void *extra;
460b9539 80};
81
73f1b9f3
RK
82/** @brief Button definitions */
83struct button {
84 const gchar *stock;
85 void (*clicked)(GtkButton *button, gpointer userdata);
86 const char *tip;
f44417cf 87 GtkWidget *widget;
73f1b9f3
RK
88};
89
460b9539 90/* Variables --------------------------------------------------------------- */
91
92extern GMainLoop *mainloop;
93extern GtkWidget *toplevel; /* top level window */
94extern GtkWidget *report_label; /* label for progress indicator */
95extern GtkWidget *tabs; /* main tabs */
96extern disorder_eclient *client; /* main client */
97
98extern unsigned long last_state; /* last reported state */
6f09d54d 99extern rights_type last_rights; /* last reported rights bitmap */
460b9539 100extern int playing; /* true if playing some track */
101extern int volume_l, volume_r; /* current volume */
102extern double goesupto; /* volume upper bound */
103extern int choosealpha; /* break up choose by letter */
a99c4e9a
RK
104extern int rtp_supported;
105extern int rtp_is_running;
ac6bf2ba 106extern GtkItemFactory *mainmenufactory;
b50cfb8a 107extern const struct uaudio *backend;
460b9539 108
10e226b3
RK
109extern const disorder_eclient_log_callbacks log_callbacks;
110
460b9539 111/* Functions --------------------------------------------------------------- */
112
113disorder_eclient *gtkclient(void);
114/* Configure C for use in GTK+ programs */
115
116void popup_protocol_error(int code,
117 const char *msg);
118/* Report an error */
119
d8b71e03
RK
120void properties(int ntracks, const char **tracks,
121 GtkWidget *parent);
460b9539 122/* Pop up a properties window for a list of tracks */
123
d4ef4132 124GtkWidget *scroll_widget(GtkWidget *child);
460b9539 125/* Wrap a widget up for scrolling */
126
e18c4734
RK
127GtkWidget *frame_widget(GtkWidget *w, const char *title);
128
460b9539 129GdkPixbuf *find_image(const char *name);
130/* Get the pixbuf for an image. Returns a null pointer if it cannot be
131 * found. */
132
043d60b1 133void popup_msg(GtkMessageType mt, const char *msg);
34239ce4 134void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
460b9539 135
043d60b1 136void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
73f1b9f3 137
d8b71e03
RK
138struct progress_window *progress_window_new(const char *title,
139 GtkWidget *parent);
c3df9503
RK
140/* Pop up a progress window */
141
142void progress_window_progress(struct progress_window *pw,
143 int progress,
144 int limit);
145/* Report current progress */
146
fcc8b9f7
RK
147GtkWidget *iconbutton(const char *path, const char *tip);
148
f44417cf 149GtkWidget *create_buttons(struct button *buttons,
73f1b9f3 150 size_t nbuttons);
f44417cf 151GtkWidget *create_buttons_box(struct button *buttons,
ffc4dbaf
RK
152 size_t nbuttons,
153 GtkWidget *box);
73f1b9f3 154
7c30fc75 155void logged_in(void);
73f1b9f3 156
10e226b3
RK
157void all_update(void);
158/* Update everything */
460b9539 159
160/* Main menu */
161
162GtkWidget *menubar(GtkWidget *w);
163/* Create the menu bar */
460b9539 164
c73bd6c1 165void users_set_sensitive(int sensitive);
460b9539 166
167/* Controls */
168
169GtkWidget *control_widget(void);
170/* Make the controls widget */
171
fb44b59e
RK
172extern int suppress_actions;
173
4eb1f430 174/* Queue/Recent/Added */
460b9539 175
176GtkWidget *queue_widget(void);
177GtkWidget *recent_widget(void);
4eb1f430
RK
178GtkWidget *added_widget(void);
179/* Create widgets for displaying the queue, the recently played list and the
180 * newly added tracks list */
460b9539 181
460b9539 182void queue_select_all(struct queuelike *ql);
fb009628
RK
183void queue_select_none(struct queuelike *ql);
184/* Select all/none on some queue */
460b9539 185
186void queue_properties(struct queuelike *ql);
187/* Pop up properties of selected items in some queue */
188
460b9539 189int queued(const char *track);
190/* Return nonzero iff TRACK is queued or playing */
191
ad47bd4c
RK
192extern struct queue_entry *playing_track;
193
194/* Lookups */
195const char *namepart(const char *track,
196 const char *context,
197 const char *part);
198long namepart_length(const char *track);
68110302 199char *namepart_resolve(const char *track);
ad47bd4c 200
460b9539 201void namepart_update(const char *track,
202 const char *context,
203 const char *part);
204/* Called when a namepart might have changed */
205
460b9539 206/* Choose */
207
208GtkWidget *choose_widget(void);
209/* Create a widget for choosing tracks */
210
211void choose_update(void);
212/* Called when we think the choose tree might need updating */
213
53fa91bb 214void play_completed(void *v,
e2717131 215 const char *err);
53fa91bb 216
a6712ea8
RK
217extern const GtkTargetEntry choose_targets[];
218
a99c4e9a
RK
219/* Login details */
220
73f1b9f3
RK
221void login_box(void);
222
e9e8a16d
RK
223GtkWidget *login_window;
224
ffc4dbaf
RK
225/* User management */
226
227void manage_users(void);
228
13affe66
RK
229/* Help */
230
231void popup_help(void);
232
a99c4e9a
RK
233/* RTP */
234
235int rtp_running(void);
236void start_rtp(void);
237void stop_rtp(void);
238
f486ea18 239/* Settings */
d4ef4132 240
33288048
RK
241void init_styles(void);
242extern GtkStyle *layout_style;
243extern GtkStyle *title_style;
244extern GtkStyle *even_style;
245extern GtkStyle *odd_style;
246extern GtkStyle *active_style;
247extern GtkStyle *tool_style;
248extern GtkStyle *search_style;
249extern GtkStyle *drag_style;
d4ef4132 250
f486ea18
RK
251extern const char *browser;
252
253void save_settings(void);
254void load_settings(void);
d4ef4132 255void set_tool_colors(GtkWidget *w);
46fb1b05 256void popup_settings(void);
d4ef4132 257
fc36ecb7
RK
258/* Playlists */
259
260void playlists_init(void);
f06a754c
RK
261void playlist_window_create(gpointer callback_data,
262 guint callback_action,
263 GtkWidget *menu_item);
fc36ecb7
RK
264extern char **playlists;
265extern int nplaylists;
fdea9f40 266extern GtkWidget *menu_playlists_widget;
f9b20469 267extern GtkWidget *playlists_menu;
fdea9f40 268extern GtkWidget *menu_editplaylists_widget;
fc36ecb7 269
460b9539 270#endif /* DISOBEDIENCE_H */
271
272/*
273Local Variables:
274c-basic-offset:2
275comment-column:40
276fill-column:79
277indent-tabs-mode:nil
278End:
279*/