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>
56 #include <gdk/gdkkeysyms.h>
58 /* Types ------------------------------------------------------------------- */
62 struct progress_window
;
64 /** @brief Callback data structure
66 * This program is extremely heavily callback-driven. Rather than have
67 * numerous different callback structures we have a single one which can be
68 * interpreted adequately both by success and error handlers.
71 void (*onerror
)(struct callbackdata
*cbd
,
73 const char *msg
); /* called on error */
75 const char *key
; /* gtkqueue.c op_part_lookup */
76 struct choosenode
*choosenode
; /* gtkchoose.c got_files/got_dirs */
77 struct queuelike
*ql
; /* gtkqueue.c queuelike_completed */
78 struct prefdata
*f
; /* properties.c */
79 const char *user
; /* users.c */
81 const char *user
, *email
; /* users.c */
86 /** @brief Per-tab callbacks
88 * Some of the options in the main menu depend on which tab is displayed, so we
89 * have some callbacks to set them appropriately.
92 int (*properties_sensitive
)(void *extra
);
93 int (*selectall_sensitive
)(void *extra
);
94 int (*selectnone_sensitive
)(void *extra
);
95 void (*properties_activate
)(GtkMenuItem
*menuitem
,
97 void (*selectall_activate
)(GtkMenuItem
*menuitem
,
99 void (*selectnone_activate
)(GtkMenuItem
*menuitem
,
101 void (*selected
)(void);
105 /** @brief Button definitions */
108 void (*clicked
)(GtkButton
*button
, gpointer userdata
);
113 /* Variables --------------------------------------------------------------- */
115 extern GMainLoop
*mainloop
;
116 extern GtkWidget
*toplevel
; /* top level window */
117 extern GtkWidget
*report_label
; /* label for progress indicator */
118 extern GtkWidget
*tabs
; /* main tabs */
119 extern disorder_eclient
*client
; /* main client */
121 extern unsigned long last_state
; /* last reported state */
122 extern rights_type last_rights
; /* last reported rights bitmap */
123 extern int playing
; /* true if playing some track */
124 extern int volume_l
, volume_r
; /* current volume */
125 extern double goesupto
; /* volume upper bound */
126 extern int choosealpha
; /* break up choose by letter */
127 extern GtkTooltips
*tips
;
128 extern int rtp_supported
;
129 extern int rtp_is_running
;
130 extern GtkItemFactory
*mainmenufactory
;
132 extern const disorder_eclient_log_callbacks log_callbacks
;
134 /* Functions --------------------------------------------------------------- */
136 disorder_eclient
*gtkclient(void);
137 /* Configure C for use in GTK+ programs */
139 void popup_protocol_error(int code
,
141 /* Report an error */
143 void properties(int ntracks
, const char **tracks
);
144 /* Pop up a properties window for a list of tracks */
146 GtkWidget
*scroll_widget(GtkWidget
*child
);
147 /* Wrap a widget up for scrolling */
149 GtkWidget
*frame_widget(GtkWidget
*w
, const char *title
);
151 GdkPixbuf
*find_image(const char *name
);
152 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
155 void popup_msg(GtkMessageType mt
, const char *msg
);
156 void popup_submsg(GtkWidget
*parent
, GtkMessageType mt
, const char *msg
);
158 void fpopup_msg(GtkMessageType mt
, const char *fmt
, ...);
160 struct progress_window
*progress_window_new(const char *title
);
161 /* Pop up a progress window */
163 void progress_window_progress(struct progress_window
*pw
,
166 /* Report current progress */
168 GtkWidget
*iconbutton(const char *path
, const char *tip
);
170 GtkWidget
*create_buttons(struct button
*buttons
,
172 GtkWidget
*create_buttons_box(struct button
*buttons
,
176 void logged_in(void);
178 void all_update(void);
179 /* Update everything */
183 GtkWidget
*menubar(GtkWidget
*w
);
184 /* Create the menu bar */
186 void users_set_sensitive(int sensitive
);
190 GtkWidget
*control_widget(void);
191 /* Make the controls widget */
193 extern int suppress_actions
;
195 /* Queue/Recent/Added */
197 GtkWidget
*queue_widget(void);
198 GtkWidget
*recent_widget(void);
199 GtkWidget
*added_widget(void);
200 /* Create widgets for displaying the queue, the recently played list and the
201 * newly added tracks list */
203 void queue_select_all(struct queuelike
*ql
);
204 void queue_select_none(struct queuelike
*ql
);
205 /* Select all/none on some queue */
207 void queue_properties(struct queuelike
*ql
);
208 /* Pop up properties of selected items in some queue */
210 int queued(const char *track
);
211 /* Return nonzero iff TRACK is queued or playing */
213 extern struct queue_entry
*playing_track
;
216 const char *namepart(const char *track
,
219 long namepart_length(const char *track
);
220 char *namepart_resolve(const char *track
);
222 void namepart_update(const char *track
,
225 /* Called when a namepart might have changed */
229 GtkWidget
*choose_widget(void);
230 /* Create a widget for choosing tracks */
232 void choose_update(void);
233 /* Called when we think the choose tree might need updating */
235 void play_completed(void *v
,
240 void login_box(void);
242 GtkWidget
*login_window
;
244 /* User management */
246 void manage_users(void);
250 void popup_help(void);
254 int rtp_running(void);
255 void start_rtp(void);
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);
277 #endif /* DISOBEDIENCE_H */