* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
+/** @file disobedience/disobedience.c
+ * @brief Main Disobedience program
+ */
#include "disobedience.h"
/* Variables --------------------------------------------------------------- */
-GMainLoop *mainloop; /* event loop */
-GtkWidget *toplevel; /* top level window */
-GtkWidget *report_label; /* label for progress indicator */
-GtkWidget *tabs; /* main tabs */
+/** @brief Event loop */
+GMainLoop *mainloop;
+
+/** @brief Top-level window */
+GtkWidget *toplevel;
+
+/** @brief Label for progress indicator */
+GtkWidget *report_label;
+
+/** @brief Main tab group */
+GtkWidget *tabs;
+
+/** @brief Main client */
+disorder_eclient *client;
+
+/** @brief Last reported state
+ *
+ * This is updated by log_state().
+ */
+unsigned long last_state;
+
+/** @brief True if some track is playing
+ *
+ * This ought to be removed in favour of last_state & DISORDER_PLAYING
+ */
+int playing;
+
+/** @brief Left channel volume */
+int volume_l;
-disorder_eclient *client; /* main client */
+/** @brief Right channel volume */
+int volume_r;
-unsigned long last_state; /* last reported state */
-int playing; /* true if playing some track */
-int volume_l, volume_r; /* volume */
double goesupto = 10; /* volume upper bound */
-int choosealpha; /* break up choose by letter */
+
+/** @brief Break up choose tab by initial letter */
+int choosealpha;
/** @brief True if a NOP is in flight */
static int nop_in_flight;
+/** @brief Global tooltip group */
+GtkTooltips *tips;
+
/* Window creation --------------------------------------------------------- */
/* Note that all the client operations kicked off from here will only complete
* after we've entered the event loop. */
+/** @brief Called when main window is deleted
+ *
+ * Terminates the program.
+ */
static gboolean delete_event(GtkWidget attribute((unused)) *widget,
GdkEvent attribute((unused)) *event,
gpointer attribute((unused)) data) {
exit(0); /* die immediately */
}
-/* Called when the current tab is switched. */
+/** @brief Called when the current tab is switched
+ *
+ * Updates the menu settings to correspond to the new page.
+ */
static void tab_switched(GtkNotebook attribute((unused)) *notebook,
GtkNotebookPage attribute((unused)) *page,
guint page_num,
menu_update(page_num);
}
+/** @brief Create the report box */
static GtkWidget *report_box(void) {
GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
return vbox;
}
+/** @brief Create and populate the main tab group */
static GtkWidget *notebook(void) {
tabs = gtk_notebook_new();
g_signal_connect(tabs, "switch-page", G_CALLBACK(tab_switched), 0);
return tabs;
}
+/** @brief Create and populate the main window */
static void make_toplevel_window(void) {
GtkWidget *const vbox = gtk_vbox_new(FALSE, 1);
GtkWidget *const rb = report_box();
};
#endif
-/* Called once every 10 minutes */
+/** @brief Called once every 10 minutes */
static gboolean periodic(gpointer attribute((unused)) data) {
D(("periodic"));
/* Expire cached data */
return TRUE; /* don't remove me */
}
+/** @brief Called from time to time
+ *
+ * Used for debugging purposes
+ */
static gboolean heartbeat(gpointer attribute((unused)) data) {
static struct timeval last;
struct timeval now;
/* create the event loop */
D(("create main loop"));
mainloop = g_main_loop_new(0, 0);
- if(config_read()) fatal(0, "cannot read configuration");
+ if(config_read(0)) fatal(0, "cannot read configuration");
/* create the clients */
if(!(client = gtkclient())
|| !(logclient = gtkclient()))
* unresponsiveness. It's not very useful in production use. */
if(0)
g_timeout_add(1000/*milliseconds*/, heartbeat, 0);
+ /* global tooltips */
+ tips = gtk_tooltips_new();
make_toplevel_window();
/* reset styles now everything has its name */
gtk_rc_reset_styles(gtk_settings_get_for_screen(gdk_screen_get_default()));