chiark / gitweb /
protogen: The bulk of the eclient code generation.
[disorder] / disobedience / control.c
index 0e472d48b09faf6710275e18c1895f9e0a972f5c..1cdc190b4ea504af212a2b374925b9ee561fcdf6 100644 (file)
@@ -128,6 +128,9 @@ struct icon {
    * Can be NULL for always sensitive.
    */
   int (*sensitive)(void);
+
+  /** @brief True if the menu item has inverse sense to the button */
+  gboolean menu_invert;
   
   /** @brief Pointer to button */
   GtkWidget *button;
@@ -184,14 +187,15 @@ static struct icon icons[] = {
     stock: TRUE,
     icon: GTK_STOCK_MEDIA_PAUSE,
     label: "Pause",
-    tip_on: "Pause playing track",
-    tip_off: "Resume playing track",
+    tip_on: "Resume playing track",
+    tip_off: "Pause playing track",
     menuitem: "<GdisorderMain>/Control/Playing",
     on: pause_resume_on,
     sensitive: pause_resume_sensitive,
     action_go_on: disorder_eclient_pause,
     action_go_off: disorder_eclient_resume,
     events: "pause-changed playing-changed rights-changed playing-track-changed",
+    menu_invert: TRUE,
   },
   {
     stock: TRUE,
@@ -418,7 +422,8 @@ static void icon_changed(const char attribute((unused)) *event,
   /* Icons with an associated menu item */
   if(icon->item) {
     if(icon->toggle)
-      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(icon->item), on);
+      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(icon->item),
+                                     !!icon->menu_invert ^ !!on);
     gtk_widget_set_sensitive(icon->item, sensitive);
   }
   --suppress_actions;
@@ -458,14 +463,12 @@ static void clicked_menu(GtkMenuItem attribute((unused)) *menuitem,
 
 static void toggled_menu(GtkCheckMenuItem attribute((unused)) *menuitem,
                          gpointer userdata) {
-  clicked_icon(NULL, userdata);
+  toggled_icon(NULL, userdata);
 }
 
 /** @brief Called when a volume command completes */
 static void volume_completed(void attribute((unused)) *v,
-                             const char *err,
-                             int attribute((unused)) l,
-                             int attribute((unused)) r) {
+                             const char *err) {
   if(err)
     popup_protocol_error(0, err);
   /* We don't set the UI's notion of the volume here, it is set from the log
@@ -493,10 +496,10 @@ static void volume_adjusted(GtkAdjustment attribute((unused)) *a,
     if(backend && backend->set_volume)
       backend->set_volume(&l, &r);
   } else
-    disorder_eclient_volume(client, volume_completed,
-                            nearbyint(left(v, b) * 100),
-                            nearbyint(right(v, b) * 100),
-                            0);
+    disorder_eclient_set_volume(client, volume_completed,
+                                nearbyint(left(v, b) * 100),
+                                nearbyint(right(v, b) * 100),
+                                0);
 }
 
 /** @brief Formats the volume value */