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 3 of the License, or
8 * (at your option) any later version.
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.
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/>.
18 /** @file disobedience/disobedience.h
19 * @brief Header file for Disobedience, the DisOrder GTK+ client
22 #ifndef DISOBEDIENCE_H
23 #define DISOBEDIENCE_H
40 #include "trackname.h"
43 #include "configuration.h"
46 #include "selection.h"
48 #include "eventdist.h"
52 #include "inputline.h"
56 #include <gdk-pixbuf/gdk-pixbuf.h>
57 #include <gdk/gdkkeysyms.h>
59 /* Types ------------------------------------------------------------------- */
63 struct progress_window
;
65 /** @brief Per-tab callbacks
67 * Some of the options in the main menu depend on which tab is displayed, so we
68 * have some callbacks to set them appropriately.
71 int (*properties_sensitive
)(void *extra
);
72 int (*selectall_sensitive
)(void *extra
);
73 int (*selectnone_sensitive
)(void *extra
);
74 void (*properties_activate
)(GtkMenuItem
*menuitem
,
76 void (*selectall_activate
)(GtkMenuItem
*menuitem
,
78 void (*selectnone_activate
)(GtkMenuItem
*menuitem
,
80 void (*selected
)(void);
84 /** @brief Button definitions */
87 void (*clicked
)(GtkButton
*button
, gpointer userdata
);
90 void (*pack
)(GtkBox
*box
,
97 /* Variables --------------------------------------------------------------- */
99 extern GMainLoop
*mainloop
;
100 extern GtkWidget
*toplevel
; /* top level window */
101 extern GtkWidget
*report_label
; /* label for progress indicator */
102 extern GtkWidget
*tabs
; /* main tabs */
103 extern disorder_eclient
*client
; /* main client */
105 extern unsigned long last_state
; /* last reported state */
106 extern rights_type last_rights
; /* last reported rights bitmap */
107 extern int playing
; /* true if playing some track */
108 extern int volume_l
, volume_r
; /* current volume */
109 extern double goesupto
; /* volume upper bound */
110 extern int choosealpha
; /* break up choose by letter */
111 extern int rtp_supported
;
112 extern int rtp_is_running
;
113 extern GtkItemFactory
*mainmenufactory
;
115 extern const disorder_eclient_log_callbacks log_callbacks
;
117 /* Functions --------------------------------------------------------------- */
119 disorder_eclient
*gtkclient(void);
120 /* Configure C for use in GTK+ programs */
122 void popup_protocol_error(int code
,
124 /* Report an error */
126 void properties(int ntracks
, const char **tracks
,
128 /* Pop up a properties window for a list of tracks */
130 GtkWidget
*scroll_widget(GtkWidget
*child
);
131 /* Wrap a widget up for scrolling */
133 GtkWidget
*frame_widget(GtkWidget
*w
, const char *title
);
135 GdkPixbuf
*find_image(const char *name
);
136 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
139 void popup_msg(GtkMessageType mt
, const char *msg
);
140 void popup_submsg(GtkWidget
*parent
, GtkMessageType mt
, const char *msg
);
142 void fpopup_msg(GtkMessageType mt
, const char *fmt
, ...);
144 struct progress_window
*progress_window_new(const char *title
,
146 /* Pop up a progress window */
148 void progress_window_progress(struct progress_window
*pw
,
151 /* Report current progress */
153 GtkWidget
*iconbutton(const char *path
, const char *tip
);
155 GtkWidget
*create_buttons(struct button
*buttons
,
157 GtkWidget
*create_buttons_box(struct button
*buttons
,
161 void logged_in(void);
163 void all_update(void);
164 /* Update everything */
168 GtkWidget
*menubar(GtkWidget
*w
);
169 /* Create the menu bar */
172 void users_set_sensitive(int sensitive
);
176 GtkWidget
*control_widget(void);
177 /* Make the controls widget */
179 extern int suppress_actions
;
181 /* Queue/Recent/Added */
183 GtkWidget
*queue_widget(void);
184 GtkWidget
*playing_widget(void);
185 GtkWidget
*recent_widget(void);
186 GtkWidget
*added_widget(void);
187 /* Create widgets for displaying the queue, the recently played list and the
188 * newly added tracks list */
190 void queue_select_all(struct queuelike
*ql
);
191 void queue_select_none(struct queuelike
*ql
);
192 /* Select all/none on some queue */
194 void queue_properties(struct queuelike
*ql
);
195 /* Pop up properties of selected items in some queue */
197 int queued(const char *track
);
198 /* Return nonzero iff TRACK is queued or playing */
200 extern struct queue_entry
*playing_track
;
203 const char *namepart(const char *track
,
206 long namepart_length(const char *track
);
207 char *namepart_resolve(const char *track
);
209 void namepart_update(const char *track
,
212 /* Called when a namepart might have changed */
216 GtkWidget
*choose_widget(void);
217 /* Create a widget for choosing tracks */
219 void choose_update(void);
220 /* Called when we think the choose tree might need updating */
222 void play_completed(void *v
,
225 extern const GtkTargetEntry choose_targets
[];
229 void login_box(void);
231 GtkWidget
*login_window
;
233 /* User management */
235 void manage_users(void);
239 void popup_help(const char *what
);
243 void popup_globals(void);
244 void globals_init(void);
248 int rtp_running(void);
249 void start_rtp(void);
251 void load_rtp_config(void);
252 void save_rtp_config(void);
253 void change_rtp_api(const char *api
);
255 int rtp_setvol(int *l
, int *r
);
256 int rtp_getvol(int *l
, int *r
);
260 void init_styles(void);
261 extern GtkStyle
*layout_style
;
262 extern GtkStyle
*title_style
;
263 extern GtkStyle
*even_style
;
264 extern GtkStyle
*odd_style
;
265 extern GtkStyle
*active_style
;
266 extern GtkStyle
*tool_style
;
267 extern GtkStyle
*search_style
;
268 extern GtkStyle
*drag_style
;
270 extern const char *browser
;
272 void save_settings(void);
273 void load_settings(void);
274 void set_tool_colors(GtkWidget
*w
);
275 void popup_settings(void);
279 void playlists_init(void);
280 void playlist_window_create(gpointer callback_data
,
281 guint callback_action
,
282 GtkWidget
*menu_item
);
283 extern char **playlists
;
284 extern int nplaylists
;
285 extern GtkWidget
*menu_playlists_widget
;
286 extern GtkWidget
*playlists_menu
;
287 extern GtkWidget
*menu_editplaylists_widget
;
289 #endif /* DISOBEDIENCE_H */