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