* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
+/** @file disobedience/menu.c
+ * @brief Main menu
+ */
#include "disobedience.h"
static void about_popup_got_version(void *v, const char *value);
+/** @brief Called when the quit option is activated
+ *
+ * Just exits.
+ */
static void quit_program(gpointer attribute((unused)) callback_data,
guint attribute((unused)) callback_action,
GtkWidget attribute((unused)) *menu_item) {
}
/* TODO can we have a single parameterized callback for all these */
+
+/** @brief Called when the select all option is activated
+ *
+ * Calls the per-tab select all function.
+ */
static void select_all(gpointer attribute((unused)) callback_data,
guint attribute((unused)) callback_action,
GtkWidget attribute((unused)) *menu_item) {
t->selectall_activate(tab);
}
+/** @brief Called when the track properties option is activated
+ *
+ * Calls the per-tab properties function.
+ */
static void properties_item(gpointer attribute((unused)) callback_data,
guint attribute((unused)) callback_action,
GtkWidget attribute((unused)) *menu_item) {
t->properties_activate(tab);
}
+/** @brief Update menu state
+ *
+ * Determines option sensitivity according to the current tab and adjusts the
+ * widgets accordingly. Knows about @ref DISORDER_CONNECTED so the callbacks
+ * need not.
+ */
void menu_update(int page) {
GtkWidget *tab = gtk_notebook_get_nth_page
(GTK_NOTEBOOK(tabs),
assert(t != 0);
gtk_widget_set_sensitive(properties_widget,
- t->properties_sensitive(tab));
+ (t->properties_sensitive(tab)
+ && (disorder_eclient_state(client) & DISORDER_CONNECTED)));
gtk_widget_set_sensitive(selectall_widget,
t->selectall_sensitive(tab));
}
-
+
+/** @brief Fetch version in order to display the about... popup */
static void about_popup(gpointer attribute((unused)) callback_data,
guint attribute((unused)) callback_action,
GtkWidget attribute((unused)) *menu_item) {
0);
}
+/** @brief Callde when version arrives, displays about... popup */
static void about_popup_got_version(void attribute((unused)) *v,
const char *value) {
GtkWidget *w;
gtk_widget_destroy(w);
}
+/** @brief Create the menu bar widget */
GtkWidget *menubar(GtkWidget *w) {
static const GtkItemFactoryEntry entries[] = {
{ (char *)"/File", 0, 0, 0, (char *)"<Branch>", 0 },