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