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
);
88 void (*pack
)(GtkBox
*box
,
95 /* Variables --------------------------------------------------------------- */
97 extern GMainLoop
*mainloop
;
98 extern GtkWidget
*toplevel
; /* top level window */
99 extern GtkWidget
*report_label
; /* label for progress indicator */
100 extern GtkWidget
*tabs
; /* main tabs */
101 extern disorder_eclient
*client
; /* main client */
103 extern unsigned long last_state
; /* last reported state */
104 extern rights_type last_rights
; /* last reported rights bitmap */
105 extern int playing
; /* true if playing some track */
106 extern int volume_l
, volume_r
; /* current volume */
107 extern double goesupto
; /* volume upper bound */
108 extern int choosealpha
; /* break up choose by letter */
109 extern int rtp_supported
;
110 extern int rtp_is_running
;
111 extern GtkItemFactory
*mainmenufactory
;
112 extern const struct uaudio
*backend
;
114 extern const disorder_eclient_log_callbacks log_callbacks
;
116 /* Functions --------------------------------------------------------------- */
118 disorder_eclient
*gtkclient(void);
119 /* Configure C for use in GTK+ programs */
121 void popup_protocol_error(int code
,
123 /* Report an error */
125 void properties(int ntracks
, const char **tracks
,
127 /* Pop up a properties window for a list of tracks */
129 GtkWidget
*scroll_widget(GtkWidget
*child
);
130 /* Wrap a widget up for scrolling */
132 GtkWidget
*frame_widget(GtkWidget
*w
, const char *title
);
134 GdkPixbuf
*find_image(const char *name
);
135 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
138 void popup_msg(GtkMessageType mt
, const char *msg
);
139 void popup_submsg(GtkWidget
*parent
, GtkMessageType mt
, const char *msg
);
141 void fpopup_msg(GtkMessageType mt
, const char *fmt
, ...);
143 struct progress_window
*progress_window_new(const char *title
,
145 /* Pop up a progress window */
147 void progress_window_progress(struct progress_window
*pw
,
150 /* Report current progress */
152 GtkWidget
*iconbutton(const char *path
, const char *tip
);
154 GtkWidget
*create_buttons(struct button
*buttons
,
156 GtkWidget
*create_buttons_box(struct button
*buttons
,
160 void logged_in(void);
162 void all_update(void);
163 /* Update everything */
167 GtkWidget
*menubar(GtkWidget
*w
);
168 /* Create the menu bar */
171 void users_set_sensitive(int sensitive
);
175 GtkWidget
*control_widget(void);
176 /* Make the controls widget */
178 extern int suppress_actions
;
180 /* Queue/Recent/Added */
182 GtkWidget
*queue_widget(void);
183 GtkWidget
*recent_widget(void);
184 GtkWidget
*added_widget(void);
185 /* Create widgets for displaying the queue, the recently played list and the
186 * newly added tracks list */
188 void queue_select_all(struct queuelike
*ql
);
189 void queue_select_none(struct queuelike
*ql
);
190 /* Select all/none on some queue */
192 void queue_properties(struct queuelike
*ql
);
193 /* Pop up properties of selected items in some queue */
195 int queued(const char *track
);
196 /* Return nonzero iff TRACK is queued or playing */
198 extern struct queue_entry
*playing_track
;
201 const char *namepart(const char *track
,
204 long namepart_length(const char *track
);
205 char *namepart_resolve(const char *track
);
207 void namepart_update(const char *track
,
210 /* Called when a namepart might have changed */
214 GtkWidget
*choose_widget(void);
215 /* Create a widget for choosing tracks */
217 void choose_update(void);
218 /* Called when we think the choose tree might need updating */
220 void play_completed(void *v
,
223 extern const GtkTargetEntry choose_targets
[];
227 void login_box(void);
229 GtkWidget
*login_window
;
231 /* User management */
233 void manage_users(void);
237 void popup_help(const char *what
);
241 int rtp_running(void);
242 void start_rtp(void);
247 void init_styles(void);
248 extern GtkStyle
*layout_style
;
249 extern GtkStyle
*title_style
;
250 extern GtkStyle
*even_style
;
251 extern GtkStyle
*odd_style
;
252 extern GtkStyle
*active_style
;
253 extern GtkStyle
*tool_style
;
254 extern GtkStyle
*search_style
;
255 extern GtkStyle
*drag_style
;
257 extern const char *browser
;
259 void save_settings(void);
260 void load_settings(void);
261 void set_tool_colors(GtkWidget
*w
);
262 void popup_settings(void);
266 void playlists_init(void);
267 void playlist_window_create(gpointer callback_data
,
268 guint callback_action
,
269 GtkWidget
*menu_item
);
270 extern char **playlists
;
271 extern int nplaylists
;
272 extern GtkWidget
*menu_playlists_widget
;
273 extern GtkWidget
*playlists_menu
;
274 extern GtkWidget
*menu_editplaylists_widget
;
276 #endif /* DISOBEDIENCE_H */