chiark / gitweb /
Use a cards image for 'random' icon
[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;
ad424400
RK
88 void (*pack)(GtkBox *box,
89 GtkWidget *child,
90 gboolean expand,
91 gboolean fill,
92 guint padding);
73f1b9f3
RK
93};
94
460b9539 95/* Variables --------------------------------------------------------------- */
96
97extern GMainLoop *mainloop;
98extern GtkWidget *toplevel; /* top level window */
99extern GtkWidget *report_label; /* label for progress indicator */
100extern GtkWidget *tabs; /* main tabs */
101extern disorder_eclient *client; /* main client */
102
103extern unsigned long last_state; /* last reported state */
6f09d54d 104extern rights_type last_rights; /* last reported rights bitmap */
460b9539 105extern int playing; /* true if playing some track */
106extern int volume_l, volume_r; /* current volume */
107extern double goesupto; /* volume upper bound */
108extern int choosealpha; /* break up choose by letter */
a99c4e9a
RK
109extern int rtp_supported;
110extern int rtp_is_running;
ac6bf2ba 111extern GtkItemFactory *mainmenufactory;
b50cfb8a 112extern const struct uaudio *backend;
460b9539 113
10e226b3
RK
114extern const disorder_eclient_log_callbacks log_callbacks;
115
460b9539 116/* Functions --------------------------------------------------------------- */
117
118disorder_eclient *gtkclient(void);
119/* Configure C for use in GTK+ programs */
120
121void popup_protocol_error(int code,
122 const char *msg);
123/* Report an error */
124
d8b71e03
RK
125void properties(int ntracks, const char **tracks,
126 GtkWidget *parent);
460b9539 127/* Pop up a properties window for a list of tracks */
128
d4ef4132 129GtkWidget *scroll_widget(GtkWidget *child);
460b9539 130/* Wrap a widget up for scrolling */
131
e18c4734
RK
132GtkWidget *frame_widget(GtkWidget *w, const char *title);
133
460b9539 134GdkPixbuf *find_image(const char *name);
135/* Get the pixbuf for an image. Returns a null pointer if it cannot be
136 * found. */
137
043d60b1 138void popup_msg(GtkMessageType mt, const char *msg);
34239ce4 139void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
460b9539 140
043d60b1 141void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
73f1b9f3 142
d8b71e03
RK
143struct progress_window *progress_window_new(const char *title,
144 GtkWidget *parent);
c3df9503
RK
145/* Pop up a progress window */
146
147void progress_window_progress(struct progress_window *pw,
148 int progress,
149 int limit);
150/* Report current progress */
151
fcc8b9f7
RK
152GtkWidget *iconbutton(const char *path, const char *tip);
153
f44417cf 154GtkWidget *create_buttons(struct button *buttons,
73f1b9f3 155 size_t nbuttons);
f44417cf 156GtkWidget *create_buttons_box(struct button *buttons,
ffc4dbaf
RK
157 size_t nbuttons,
158 GtkWidget *box);
73f1b9f3 159
7c30fc75 160void logged_in(void);
73f1b9f3 161
10e226b3
RK
162void all_update(void);
163/* Update everything */
460b9539 164
165/* Main menu */
166
167GtkWidget *menubar(GtkWidget *w);
168/* Create the menu bar */
96295b25 169int full_mode;
460b9539 170
c73bd6c1 171void users_set_sensitive(int sensitive);
460b9539 172
173/* Controls */
174
175GtkWidget *control_widget(void);
176/* Make the controls widget */
177
fb44b59e
RK
178extern int suppress_actions;
179
4eb1f430 180/* Queue/Recent/Added */
460b9539 181
182GtkWidget *queue_widget(void);
68be70c0 183GtkWidget *playing_widget(void);
460b9539 184GtkWidget *recent_widget(void);
4eb1f430
RK
185GtkWidget *added_widget(void);
186/* Create widgets for displaying the queue, the recently played list and the
187 * newly added tracks list */
460b9539 188
460b9539 189void queue_select_all(struct queuelike *ql);
fb009628
RK
190void queue_select_none(struct queuelike *ql);
191/* Select all/none on some queue */
460b9539 192
193void queue_properties(struct queuelike *ql);
194/* Pop up properties of selected items in some queue */
195
460b9539 196int queued(const char *track);
197/* Return nonzero iff TRACK is queued or playing */
198
ad47bd4c
RK
199extern struct queue_entry *playing_track;
200
201/* Lookups */
202const char *namepart(const char *track,
203 const char *context,
204 const char *part);
205long namepart_length(const char *track);
68110302 206char *namepart_resolve(const char *track);
ad47bd4c 207
460b9539 208void namepart_update(const char *track,
209 const char *context,
210 const char *part);
211/* Called when a namepart might have changed */
212
460b9539 213/* Choose */
214
215GtkWidget *choose_widget(void);
216/* Create a widget for choosing tracks */
217
218void choose_update(void);
219/* Called when we think the choose tree might need updating */
220
53fa91bb 221void play_completed(void *v,
e2717131 222 const char *err);
53fa91bb 223
a6712ea8
RK
224extern const GtkTargetEntry choose_targets[];
225
a99c4e9a
RK
226/* Login details */
227
73f1b9f3
RK
228void login_box(void);
229
e9e8a16d
RK
230GtkWidget *login_window;
231
ffc4dbaf
RK
232/* User management */
233
234void manage_users(void);
235
13affe66
RK
236/* Help */
237
ad424400 238void popup_help(const char *what);
13affe66 239
a99c4e9a
RK
240/* RTP */
241
242int rtp_running(void);
243void start_rtp(void);
244void stop_rtp(void);
245
f486ea18 246/* Settings */
d4ef4132 247
33288048
RK
248void init_styles(void);
249extern GtkStyle *layout_style;
250extern GtkStyle *title_style;
251extern GtkStyle *even_style;
252extern GtkStyle *odd_style;
253extern GtkStyle *active_style;
254extern GtkStyle *tool_style;
255extern GtkStyle *search_style;
256extern GtkStyle *drag_style;
d4ef4132 257
f486ea18
RK
258extern const char *browser;
259
260void save_settings(void);
261void load_settings(void);
d4ef4132 262void set_tool_colors(GtkWidget *w);
46fb1b05 263void popup_settings(void);
d4ef4132 264
fc36ecb7
RK
265/* Playlists */
266
267void playlists_init(void);
f06a754c
RK
268void playlist_window_create(gpointer callback_data,
269 guint callback_action,
270 GtkWidget *menu_item);
fc36ecb7
RK
271extern char **playlists;
272extern int nplaylists;
fdea9f40 273extern GtkWidget *menu_playlists_widget;
f9b20469 274extern GtkWidget *playlists_menu;
fdea9f40 275extern GtkWidget *menu_editplaylists_widget;
fc36ecb7 276
460b9539 277#endif /* DISOBEDIENCE_H */
278
279/*
280Local Variables:
281c-basic-offset:2
282comment-column:40
283fill-column:79
284indent-tabs-mode:nil
285End:
286*/