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"
54 #include <gdk-pixbuf/gdk-pixbuf.h>
56 /* Types ------------------------------------------------------------------- */
60 struct progress_window
;
62 /** @brief Callback data structure
64 * This program is extremely heavily callback-driven. Rather than have
65 * numerous different callback structures we have a single one which can be
66 * interpreted adequately both by success and error handlers.
69 void (*onerror
)(struct callbackdata
*cbd
,
71 const char *msg
); /* called on error */
73 const char *key
; /* gtkqueue.c op_part_lookup */
74 struct choosenode
*choosenode
; /* gtkchoose.c got_files/got_dirs */
75 struct queuelike
*ql
; /* gtkqueue.c queuelike_completed */
76 struct prefdata
*f
; /* properties.c */
77 const char *user
; /* users.c */
79 const char *user
, *email
; /* users.c */
84 /** @brief Per-tab callbacks
86 * Some of the options in the main menu depend on which tab is displayed, so we
87 * have some callbacks to set them appropriately.
90 int (*properties_sensitive
)(void *extra
);
91 int (*selectall_sensitive
)(void *extra
);
92 int (*selectnone_sensitive
)(void *extra
);
93 void (*properties_activate
)(GtkMenuItem
*menuitem
,
95 void (*selectall_activate
)(GtkMenuItem
*menuitem
,
97 void (*selectnone_activate
)(GtkMenuItem
*menuitem
,
99 void (*selected
)(void);
103 /** @brief Button definitions */
106 void (*clicked
)(GtkButton
*button
, gpointer userdata
);
111 /* Variables --------------------------------------------------------------- */
113 extern GMainLoop
*mainloop
;
114 extern GtkWidget
*toplevel
; /* top level window */
115 extern GtkWidget
*report_label
; /* label for progress indicator */
116 extern GtkWidget
*tabs
; /* main tabs */
117 extern disorder_eclient
*client
; /* main client */
119 extern unsigned long last_state
; /* last reported state */
120 extern rights_type last_rights
; /* last reported rights bitmap */
121 extern int playing
; /* true if playing some track */
122 extern int volume_l
, volume_r
; /* current volume */
123 extern double goesupto
; /* volume upper bound */
124 extern int choosealpha
; /* break up choose by letter */
125 extern GtkTooltips
*tips
;
126 extern int rtp_supported
;
127 extern int rtp_is_running
;
128 extern GtkItemFactory
*mainmenufactory
;
130 extern const disorder_eclient_log_callbacks log_callbacks
;
132 /* Functions --------------------------------------------------------------- */
134 disorder_eclient
*gtkclient(void);
135 /* Configure C for use in GTK+ programs */
137 void popup_protocol_error(int code
,
139 /* Report an error */
141 void properties(int ntracks
, const char **tracks
);
142 /* Pop up a properties window for a list of tracks */
144 GtkWidget
*scroll_widget(GtkWidget
*child
);
145 /* Wrap a widget up for scrolling */
147 GtkWidget
*frame_widget(GtkWidget
*w
, const char *title
);
149 GdkPixbuf
*find_image(const char *name
);
150 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
153 void popup_msg(GtkMessageType mt
, const char *msg
);
154 void popup_submsg(GtkWidget
*parent
, GtkMessageType mt
, const char *msg
);
156 void fpopup_msg(GtkMessageType mt
, const char *fmt
, ...);
158 struct progress_window
*progress_window_new(const char *title
);
159 /* Pop up a progress window */
161 void progress_window_progress(struct progress_window
*pw
,
164 /* Report current progress */
166 GtkWidget
*iconbutton(const char *path
, const char *tip
);
168 GtkWidget
*create_buttons(struct button
*buttons
,
170 GtkWidget
*create_buttons_box(struct button
*buttons
,
174 void logged_in(void);
176 void all_update(void);
177 /* Update everything */
181 GtkWidget
*menubar(GtkWidget
*w
);
182 /* Create the menu bar */
184 void users_set_sensitive(int sensitive
);
188 GtkWidget
*control_widget(void);
189 /* Make the controls widget */
191 extern int suppress_actions
;
193 /* Queue/Recent/Added */
195 GtkWidget
*queue_widget(void);
196 GtkWidget
*recent_widget(void);
197 GtkWidget
*added_widget(void);
198 /* Create widgets for displaying the queue, the recently played list and the
199 * newly added tracks list */
201 void queue_select_all(struct queuelike
*ql
);
202 void queue_select_none(struct queuelike
*ql
);
203 /* Select all/none on some queue */
205 void queue_properties(struct queuelike
*ql
);
206 /* Pop up properties of selected items in some queue */
208 int queued(const char *track
);
209 /* Return nonzero iff TRACK is queued or playing */
211 void namepart_update(const char *track
,
214 /* Called when a namepart might have changed */
216 extern struct queue_entry
*playing_track
;
220 GtkWidget
*choose_widget(void);
221 /* Create a widget for choosing tracks */
223 void choose_update(void);
224 /* Called when we think the choose tree might need updating */
226 void play_completed(void *v
,
231 void login_box(void);
233 GtkWidget
*login_window
;
235 /* User management */
237 void manage_users(void);
241 void popup_help(void);
245 int rtp_running(void);
246 void start_rtp(void);
251 void init_styles(void);
252 extern GtkStyle
*layout_style
;
253 extern GtkStyle
*title_style
;
254 extern GtkStyle
*even_style
;
255 extern GtkStyle
*odd_style
;
256 extern GtkStyle
*active_style
;
257 extern GtkStyle
*tool_style
;
258 extern GtkStyle
*search_style
;
259 extern GtkStyle
*drag_style
;
261 extern const char *browser
;
263 void save_settings(void);
264 void load_settings(void);
265 void set_tool_colors(GtkWidget
*w
);
266 void popup_settings(void);
268 #endif /* DISOBEDIENCE_H */