disobedience/rtp.c: Allow setting a `disorder-playrtp' instance name.
[disorder] / disobedience / disobedience.h
... / ...
CommitLineData
1/*
2 * This file is part of DisOrder.
3 * Copyright (C) 2006-2008 Richard Kettlewell
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 3 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,
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 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18/** @file disobedience/disobedience.h
19 * @brief Header file for Disobedience, the DisOrder GTK+ client
20 */
21
22#ifndef DISOBEDIENCE_H
23#define DISOBEDIENCE_H
24
25#include "common.h"
26
27#include <time.h>
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"
46#include "kvp.h"
47#include "eventdist.h"
48#include "split.h"
49#include "timeval.h"
50#include "uaudio.h"
51#include "inputline.h"
52
53#include <glib.h>
54#include <gtk/gtk.h>
55#include <gdk-pixbuf/gdk-pixbuf.h>
56#include <gdk/gdkkeysyms.h>
57
58/* Types ------------------------------------------------------------------- */
59
60struct queuelike;
61struct choosenode;
62struct progress_window;
63
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 */
69struct tabtype {
70 int (*properties_sensitive)(void *extra);
71 int (*selectall_sensitive)(void *extra);
72 int (*selectnone_sensitive)(void *extra);
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);
79 void (*selected)(void);
80 void *extra;
81};
82
83/** @brief Button definitions */
84struct button {
85 const gchar *stock;
86 void (*clicked)(GtkButton *button, gpointer userdata);
87 const char *tip;
88 GtkWidget *widget;
89 void (*pack)(GtkBox *box,
90 GtkWidget *child,
91 gboolean expand,
92 gboolean fill,
93 guint padding);
94};
95
96/* Variables --------------------------------------------------------------- */
97
98extern GMainLoop *mainloop;
99extern GtkWidget *toplevel; /* top level window */
100extern GtkWidget *report_label; /* label for progress indicator */
101extern GtkWidget *tabs; /* main tabs */
102extern disorder_eclient *client; /* main client */
103
104extern unsigned long last_state; /* last reported state */
105extern rights_type last_rights; /* last reported rights bitmap */
106extern int playing; /* true if playing some track */
107extern int volume_l, volume_r; /* current volume */
108extern double goesupto; /* volume upper bound */
109extern int choosealpha; /* break up choose by letter */
110extern int rtp_supported;
111extern int rtp_is_running;
112extern GtkItemFactory *mainmenufactory;
113
114extern const disorder_eclient_log_callbacks log_callbacks;
115
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
125void properties(int ntracks, const char **tracks,
126 GtkWidget *parent);
127/* Pop up a properties window for a list of tracks */
128
129GtkWidget *scroll_widget(GtkWidget *child);
130/* Wrap a widget up for scrolling */
131
132GtkWidget *frame_widget(GtkWidget *w, const char *title);
133
134GdkPixbuf *find_image(const char *name);
135/* Get the pixbuf for an image. Returns a null pointer if it cannot be
136 * found. */
137
138void popup_msg(GtkMessageType mt, const char *msg);
139void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
140
141void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
142
143struct progress_window *progress_window_new(const char *title,
144 GtkWidget *parent);
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
152GtkWidget *iconbutton(const char *path, const char *tip);
153
154GtkWidget *create_buttons(struct button *buttons,
155 size_t nbuttons);
156GtkWidget *create_buttons_box(struct button *buttons,
157 size_t nbuttons,
158 GtkWidget *box);
159
160void logged_in(void);
161
162void all_update(void);
163/* Update everything */
164
165/* Main menu */
166
167GtkWidget *menubar(GtkWidget *w);
168/* Create the menu bar */
169int full_mode;
170
171void users_set_sensitive(int sensitive);
172
173/* Controls */
174
175GtkWidget *control_widget(void);
176/* Make the controls widget */
177
178extern int suppress_actions;
179
180/* Queue/Recent/Added */
181
182GtkWidget *queue_widget(void);
183GtkWidget *playing_widget(void);
184GtkWidget *recent_widget(void);
185GtkWidget *added_widget(void);
186/* Create widgets for displaying the queue, the recently played list and the
187 * newly added tracks list */
188
189void queue_select_all(struct queuelike *ql);
190void queue_select_none(struct queuelike *ql);
191/* Select all/none on some queue */
192
193void queue_properties(struct queuelike *ql);
194/* Pop up properties of selected items in some queue */
195
196int queued(const char *track);
197/* Return nonzero iff TRACK is queued or playing */
198
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);
206char *namepart_resolve(const char *track);
207
208void namepart_update(const char *track,
209 const char *context,
210 const char *part);
211/* Called when a namepart might have changed */
212
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
221void play_completed(void *v,
222 const char *err);
223
224extern const GtkTargetEntry choose_targets[];
225
226/* Login details */
227
228void login_box(void);
229
230GtkWidget *login_window;
231
232/* User management */
233
234void manage_users(void);
235
236/* Help */
237
238void popup_help(const char *what);
239
240/* Filtering */
241
242void popup_globals(void);
243void globals_init(void);
244
245/* RTP */
246
247int rtp_running(void);
248void start_rtp(void);
249void stop_rtp(void);
250void load_rtp_config(void);
251void save_rtp_config(void);
252void change_rtp_api(const char *api);
253const char *rtp_api;
254int rtp_setvol(int *l, int *r);
255int rtp_getvol(int *l, int *r);
256
257/* Settings */
258
259void init_styles(void);
260extern GtkStyle *layout_style;
261extern GtkStyle *title_style;
262extern GtkStyle *even_style;
263extern GtkStyle *odd_style;
264extern GtkStyle *active_style;
265extern GtkStyle *tool_style;
266extern GtkStyle *search_style;
267extern GtkStyle *drag_style;
268
269extern const char *browser;
270
271void save_settings(void);
272void load_settings(void);
273void set_tool_colors(GtkWidget *w);
274void popup_settings(void);
275
276/* Playlists */
277
278void playlists_init(void);
279void playlist_window_create(gpointer callback_data,
280 guint callback_action,
281 GtkWidget *menu_item);
282extern char **playlists;
283extern int nplaylists;
284extern GtkWidget *menu_playlists_widget;
285extern GtkWidget *playlists_menu;
286extern GtkWidget *menu_editplaylists_widget;
287
288#endif /* DISOBEDIENCE_H */
289
290/*
291Local Variables:
292c-basic-offset:2
293comment-column:40
294fill-column:79
295indent-tabs-mode:nil
296End:
297*/