2 * This file is part of DisOrder.
3 * Copyright (C) 2006-2008 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
20 /** @file disobedience/disobedience.h
21 * @brief Header file for Disobedience, the DisOrder GTK+ client
24 #ifndef DISOBEDIENCE_H
25 #define DISOBEDIENCE_H
42 #include "trackname.h"
45 #include "configuration.h"
47 #include "selection.h"
49 #include "eventdist.h"
55 #include <gdk-pixbuf/gdk-pixbuf.h>
57 /* Types ------------------------------------------------------------------- */
61 struct progress_window;
63 /** @brief Callback data structure
65 * This program is extremely heavily callback-driven. Rather than have
66 * numerous different callback structures we have a single one which can be
67 * interpreted adequately both by success and error handlers.
70 void (*onerror)(struct callbackdata *cbd,
72 const char *msg); /* called on error */
74 const char *key; /* gtkqueue.c op_part_lookup */
75 struct choosenode *choosenode; /* gtkchoose.c got_files/got_dirs */
76 struct queuelike *ql; /* gtkqueue.c queuelike_completed */
77 struct prefdata *f; /* properties.c */
78 const char *user; /* users.c */
80 const char *user, *email; /* users.c */
85 /** @brief Per-tab callbacks
87 * Some of the options in the main menu depend on which tab is displayed, so we
88 * have some callbacks to set them appropriately.
91 int (*properties_sensitive)(void *extra);
92 int (*selectall_sensitive)(void *extra);
93 int (*selectnone_sensitive)(void *extra);
94 void (*properties_activate)(GtkMenuItem *menuitem,
96 void (*selectall_activate)(GtkMenuItem *menuitem,
98 void (*selectnone_activate)(GtkMenuItem *menuitem,
100 void (*selected)(void);
104 /** @brief Button definitions */
107 void (*clicked)(GtkButton *button, gpointer userdata);
112 /* Variables --------------------------------------------------------------- */
114 extern GMainLoop *mainloop;
115 extern GtkWidget *toplevel; /* top level window */
116 extern GtkWidget *report_label; /* label for progress indicator */
117 extern GtkWidget *tabs; /* main tabs */
118 extern disorder_eclient *client; /* main client */
120 extern unsigned long last_state; /* last reported state */
121 extern rights_type last_rights; /* last reported rights bitmap */
122 extern int playing; /* true if playing some track */
123 extern int volume_l, volume_r; /* current volume */
124 extern double goesupto; /* volume upper bound */
125 extern int choosealpha; /* break up choose by letter */
126 extern GtkTooltips *tips;
127 extern int rtp_supported;
128 extern int rtp_is_running;
129 extern GtkItemFactory *mainmenufactory;
131 extern const disorder_eclient_log_callbacks log_callbacks;
133 /* Functions --------------------------------------------------------------- */
135 disorder_eclient *gtkclient(void);
136 /* Configure C for use in GTK+ programs */
138 void popup_protocol_error(int code,
140 /* Report an error */
142 void properties(int ntracks, const char **tracks);
143 /* Pop up a properties window for a list of tracks */
145 GtkWidget *scroll_widget(GtkWidget *child);
146 /* Wrap a widget up for scrolling */
148 GtkWidget *frame_widget(GtkWidget *w, const char *title);
150 GdkPixbuf *find_image(const char *name);
151 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
154 void popup_msg(GtkMessageType mt, const char *msg);
155 void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
157 void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
159 struct progress_window *progress_window_new(const char *title);
160 /* Pop up a progress window */
162 void progress_window_progress(struct progress_window *pw,
165 /* Report current progress */
167 GtkWidget *iconbutton(const char *path, const char *tip);
169 GtkWidget *create_buttons(struct button *buttons,
171 GtkWidget *create_buttons_box(struct button *buttons,
175 void logged_in(void);
177 void all_update(void);
178 /* Update everything */
182 GtkWidget *menubar(GtkWidget *w);
183 /* Create the menu bar */
185 void users_set_sensitive(int sensitive);
189 GtkWidget *control_widget(void);
190 /* Make the controls widget */
192 extern int suppress_actions;
194 /* Queue/Recent/Added */
196 GtkWidget *queue_widget(void);
197 GtkWidget *recent_widget(void);
198 GtkWidget *added_widget(void);
199 /* Create widgets for displaying the queue, the recently played list and the
200 * newly added tracks list */
202 void queue_select_all(struct queuelike *ql);
203 void queue_select_none(struct queuelike *ql);
204 /* Select all/none on some queue */
206 void queue_properties(struct queuelike *ql);
207 /* Pop up properties of selected items in some queue */
209 int queued(const char *track);
210 /* Return nonzero iff TRACK is queued or playing */
212 extern struct queue_entry *playing_track;
215 const char *namepart(const char *track,
218 long namepart_length(const char *track);
220 void namepart_update(const char *track,
223 /* Called when a namepart might have changed */
227 GtkWidget *choose_widget(void);
228 /* Create a widget for choosing tracks */
230 void choose_update(void);
231 /* Called when we think the choose tree might need updating */
233 void play_completed(void *v,
238 void login_box(void);
240 GtkWidget *login_window;
242 /* User management */
244 void manage_users(void);
248 void popup_help(void);
252 int rtp_running(void);
253 void start_rtp(void);
258 void init_styles(void);
259 extern GtkStyle *layout_style;
260 extern GtkStyle *title_style;
261 extern GtkStyle *even_style;
262 extern GtkStyle *odd_style;
263 extern GtkStyle *active_style;
264 extern GtkStyle *tool_style;
265 extern GtkStyle *search_style;
266 extern GtkStyle *drag_style;
268 extern const char *browser;
270 void save_settings(void);
271 void load_settings(void);
272 void set_tool_colors(GtkWidget *w);
273 void popup_settings(void);
275 #endif /* DISOBEDIENCE_H */