chiark / gitweb /
Don't playlist_list_update when playlist-modified
[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#define PLAYLISTS 1
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#include "timeval.h"
52#include "uaudio.h"
53
54#include <glib.h>
55#include <gtk/gtk.h>
56#include <gdk-pixbuf/gdk-pixbuf.h>
57#include <gdk/gdkkeysyms.h>
58
59/* Types ------------------------------------------------------------------- */
60
61struct queuelike;
62struct choosenode;
63struct progress_window;
64
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 */
70struct tabtype {
71 int (*properties_sensitive)(void *extra);
72 int (*selectall_sensitive)(void *extra);
73 int (*selectnone_sensitive)(void *extra);
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);
80 void (*selected)(void);
81 void *extra;
82};
83
84/** @brief Button definitions */
85struct button {
86 const gchar *stock;
87 void (*clicked)(GtkButton *button, gpointer userdata);
88 const char *tip;
89 GtkWidget *widget;
90};
91
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 */
101extern rights_type last_rights; /* last reported rights bitmap */
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 */
106extern int rtp_supported;
107extern int rtp_is_running;
108extern GtkItemFactory *mainmenufactory;
109extern const struct uaudio *backend;
110
111extern const disorder_eclient_log_callbacks log_callbacks;
112
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
122void properties(int ntracks, const char **tracks);
123/* Pop up a properties window for a list of tracks */
124
125GtkWidget *scroll_widget(GtkWidget *child);
126/* Wrap a widget up for scrolling */
127
128GtkWidget *frame_widget(GtkWidget *w, const char *title);
129
130GdkPixbuf *find_image(const char *name);
131/* Get the pixbuf for an image. Returns a null pointer if it cannot be
132 * found. */
133
134void popup_msg(GtkMessageType mt, const char *msg);
135void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
136
137void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
138
139struct progress_window *progress_window_new(const char *title);
140/* Pop up a progress window */
141
142void progress_window_progress(struct progress_window *pw,
143 int progress,
144 int limit);
145/* Report current progress */
146
147GtkWidget *iconbutton(const char *path, const char *tip);
148
149GtkWidget *create_buttons(struct button *buttons,
150 size_t nbuttons);
151GtkWidget *create_buttons_box(struct button *buttons,
152 size_t nbuttons,
153 GtkWidget *box);
154
155void logged_in(void);
156
157void all_update(void);
158/* Update everything */
159
160/* Main menu */
161
162GtkWidget *menubar(GtkWidget *w);
163/* Create the menu bar */
164
165void users_set_sensitive(int sensitive);
166
167/* Controls */
168
169GtkWidget *control_widget(void);
170/* Make the controls widget */
171
172extern int suppress_actions;
173
174/* Queue/Recent/Added */
175
176GtkWidget *queue_widget(void);
177GtkWidget *recent_widget(void);
178GtkWidget *added_widget(void);
179/* Create widgets for displaying the queue, the recently played list and the
180 * newly added tracks list */
181
182void queue_select_all(struct queuelike *ql);
183void queue_select_none(struct queuelike *ql);
184/* Select all/none on some queue */
185
186void queue_properties(struct queuelike *ql);
187/* Pop up properties of selected items in some queue */
188
189int queued(const char *track);
190/* Return nonzero iff TRACK is queued or playing */
191
192extern struct queue_entry *playing_track;
193
194/* Lookups */
195const char *namepart(const char *track,
196 const char *context,
197 const char *part);
198long namepart_length(const char *track);
199char *namepart_resolve(const char *track);
200
201void namepart_update(const char *track,
202 const char *context,
203 const char *part);
204/* Called when a namepart might have changed */
205
206/* Choose */
207
208GtkWidget *choose_widget(void);
209/* Create a widget for choosing tracks */
210
211void choose_update(void);
212/* Called when we think the choose tree might need updating */
213
214void play_completed(void *v,
215 const char *err);
216
217/* Login details */
218
219void login_box(void);
220
221GtkWidget *login_window;
222
223/* User management */
224
225void manage_users(void);
226
227/* Help */
228
229void popup_help(void);
230
231/* RTP */
232
233int rtp_running(void);
234void start_rtp(void);
235void stop_rtp(void);
236
237/* Settings */
238
239void init_styles(void);
240extern GtkStyle *layout_style;
241extern GtkStyle *title_style;
242extern GtkStyle *even_style;
243extern GtkStyle *odd_style;
244extern GtkStyle *active_style;
245extern GtkStyle *tool_style;
246extern GtkStyle *search_style;
247extern GtkStyle *drag_style;
248
249extern const char *browser;
250
251void save_settings(void);
252void load_settings(void);
253void set_tool_colors(GtkWidget *w);
254void popup_settings(void);
255
256/* Playlists */
257
258#if PLAYLISTS
259void playlists_init(void);
260void playlist_window_create(gpointer callback_data,
261 guint callback_action,
262 GtkWidget *menu_item);
263extern char **playlists;
264extern int nplaylists;
265extern GtkWidget *menu_playlists_widget;
266extern GtkWidget *playlists_menu;
267extern GtkWidget *menu_editplaylists_widget;
268#endif
269
270#endif /* DISOBEDIENCE_H */
271
272/*
273Local Variables:
274c-basic-offset:2
275comment-column:40
276fill-column:79
277indent-tabs-mode:nil
278End:
279*/