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"
53 #include <gdk-pixbuf/gdk-pixbuf.h>
54 #include <gdk/gdkkeysyms.h>
56 /* Types ------------------------------------------------------------------- */
60 struct progress_window;
62 /** @brief Per-tab callbacks
64 * Some of the options in the main menu depend on which tab is displayed, so we
65 * have some callbacks to set them appropriately.
68 int (*properties_sensitive)(void *extra);
69 int (*selectall_sensitive)(void *extra);
70 int (*selectnone_sensitive)(void *extra);
71 void (*properties_activate)(GtkMenuItem *menuitem,
73 void (*selectall_activate)(GtkMenuItem *menuitem,
75 void (*selectnone_activate)(GtkMenuItem *menuitem,
77 void (*selected)(void);
81 /** @brief Button definitions */
84 void (*clicked)(GtkButton *button, gpointer userdata);
89 /* Variables --------------------------------------------------------------- */
91 extern GMainLoop *mainloop;
92 extern GtkWidget *toplevel; /* top level window */
93 extern GtkWidget *report_label; /* label for progress indicator */
94 extern GtkWidget *tabs; /* main tabs */
95 extern disorder_eclient *client; /* main client */
97 extern unsigned long last_state; /* last reported state */
98 extern rights_type last_rights; /* last reported rights bitmap */
99 extern int playing; /* true if playing some track */
100 extern int volume_l, volume_r; /* current volume */
101 extern double goesupto; /* volume upper bound */
102 extern int choosealpha; /* break up choose by letter */
103 extern GtkTooltips *tips;
104 extern int rtp_supported;
105 extern int rtp_is_running;
106 extern GtkItemFactory *mainmenufactory;
108 extern const disorder_eclient_log_callbacks log_callbacks;
110 /* Functions --------------------------------------------------------------- */
112 disorder_eclient *gtkclient(void);
113 /* Configure C for use in GTK+ programs */
115 void popup_protocol_error(int code,
117 /* Report an error */
119 void properties(int ntracks, const char **tracks);
120 /* Pop up a properties window for a list of tracks */
122 GtkWidget *scroll_widget(GtkWidget *child);
123 /* Wrap a widget up for scrolling */
125 GtkWidget *frame_widget(GtkWidget *w, const char *title);
127 GdkPixbuf *find_image(const char *name);
128 /* Get the pixbuf for an image. Returns a null pointer if it cannot be
131 void popup_msg(GtkMessageType mt, const char *msg);
132 void popup_submsg(GtkWidget *parent, GtkMessageType mt, const char *msg);
134 void fpopup_msg(GtkMessageType mt, const char *fmt, ...);
136 struct progress_window *progress_window_new(const char *title);
137 /* Pop up a progress window */
139 void progress_window_progress(struct progress_window *pw,
142 /* Report current progress */
144 GtkWidget *iconbutton(const char *path, const char *tip);
146 GtkWidget *create_buttons(struct button *buttons,
148 GtkWidget *create_buttons_box(struct button *buttons,
152 void logged_in(void);
154 void all_update(void);
155 /* Update everything */
159 GtkWidget *menubar(GtkWidget *w);
160 /* Create the menu bar */
162 void users_set_sensitive(int sensitive);
166 GtkWidget *control_widget(void);
167 /* Make the controls widget */
169 extern int suppress_actions;
171 /* Queue/Recent/Added */
173 GtkWidget *queue_widget(void);
174 GtkWidget *recent_widget(void);
175 GtkWidget *added_widget(void);
176 /* Create widgets for displaying the queue, the recently played list and the
177 * newly added tracks list */
179 void queue_select_all(struct queuelike *ql);
180 void queue_select_none(struct queuelike *ql);
181 /* Select all/none on some queue */
183 void queue_properties(struct queuelike *ql);
184 /* Pop up properties of selected items in some queue */
186 int queued(const char *track);
187 /* Return nonzero iff TRACK is queued or playing */
189 extern struct queue_entry *playing_track;
192 const char *namepart(const char *track,
195 long namepart_length(const char *track);
196 char *namepart_resolve(const char *track);
198 void namepart_update(const char *track,
201 /* Called when a namepart might have changed */
205 GtkWidget *choose_widget(void);
206 /* Create a widget for choosing tracks */
208 void choose_update(void);
209 /* Called when we think the choose tree might need updating */
211 void play_completed(void *v,
216 void login_box(void);
218 GtkWidget *login_window;
220 /* User management */
222 void manage_users(void);
226 void popup_help(void);
230 int rtp_running(void);
231 void start_rtp(void);
236 void init_styles(void);
237 extern GtkStyle *layout_style;
238 extern GtkStyle *title_style;
239 extern GtkStyle *even_style;
240 extern GtkStyle *odd_style;
241 extern GtkStyle *active_style;
242 extern GtkStyle *tool_style;
243 extern GtkStyle *search_style;
244 extern GtkStyle *drag_style;
246 extern const char *browser;
248 void save_settings(void);
249 void load_settings(void);
250 void set_tool_colors(GtkWidget *w);
251 void popup_settings(void);
255 void playlists_init(void);
256 void edit_playlists(gpointer callback_data,
257 guint callback_action,
258 GtkWidget *menu_item);
259 extern char **playlists;
260 extern int nplaylists;
261 extern GtkWidget *playlists_widget;
262 extern GtkWidget *playlists_menu;
263 extern GtkWidget *editplaylists_widget;
265 #endif /* DISOBEDIENCE_H */