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