2 * This file is part of DisOrder.
3 * Copyright (C) 2006 Richard Kettlewell
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.
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.
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
21 #ifndef DISOBEDIENCE_H
22 #define DISOBEDIENCE_H
43 #include "trackname.h"
46 #include "configuration.h"
48 #include "selection.h"
52 #include <gdk-pixbuf/gdk-pixbuf.h>
54 /* Types ------------------------------------------------------------------- */
60 void (*onerror)(struct callbackdata *cbd,
62 const char *msg); /* called on error */
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 */
72 int (*properties_sensitive)(GtkWidget *tab);
73 int (*selectall_sensitive)(GtkWidget *tab);
74 void (*properties_activate)(GtkWidget *tab);
75 void (*selectall_activate)(GtkWidget *tab);
78 /* Variables --------------------------------------------------------------- */
80 extern GMainLoop *mainloop;
81 extern GtkWidget *toplevel; /* top level window */
82 extern GtkWidget *report_label; /* label for progress indicator */
83 extern GtkWidget *tabs; /* main tabs */
84 extern disorder_eclient *client; /* main client */
86 extern unsigned long last_state; /* last reported state */
87 extern int playing; /* true if playing some track */
88 extern int volume_l, volume_r; /* current volume */
89 extern double goesupto; /* volume upper bound */
90 extern int choosealpha; /* break up choose by letter */
92 extern const disorder_eclient_log_callbacks log_callbacks;
94 typedef void monitor_callback(void *u);
96 /* Functions --------------------------------------------------------------- */
98 disorder_eclient *gtkclient(void);
99 /* Configure C for use in GTK+ programs */
101 void popup_protocol_error(int code,
103 /* Report an error */
105 void properties(int ntracks, char **tracks);
106 /* Pop up a properties window for a list of tracks */
108 GtkWidget *scroll_widget(GtkWidget *child, const char *name);
109 /* Wrap a widget up for scrolling */
111 GdkPixbuf *find_image(const char *name);
112 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
115 void popup_error(const char *msg);
116 /* Pop up an error message */
118 void register_monitor(monitor_callback *callback,
121 /* Register a state monitor */
123 void all_update(void);
124 /* Update everything */
128 GtkWidget *menubar(GtkWidget *w);
129 /* Create the menu bar */
131 void menu_update(int page);
132 /* Called whenever the main menu might need to change. PAGE is the current
133 * page if known or -1 otherwise. */
138 GtkWidget *control_widget(void);
139 /* Make the controls widget */
141 void control_update(void);
142 /* Called whenever we think the control widget needs changing */
147 GtkWidget *queue_widget(void);
148 GtkWidget *recent_widget(void);
149 /* Create widgets for displaying the queue and the recently played list */
151 void queue_update(void);
152 void recent_update(void);
153 /* Called whenever we think the queue or recent list might have chanegd */
155 void queue_select_all(struct queuelike *ql);
156 /* Select all on some queue */
158 void queue_properties(struct queuelike *ql);
159 /* Pop up properties of selected items in some queue */
161 void playing_update(void);
162 /* Called whenever we think the currently playing track might have changed */
164 int queued(const char *track);
165 /* Return nonzero iff TRACK is queued or playing */
167 void namepart_update(const char *track,
170 /* Called when a namepart might have changed */
175 GtkWidget *choose_widget(void);
176 /* Create a widget for choosing tracks */
178 void choose_update(void);
179 /* Called when we think the choose tree might need updating */
181 /* Widget leakage debugging rubbish ---------------------------------------- */
184 #define NW(what) do { \
185 if(++current##what % 100 > max##what) { \
186 fprintf(stderr, "%s:%d: %d %s\n", \
187 __FILE__, __LINE__, current##what, #what); \
188 max##what = current##what; \
191 #define WT(what) static int current##what, max##what
192 #define DW(what) (--current##what)
194 #define NW(what) do { } while(0)
195 #define DW(what) do { } while(0)
196 #define WT(what) struct neverused
200 extern const char *mtag;
201 #define MTAG(x) do { mtag = x; } while(0)
202 #define MTAG_PUSH(x) do { const char *save_mtag = mtag; mtag = x; (void)0
203 #define MTAG_POP() mtag = save_mtag; } while(0)
205 #define MTAG(x) do { } while(0)
206 #define MTAG_PUSH(x) do {} while(0)
207 #define MTAG_POP() do {} while(0)
210 #endif /* DISOBEDIENCE_H */