chiark / gitweb /
Start on popup menu for Disobedience choose tab. Mostly this is
[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 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 */
20/** @file disobedience/disobedience.h
21 * @brief Header file for Disobedience, the DisOrder GTK+ client
22 */
23
24#ifndef DISOBEDIENCE_H
25#define DISOBEDIENCE_H
26
27#include "common.h"
28
29#include <time.h>
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"
48#include "kvp.h"
49#include "eventdist.h"
50#include "split.h"
51
52#include <glib.h>
53#include <gtk/gtk.h>
54#include <gdk-pixbuf/gdk-pixbuf.h>
55
56/* Types ------------------------------------------------------------------- */
57
58struct queuelike;
59struct choosenode;
60struct progress_window;
61
62/** @brief Callback data structure
63 *
64 * This program is extremely heavily callback-driven. Rather than have
65 * numerous different callback structures we have a single one which can be
66 * interpreted adequately both by success and error handlers.
67 */
68struct callbackdata {
69 void (*onerror)(struct callbackdata *cbd,
70 int code,
71 const char *msg); /* called on error */
72 union {
73 const char *key; /* gtkqueue.c op_part_lookup */
74 struct choosenode *choosenode; /* gtkchoose.c got_files/got_dirs */
75 struct queuelike *ql; /* gtkqueue.c queuelike_completed */
76 struct prefdata *f; /* properties.c */
77 const char *user; /* users.c */
78 struct {
79 const char *user, *email; /* users.c */
80 } edituser;
81 } u;
82};
83
84/** @brief Per-tab callbacks
85 *
86 * Some of the options in the main menu depend on which tab is displayed, so we
87 * have some callbacks to set them appropriately.
88 */
89struct tabtype {
90 int (*properties_sensitive)(void *extra);
91 int (*selectall_sensitive)(void *extra);
92 int (*selectnone_sensitive)(void *extra);
93 void (*properties_activate)(GtkMenuItem *menuitem,
94 gpointer user_data);
95 void (*selectall_activate)(GtkMenuItem *menuitem,
96 gpointer user_data);
97 void (*selectnone_activate)(GtkMenuItem *menuitem,
98 gpointer user_data);
99 void (*selected)(void);
100 void *extra;
101};
102
103/** @brief Button definitions */
104struct button {
105 const gchar *stock;
106 void (*clicked)(GtkButton *button, gpointer userdata);
107 const char *tip;
108 GtkWidget *widget;
109};
110
111/* Variables --------------------------------------------------------------- */
112
113extern GMainLoop *mainloop;
114extern GtkWidget *toplevel; /* top level window */
115extern GtkWidget *report_label; /* label for progress indicator */
116extern GtkWidget *tabs; /* main tabs */
117extern disorder_eclient *client; /* main client */
118
119extern unsigned long last_state; /* last reported state */
120extern rights_type last_rights; /* last reported rights bitmap */
121extern int playing; /* true if playing some track */
122extern int volume_l, volume_r; /* current volume */
123extern double goesupto; /* volume upper bound */
124extern int choosealpha; /* break up choose by letter */
125extern GtkTooltips *tips;
126extern int rtp_supported;
127extern int rtp_is_running;
128extern GtkItemFactory *mainmenufactory;
129
130extern const disorder_eclient_log_callbacks log_callbacks;
131
132/* Functions --------------------------------------------------------------- */
133
134disorder_eclient *gtkclient(void);
135/* Configure C for use in GTK+ programs */
136
137void popup_protocol_error(int code,
138 const char *msg);
139/* Report an error */
140
141void properties(int ntracks, const char **tracks);
142/* Pop up a properties window for a list of tracks */
143
144GtkWidget *scroll_widget(GtkWidget *child);
145/* Wrap a widget up for scrolling */
146
147GtkWidget *frame_widget(GtkWidget *w, const char *title);
148
149GdkPixbuf *find_image(const char *name);
150/* Get the pixbuf for an image. Returns a null pointer if it cannot be
151 * found. */
152
153void popup_msg(GtkMessageType mt, const char *msg);
154void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
155
156void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
157
158struct progress_window *progress_window_new(const char *title);
159/* Pop up a progress window */
160
161void progress_window_progress(struct progress_window *pw,
162 int progress,
163 int limit);
164/* Report current progress */
165
166GtkWidget *iconbutton(const char *path, const char *tip);
167
168GtkWidget *create_buttons(struct button *buttons,
169 size_t nbuttons);
170GtkWidget *create_buttons_box(struct button *buttons,
171 size_t nbuttons,
172 GtkWidget *box);
173
174void logged_in(void);
175
176void all_update(void);
177/* Update everything */
178
179/* Main menu */
180
181GtkWidget *menubar(GtkWidget *w);
182/* Create the menu bar */
183
184void menu_update(int page);
185/* Called whenever the main menu might need to change. PAGE is the current
186 * page if known or -1 otherwise. */
187
188void users_set_sensitive(int sensitive);
189
190/* Controls */
191
192GtkWidget *control_widget(void);
193/* Make the controls widget */
194
195extern int suppress_actions;
196
197/* Queue/Recent/Added */
198
199GtkWidget *queue_widget(void);
200GtkWidget *recent_widget(void);
201GtkWidget *added_widget(void);
202/* Create widgets for displaying the queue, the recently played list and the
203 * newly added tracks list */
204
205void queue_select_all(struct queuelike *ql);
206void queue_select_none(struct queuelike *ql);
207/* Select all/none on some queue */
208
209void queue_properties(struct queuelike *ql);
210/* Pop up properties of selected items in some queue */
211
212int queued(const char *track);
213/* Return nonzero iff TRACK is queued or playing */
214
215void namepart_update(const char *track,
216 const char *context,
217 const char *part);
218/* Called when a namepart might have changed */
219
220extern struct queue_entry *playing_track;
221
222/* Choose */
223
224GtkWidget *choose_widget(void);
225/* Create a widget for choosing tracks */
226
227void choose_update(void);
228/* Called when we think the choose tree might need updating */
229
230void play_completed(void *v,
231 const char *error);
232
233/* Login details */
234
235void login_box(void);
236
237GtkWidget *login_window;
238
239/* User management */
240
241void manage_users(void);
242
243/* Help */
244
245void popup_help(void);
246
247/* RTP */
248
249int rtp_running(void);
250void start_rtp(void);
251void stop_rtp(void);
252
253/* Settings */
254
255void init_styles(void);
256extern GtkStyle *layout_style;
257extern GtkStyle *title_style;
258extern GtkStyle *even_style;
259extern GtkStyle *odd_style;
260extern GtkStyle *active_style;
261extern GtkStyle *tool_style;
262extern GtkStyle *search_style;
263extern GtkStyle *drag_style;
264
265extern const char *browser;
266
267void save_settings(void);
268void load_settings(void);
269void set_tool_colors(GtkWidget *w);
270void popup_settings(void);
271
272#endif /* DISOBEDIENCE_H */
273
274/*
275Local Variables:
276c-basic-offset:2
277comment-column:40
278fill-column:79
279indent-tabs-mode:nil
280End:
281*/