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