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