chiark / gitweb /
doxygen
[disorder] / disobedience / menu.c
index 6eaea062733f6ea0f28647d0042f226c1eca6a6c..ad79a9206931fe60d97a3618835ac804d0c5b2f7 100644 (file)
@@ -17,6 +17,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
+/** @file disobedience/menu.c
+ * @brief Main menu
+ */
 
 #include "disobedience.h"
 
@@ -25,6 +28,10 @@ static GtkWidget *properties_widget;
 
 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) {
@@ -33,6 +40,11 @@ static void quit_program(gpointer attribute((unused)) callback_data,
 }
 
 /* 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) {
@@ -43,6 +55,10 @@ static void select_all(gpointer attribute((unused)) callback_data,
   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) {
@@ -53,6 +69,12 @@ static void properties_item(gpointer attribute((unused)) callback_data,
   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),
@@ -61,11 +83,13 @@ void menu_update(int page) {
 
   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) {
@@ -77,6 +101,7 @@ static void about_popup(gpointer attribute((unused)) callback_data,
                            0);
 }
 
+/** @brief Callde when version arrives, displays about... popup */
 static void about_popup_got_version(void attribute((unused)) *v,
                                     const char *value) {
   GtkWidget *w;
@@ -95,21 +120,22 @@ static void about_popup_got_version(void attribute((unused)) *v,
   gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w)->vbox),
                     gtk_label_new(server_version_string));
   gtk_container_add(GTK_CONTAINER(GTK_DIALOG(w)->vbox),
-                    gtk_label_new("(c) 2004-2006 Richard Kettlewell"));
+                    gtk_label_new("(c) 2004-2007 Richard Kettlewell"));
   gtk_widget_show_all(w);
   gtk_dialog_run(GTK_DIALOG(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 },
-    { (char *)"/File/Quit", (char *)"<CTRL>Q", quit_program, 0,
+    { (char *)"/File/Quit Disobedience", (char *)"<CTRL>Q", quit_program, 0,
       (char *)"<StockItem>", GTK_STOCK_QUIT },
     { (char *)"/Edit", 0,  0, 0, (char *)"<Branch>", 0 },
-    { (char *)"/Edit/Select All", (char *)"<CTRL>A", select_all, 0,
+    { (char *)"/Edit/Select all tracks", (char *)"<CTRL>A", select_all, 0,
       0, 0 },
-    { (char *)"/Edit/Properties", 0, properties_item, 0,
+    { (char *)"/Edit/Track properties", 0, properties_item, 0,
       0, 0 },
     { (char *)"/Help", 0,  0, 0, (char *)"<Branch>", 0 },
     { (char *)"/Help/About DisOrder", 0,  about_popup, 0,
@@ -129,9 +155,9 @@ GtkWidget *menubar(GtkWidget *w) {
                                 0);
   gtk_window_add_accel_group(GTK_WINDOW(w), accel);
   selectall_widget = gtk_item_factory_get_widget(itemfactory,
-                                                "<GdisorderMain>/Edit/Select All");
+                                                "<GdisorderMain>/Edit/Select all tracks");
   properties_widget = gtk_item_factory_get_widget(itemfactory,
-                                                 "<GdisorderMain>/Edit/Properties");
+                                                 "<GdisorderMain>/Edit/Track properties");
   assert(selectall_widget != 0);
   assert(properties_widget != 0);
   return gtk_item_factory_get_widget(itemfactory,
@@ -147,4 +173,3 @@ fill-column:79
 indent-tabs-mode:nil
 End:
 */
-/* arch-tag:3vGhvsh3YABCyUS65pvmVA */