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 Per-tab callbacks
66 * Some of the options in the main menu depend on which tab is displayed, so we
67 * have some callbacks to set them appropriately.
70 int (*properties_sensitive)(void *extra);
71 int (*selectall_sensitive)(void *extra);
72 int (*selectnone_sensitive)(void *extra);
73 void (*properties_activate)(GtkMenuItem *menuitem,
75 void (*selectall_activate)(GtkMenuItem *menuitem,
77 void (*selectnone_activate)(GtkMenuItem *menuitem,
79 void (*selected)(void);
83 /** @brief Button definitions */
86 void (*clicked)(GtkButton *button, gpointer userdata);
91 /* Variables --------------------------------------------------------------- */
93 extern GMainLoop *mainloop;
94 extern GtkWidget *toplevel; /* top level window */
95 extern GtkWidget *report_label; /* label for progress indicator */
96 extern GtkWidget *tabs; /* main tabs */
97 extern disorder_eclient *client; /* main client */
99 extern unsigned long last_state; /* last reported state */
100 extern rights_type last_rights; /* last reported rights bitmap */
101 extern int playing; /* true if playing some track */
102 extern int volume_l, volume_r; /* current volume */
103 extern double goesupto; /* volume upper bound */
104 extern int choosealpha; /* break up choose by letter */
105 extern GtkTooltips *tips;
106 extern int rtp_supported;
107 extern int rtp_is_running;
108 extern GtkItemFactory *mainmenufactory;
110 extern const disorder_eclient_log_callbacks log_callbacks;
112 /* Functions --------------------------------------------------------------- */
114 disorder_eclient *gtkclient(void);
115 /* Configure C for use in GTK+ programs */
117 void popup_protocol_error(int code,
119 /* Report an error */
121 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);
139 /* Pop up a progress window */
141 void progress_window_progress(struct progress_window *pw,
144 /* Report current progress */
146 GtkWidget *iconbutton(const char *path, const char *tip);
148 GtkWidget *create_buttons(struct button *buttons,
150 GtkWidget *create_buttons_box(struct button *buttons,
154 void logged_in(void);
156 void all_update(void);
157 /* Update everything */
161 GtkWidget *menubar(GtkWidget *w);
162 /* Create the menu bar */
164 void users_set_sensitive(int sensitive);
168 GtkWidget *control_widget(void);
169 /* Make the controls widget */
171 extern int suppress_actions;
173 /* Queue/Recent/Added */
175 GtkWidget *queue_widget(void);
176 GtkWidget *recent_widget(void);
177 GtkWidget *added_widget(void);
178 /* Create widgets for displaying the queue, the recently played list and the
179 * newly added tracks list */
181 void queue_select_all(struct queuelike *ql);
182 void queue_select_none(struct queuelike *ql);
183 /* Select all/none on some queue */
185 void queue_properties(struct queuelike *ql);
186 /* Pop up properties of selected items in some queue */
188 int queued(const char *track);
189 /* Return nonzero iff TRACK is queued or playing */
191 extern struct queue_entry *playing_track;
194 const char *namepart(const char *track,
197 long namepart_length(const char *track);
198 char *namepart_resolve(const char *track);
200 void namepart_update(const char *track,
203 /* Called when a namepart might have changed */
207 GtkWidget *choose_widget(void);
208 /* Create a widget for choosing tracks */
210 void choose_update(void);
211 /* Called when we think the choose tree might need updating */
213 void play_completed(void *v,
218 void login_box(void);
220 GtkWidget *login_window;
222 /* User management */
224 void manage_users(void);
228 void popup_help(void);
232 int rtp_running(void);
233 void start_rtp(void);
238 void init_styles(void);
239 extern GtkStyle *layout_style;
240 extern GtkStyle *title_style;
241 extern GtkStyle *even_style;
242 extern GtkStyle *odd_style;
243 extern GtkStyle *active_style;
244 extern GtkStyle *tool_style;
245 extern GtkStyle *search_style;
246 extern GtkStyle *drag_style;
248 extern const char *browser;
250 void save_settings(void);
251 void load_settings(void);
252 void set_tool_colors(GtkWidget *w);
253 void popup_settings(void);
255 #endif /* DISOBEDIENCE_H */