chiark / gitweb /
Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/disorder
[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"
e1e3ef08 45#include "home.h"
460b9539 46#include "selection.h"
53fa91bb 47#include "kvp.h"
3569ddb8 48#include "eventdist.h"
6856f665 49#include "split.h"
9eeb9f12 50#include "timeval.h"
b50cfb8a 51#include "uaudio.h"
a2364abb 52#include "inputline.h"
460b9539 53
54#include <glib.h>
55#include <gtk/gtk.h>
56#include <gdk-pixbuf/gdk-pixbuf.h>
453bdfe0 57#include <gdk/gdkkeysyms.h>
460b9539 58
59/* Types ------------------------------------------------------------------- */
60
61struct queuelike;
62struct choosenode;
c3df9503 63struct progress_window;
460b9539 64
2c348789
RK
65/** @brief Per-tab callbacks
66 *
67 * Some of the options in the main menu depend on which tab is displayed, so we
68 * have some callbacks to set them appropriately.
69 */
460b9539 70struct tabtype {
ee7552f8
RK
71 int (*properties_sensitive)(void *extra);
72 int (*selectall_sensitive)(void *extra);
73 int (*selectnone_sensitive)(void *extra);
6982880f
RK
74 void (*properties_activate)(GtkMenuItem *menuitem,
75 gpointer user_data);
76 void (*selectall_activate)(GtkMenuItem *menuitem,
77 gpointer user_data);
78 void (*selectnone_activate)(GtkMenuItem *menuitem,
79 gpointer user_data);
2a3fe554 80 void (*selected)(void);
ee7552f8 81 void *extra;
460b9539 82};
83
73f1b9f3
RK
84/** @brief Button definitions */
85struct button {
86 const gchar *stock;
87 void (*clicked)(GtkButton *button, gpointer userdata);
88 const char *tip;
f44417cf 89 GtkWidget *widget;
ad424400
RK
90 void (*pack)(GtkBox *box,
91 GtkWidget *child,
92 gboolean expand,
93 gboolean fill,
94 guint padding);
73f1b9f3
RK
95};
96
460b9539 97/* Variables --------------------------------------------------------------- */
98
99extern GMainLoop *mainloop;
100extern GtkWidget *toplevel; /* top level window */
101extern GtkWidget *report_label; /* label for progress indicator */
102extern GtkWidget *tabs; /* main tabs */
103extern disorder_eclient *client; /* main client */
104
105extern unsigned long last_state; /* last reported state */
6f09d54d 106extern rights_type last_rights; /* last reported rights bitmap */
460b9539 107extern int playing; /* true if playing some track */
108extern int volume_l, volume_r; /* current volume */
109extern double goesupto; /* volume upper bound */
110extern int choosealpha; /* break up choose by letter */
a99c4e9a
RK
111extern int rtp_supported;
112extern int rtp_is_running;
ac6bf2ba 113extern GtkItemFactory *mainmenufactory;
460b9539 114
10e226b3
RK
115extern const disorder_eclient_log_callbacks log_callbacks;
116
460b9539 117/* Functions --------------------------------------------------------------- */
118
119disorder_eclient *gtkclient(void);
120/* Configure C for use in GTK+ programs */
121
122void popup_protocol_error(int code,
123 const char *msg);
124/* Report an error */
125
d8b71e03
RK
126void properties(int ntracks, const char **tracks,
127 GtkWidget *parent);
460b9539 128/* Pop up a properties window for a list of tracks */
129
d4ef4132 130GtkWidget *scroll_widget(GtkWidget *child);
460b9539 131/* Wrap a widget up for scrolling */
132
e18c4734
RK
133GtkWidget *frame_widget(GtkWidget *w, const char *title);
134
460b9539 135GdkPixbuf *find_image(const char *name);
136/* Get the pixbuf for an image. Returns a null pointer if it cannot be
137 * found. */
138
043d60b1 139void popup_msg(GtkMessageType mt, const char *msg);
34239ce4 140void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
460b9539 141
043d60b1 142void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
73f1b9f3 143
d8b71e03
RK
144struct progress_window *progress_window_new(const char *title,
145 GtkWidget *parent);
c3df9503
RK
146/* Pop up a progress window */
147
148void progress_window_progress(struct progress_window *pw,
149 int progress,
150 int limit);
151/* Report current progress */
152
fcc8b9f7
RK
153GtkWidget *iconbutton(const char *path, const char *tip);
154
f44417cf 155GtkWidget *create_buttons(struct button *buttons,
73f1b9f3 156 size_t nbuttons);
f44417cf 157GtkWidget *create_buttons_box(struct button *buttons,
ffc4dbaf
RK
158 size_t nbuttons,
159 GtkWidget *box);
73f1b9f3 160
7c30fc75 161void logged_in(void);
73f1b9f3 162
10e226b3
RK
163void all_update(void);
164/* Update everything */
460b9539 165
166/* Main menu */
167
168GtkWidget *menubar(GtkWidget *w);
169/* Create the menu bar */
5f624bae 170extern int full_mode;
460b9539 171
c73bd6c1 172void users_set_sensitive(int sensitive);
460b9539 173
174/* Controls */
175
176GtkWidget *control_widget(void);
177/* Make the controls widget */
178
fb44b59e
RK
179extern int suppress_actions;
180
4eb1f430 181/* Queue/Recent/Added */
460b9539 182
183GtkWidget *queue_widget(void);
68be70c0 184GtkWidget *playing_widget(void);
460b9539 185GtkWidget *recent_widget(void);
4eb1f430
RK
186GtkWidget *added_widget(void);
187/* Create widgets for displaying the queue, the recently played list and the
188 * newly added tracks list */
460b9539 189
460b9539 190void queue_select_all(struct queuelike *ql);
fb009628
RK
191void queue_select_none(struct queuelike *ql);
192/* Select all/none on some queue */
460b9539 193
194void queue_properties(struct queuelike *ql);
195/* Pop up properties of selected items in some queue */
196
460b9539 197int queued(const char *track);
198/* Return nonzero iff TRACK is queued or playing */
199
ad47bd4c
RK
200extern struct queue_entry *playing_track;
201
202/* Lookups */
203const char *namepart(const char *track,
204 const char *context,
205 const char *part);
206long namepart_length(const char *track);
68110302 207char *namepart_resolve(const char *track);
ad47bd4c 208
460b9539 209void namepart_update(const char *track,
210 const char *context,
211 const char *part);
212/* Called when a namepart might have changed */
213
460b9539 214/* Choose */
215
216GtkWidget *choose_widget(void);
217/* Create a widget for choosing tracks */
218
219void choose_update(void);
220/* Called when we think the choose tree might need updating */
221
53fa91bb 222void play_completed(void *v,
e2717131 223 const char *err);
53fa91bb 224
a6712ea8
RK
225extern const GtkTargetEntry choose_targets[];
226
a99c4e9a
RK
227/* Login details */
228
73f1b9f3
RK
229void login_box(void);
230
5f624bae 231extern GtkWidget *login_window;
e9e8a16d 232
ffc4dbaf
RK
233/* User management */
234
235void manage_users(void);
236
13affe66
RK
237/* Help */
238
ad424400 239void popup_help(const char *what);
13affe66 240
7791f6cf
RK
241/* Filtering */
242
e5cce183
RK
243void popup_globals(void);
244void globals_init(void);
7791f6cf 245
a99c4e9a
RK
246/* RTP */
247
248int rtp_running(void);
249void start_rtp(void);
250void stop_rtp(void);
a2364abb
RK
251void load_rtp_config(void);
252void save_rtp_config(void);
253void change_rtp_api(const char *api);
5f624bae 254extern const char *rtp_api;
af21fb6b
MW
255int rtp_setvol(int *l, int *r);
256int rtp_getvol(int *l, int *r);
a99c4e9a 257
f486ea18 258/* Settings */
d4ef4132 259
33288048
RK
260void init_styles(void);
261extern GtkStyle *layout_style;
262extern GtkStyle *title_style;
263extern GtkStyle *even_style;
264extern GtkStyle *odd_style;
265extern GtkStyle *active_style;
266extern GtkStyle *tool_style;
267extern GtkStyle *search_style;
268extern GtkStyle *drag_style;
d4ef4132 269
f486ea18
RK
270extern const char *browser;
271
272void save_settings(void);
273void load_settings(void);
d4ef4132 274void set_tool_colors(GtkWidget *w);
46fb1b05 275void popup_settings(void);
d4ef4132 276
fc36ecb7
RK
277/* Playlists */
278
279void playlists_init(void);
f06a754c
RK
280void playlist_window_create(gpointer callback_data,
281 guint callback_action,
282 GtkWidget *menu_item);
fc36ecb7
RK
283extern char **playlists;
284extern int nplaylists;
fdea9f40 285extern GtkWidget *menu_playlists_widget;
f9b20469 286extern GtkWidget *playlists_menu;
fdea9f40 287extern GtkWidget *menu_editplaylists_widget;
fc36ecb7 288
460b9539 289#endif /* DISOBEDIENCE_H */
290
291/*
292Local Variables:
293c-basic-offset:2
294comment-column:40
295fill-column:79
296indent-tabs-mode:nil
297End:
298*/