chiark / gitweb /
propagate button in track properties popup
[disorder] / disobedience / disobedience.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
348ef780 3 * Copyright (C) 2006, 2007 Richard Kettlewell
460b9539 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
21#ifndef DISOBEDIENCE_H
22#define DISOBEDIENCE_H
23
24#include <config.h>
25#include "types.h"
26
27#include <stdio.h>
28#include <time.h>
29#include <string.h>
30#include <assert.h>
31#include <ctype.h>
32#include <errno.h>
33#include <math.h>
34
35#include "mem.h"
36#include "log.h"
37#include "eclient.h"
38#include "printf.h"
39#include "cache.h"
40#include "queue.h"
41#include "printf.h"
42#include "vector.h"
43#include "trackname.h"
44#include "syscalls.h"
45#include "defs.h"
46#include "configuration.h"
47#include "hash.h"
48#include "selection.h"
49
50#include <glib.h>
51#include <gtk/gtk.h>
52#include <gdk-pixbuf/gdk-pixbuf.h>
53
54/* Types ------------------------------------------------------------------- */
55
56struct queuelike;
57struct choosenode;
58
59struct callbackdata {
60 void (*onerror)(struct callbackdata *cbd,
61 int code,
62 const char *msg); /* called on error */
63 union {
64 const char *key; /* gtkqueue.c op_part_lookup */
65 struct choosenode *choosenode; /* gtkchoose.c got_files/got_dirs */
66 struct queuelike *ql; /* gtkqueue.c queuelike_completed */
67 struct prefdata *f; /* properties.c */
68 } u;
69};
70
71struct tabtype {
72 int (*properties_sensitive)(GtkWidget *tab);
73 int (*selectall_sensitive)(GtkWidget *tab);
74 void (*properties_activate)(GtkWidget *tab);
75 void (*selectall_activate)(GtkWidget *tab);
76};
77
78/* Variables --------------------------------------------------------------- */
79
80extern GMainLoop *mainloop;
81extern GtkWidget *toplevel; /* top level window */
82extern GtkWidget *report_label; /* label for progress indicator */
83extern GtkWidget *tabs; /* main tabs */
84extern disorder_eclient *client; /* main client */
85
86extern unsigned long last_state; /* last reported state */
87extern int playing; /* true if playing some track */
88extern int volume_l, volume_r; /* current volume */
89extern double goesupto; /* volume upper bound */
90extern int choosealpha; /* break up choose by letter */
348ef780 91extern GtkTooltips *tips;
460b9539 92
10e226b3
RK
93extern const disorder_eclient_log_callbacks log_callbacks;
94
00959300 95typedef void monitor_callback(void *u);
186f896b 96
460b9539 97/* Functions --------------------------------------------------------------- */
98
99disorder_eclient *gtkclient(void);
100/* Configure C for use in GTK+ programs */
101
102void popup_protocol_error(int code,
103 const char *msg);
104/* Report an error */
105
106void properties(int ntracks, char **tracks);
107/* Pop up a properties window for a list of tracks */
108
109GtkWidget *scroll_widget(GtkWidget *child, const char *name);
110/* Wrap a widget up for scrolling */
111
112GdkPixbuf *find_image(const char *name);
113/* Get the pixbuf for an image. Returns a null pointer if it cannot be
114 * found. */
115
116void popup_error(const char *msg);
117/* Pop up an error message */
118
186f896b
RK
119void register_monitor(monitor_callback *callback,
120 void *u,
121 unsigned long mask);
122/* Register a state monitor */
123
10e226b3
RK
124void all_update(void);
125/* Update everything */
460b9539 126
127/* Main menu */
128
129GtkWidget *menubar(GtkWidget *w);
130/* Create the menu bar */
131
132void menu_update(int page);
133/* Called whenever the main menu might need to change. PAGE is the current
134 * page if known or -1 otherwise. */
135
136
137/* Controls */
138
139GtkWidget *control_widget(void);
140/* Make the controls widget */
141
6d1302f0
RK
142void volume_update(void);
143/* Called whenever we think the volume control has changed */
460b9539 144
145/* Queue/Recent */
146
147GtkWidget *queue_widget(void);
148GtkWidget *recent_widget(void);
149/* Create widgets for displaying the queue and the recently played list */
150
151void queue_update(void);
152void recent_update(void);
153/* Called whenever we think the queue or recent list might have chanegd */
154
155void queue_select_all(struct queuelike *ql);
156/* Select all on some queue */
157
158void queue_properties(struct queuelike *ql);
159/* Pop up properties of selected items in some queue */
160
460b9539 161int queued(const char *track);
162/* Return nonzero iff TRACK is queued or playing */
163
164void namepart_update(const char *track,
165 const char *context,
166 const char *part);
167/* Called when a namepart might have changed */
168
169
170/* Choose */
171
172GtkWidget *choose_widget(void);
173/* Create a widget for choosing tracks */
174
175void choose_update(void);
176/* Called when we think the choose tree might need updating */
177
e9b70a84 178/* Widget leakage debugging rubbish ---------------------------------------- */
179
180#if MDEBUG
181#define NW(what) do { \
182 if(++current##what % 100 > max##what) { \
183 fprintf(stderr, "%s:%d: %d %s\n", \
184 __FILE__, __LINE__, current##what, #what); \
185 max##what = current##what; \
186 } \
187} while(0)
188#define WT(what) static int current##what, max##what
189#define DW(what) (--current##what)
190#else
1a48886f
RK
191#define NW(what) do { } while(0)
192#define DW(what) do { } while(0)
e9b70a84 193#define WT(what) struct neverused
194#endif
195
e1d4a32b 196#if MTRACK
197extern const char *mtag;
198#define MTAG(x) do { mtag = x; } while(0)
199#define MTAG_PUSH(x) do { const char *save_mtag = mtag; mtag = x; (void)0
200#define MTAG_POP() mtag = save_mtag; } while(0)
201#else
202#define MTAG(x) do { } while(0)
203#define MTAG_PUSH(x) do {} while(0)
204#define MTAG_POP() do {} while(0)
205#endif
206
460b9539 207#endif /* DISOBEDIENCE_H */
208
209/*
210Local Variables:
211c-basic-offset:2
212comment-column:40
213fill-column:79
214indent-tabs-mode:nil
215End:
216*/