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"
45 #include "selection.h"
47 #include "eventdist.h"
54 #include <gdk-pixbuf/gdk-pixbuf.h>
55 #include <gdk/gdkkeysyms.h>
57 /* Types ------------------------------------------------------------------- */
61 struct progress_window
;
63 /** @brief Per-tab callbacks
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.
69 int (*properties_sensitive
)(void *extra
);
70 int (*selectall_sensitive
)(void *extra
);
71 int (*selectnone_sensitive
)(void *extra
);
72 void (*properties_activate
)(GtkMenuItem
*menuitem
,
74 void (*selectall_activate
)(GtkMenuItem
*menuitem
,
76 void (*selectnone_activate
)(GtkMenuItem
*menuitem
,
78 void (*selected
)(void);
82 /** @brief Button definitions */
85 void (*clicked
)(GtkButton
*button
, gpointer userdata
);
90 /* Variables --------------------------------------------------------------- */
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 */
98 extern unsigned long last_state
; /* last reported state */
99 extern rights_type last_rights
; /* last reported rights bitmap */
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 */
104 extern int rtp_supported
;
105 extern int rtp_is_running
;
106 extern GtkItemFactory
*mainmenufactory
;
107 extern const struct uaudio
*backend
;
109 extern const disorder_eclient_log_callbacks log_callbacks
;
111 /* Functions --------------------------------------------------------------- */
113 disorder_eclient
*gtkclient(void);
114 /* Configure C for use in GTK+ programs */
116 void popup_protocol_error(int code
,
118 /* Report an error */
120 void properties(int ntracks
, const char **tracks
,
122 /* Pop up a properties window for a list of tracks */
124 GtkWidget
*scroll_widget(GtkWidget
*child
);
125 /* Wrap a widget up for scrolling */
127 GtkWidget
*frame_widget(GtkWidget
*w
, const char *title
);
129 GdkPixbuf
*find_image(const char *name
);
130 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
133 void popup_msg(GtkMessageType mt
, const char *msg
);
134 void popup_submsg(GtkWidget
*parent
, GtkMessageType mt
, const char *msg
);
136 void fpopup_msg(GtkMessageType mt
, const char *fmt
, ...);
138 struct progress_window
*progress_window_new(const char *title
,
140 /* Pop up a progress window */
142 void progress_window_progress(struct progress_window
*pw
,
145 /* Report current progress */
147 GtkWidget
*iconbutton(const char *path
, const char *tip
);
149 GtkWidget
*create_buttons(struct button
*buttons
,
151 GtkWidget
*create_buttons_box(struct button
*buttons
,
155 void logged_in(void);
157 void all_update(void);
158 /* Update everything */
162 GtkWidget
*menubar(GtkWidget
*w
);
163 /* Create the menu bar */
165 void users_set_sensitive(int sensitive
);
169 GtkWidget
*control_widget(void);
170 /* Make the controls widget */
172 extern int suppress_actions
;
174 /* Queue/Recent/Added */
176 GtkWidget
*queue_widget(void);
177 GtkWidget
*recent_widget(void);
178 GtkWidget
*added_widget(void);
179 /* Create widgets for displaying the queue, the recently played list and the
180 * newly added tracks list */
182 void queue_select_all(struct queuelike
*ql
);
183 void queue_select_none(struct queuelike
*ql
);
184 /* Select all/none on some queue */
186 void queue_properties(struct queuelike
*ql
);
187 /* Pop up properties of selected items in some queue */
189 int queued(const char *track
);
190 /* Return nonzero iff TRACK is queued or playing */
192 extern struct queue_entry
*playing_track
;
195 const char *namepart(const char *track
,
198 long namepart_length(const char *track
);
199 char *namepart_resolve(const char *track
);
201 void namepart_update(const char *track
,
204 /* Called when a namepart might have changed */
208 GtkWidget
*choose_widget(void);
209 /* Create a widget for choosing tracks */
211 void choose_update(void);
212 /* Called when we think the choose tree might need updating */
214 void play_completed(void *v
,
217 extern const GtkTargetEntry choose_targets
[];
221 void login_box(void);
223 GtkWidget
*login_window
;
225 /* User management */
227 void manage_users(void);
231 void popup_help(void);
235 int rtp_running(void);
236 void start_rtp(void);
241 void init_styles(void);
242 extern GtkStyle
*layout_style
;
243 extern GtkStyle
*title_style
;
244 extern GtkStyle
*even_style
;
245 extern GtkStyle
*odd_style
;
246 extern GtkStyle
*active_style
;
247 extern GtkStyle
*tool_style
;
248 extern GtkStyle
*search_style
;
249 extern GtkStyle
*drag_style
;
251 extern const char *browser
;
253 void save_settings(void);
254 void load_settings(void);
255 void set_tool_colors(GtkWidget
*w
);
256 void popup_settings(void);
260 void playlists_init(void);
261 void playlist_window_create(gpointer callback_data
,
262 guint callback_action
,
263 GtkWidget
*menu_item
);
264 extern char **playlists
;
265 extern int nplaylists
;
266 extern GtkWidget
*menu_playlists_widget
;
267 extern GtkWidget
*playlists_menu
;
268 extern GtkWidget
*menu_editplaylists_widget
;
270 #endif /* DISOBEDIENCE_H */