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