chiark / gitweb /
New icons for Disobedience. They are bigger and more colorful than
[disorder] / disobedience / control.c
index b62fc06778d448bdbfd782f583d13d3268b0ea24..8e1391eb872db6bfb51d6d63689789f115f3a876 100644 (file)
@@ -128,8 +128,6 @@ struct icon {
   GtkWidget *image_off;
 };
 
   GtkWidget *image_off;
 };
 
-/* TODO: Add rights into the mix below */
-
 static int pause_resume_on(void) {
   return !(last_state & DISORDER_TRACK_PAUSED);
 }
 static int pause_resume_on(void) {
   return !(last_state & DISORDER_TRACK_PAUSED);
 }
@@ -171,9 +169,9 @@ static int rtp_sensitive(void) {
 /** @brief Table of all icons */
 static struct icon icons[] = {
   {
 /** @brief Table of all icons */
 static struct icon icons[] = {
   {
-    icon_on: "pause.png",
+    icon_on: "pause32.png",
     tip_on: "Pause playing track",
     tip_on: "Pause playing track",
-    icon_off: "play.png",
+    icon_off: "play32.png",
     tip_off: "Resume playing track",
     menuitem: "<GdisorderMain>/Control/Playing",
     on: pause_resume_on,
     tip_off: "Resume playing track",
     menuitem: "<GdisorderMain>/Control/Playing",
     on: pause_resume_on,
@@ -183,7 +181,7 @@ static struct icon icons[] = {
     events: "pause-changed playing-changed rights-changed",
   },
   {
     events: "pause-changed playing-changed rights-changed",
   },
   {
-    icon_on: "cross.png",
+    icon_on: "cross32.png",
     tip_on: "Cancel playing track",
     menuitem: "<GdisorderMain>/Control/Scratch",
     sensitive: scratch_sensitive,
     tip_on: "Cancel playing track",
     menuitem: "<GdisorderMain>/Control/Scratch",
     sensitive: scratch_sensitive,
@@ -191,9 +189,9 @@ static struct icon icons[] = {
     events: "playing-track-changed rights-changed",
   },
   {
     events: "playing-track-changed rights-changed",
   },
   {
-    icon_on: "randomcross.png",
+    icon_on: "randomenabled32.png",
     tip_on: "Disable random play",
     tip_on: "Disable random play",
-    icon_off: "random.png",
+    icon_off: "randomdisabled32.png",
     tip_off: "Enable random play",
     menuitem: "<GdisorderMain>/Control/Random play",
     on: random_enabled,
     tip_off: "Enable random play",
     menuitem: "<GdisorderMain>/Control/Random play",
     on: random_enabled,
@@ -203,9 +201,9 @@ static struct icon icons[] = {
     events: "random-changed rights-changed",
   },
   {
     events: "random-changed rights-changed",
   },
   {
-    icon_on: "notescross.png",
+    icon_on: "playenabled32.png",
     tip_on: "Disable play",
     tip_on: "Disable play",
-    icon_off: "notes.png",
+    icon_off: "playdisabled32.png",
     tip_off: "Enable play",
     on: playing_enabled,
     sensitive: playing_sensitive,
     tip_off: "Enable play",
     on: playing_enabled,
     sensitive: playing_sensitive,
@@ -214,9 +212,9 @@ static struct icon icons[] = {
     events: "enabled-changed rights-changed",
   },
   {
     events: "enabled-changed rights-changed",
   },
   {
-    icon_on: "speakercross.png",
+    icon_on: "rtpenabled32.png",
     tip_on: "Stop playing network stream",
     tip_on: "Stop playing network stream",
-    icon_off: "speaker.png",
+    icon_off: "rtpdisabled32.png",
     tip_off: "Play network stream",
     menuitem: "<GdisorderMain>/Control/Network player",
     on: rtp_enabled,
     tip_off: "Play network stream",
     menuitem: "<GdisorderMain>/Control/Network player",
     on: rtp_enabled,
@@ -277,6 +275,7 @@ GtkWidget *control_widget(void) {
     char **events = split(icons[n].events, 0, 0, 0, 0);
     while(*events)
       event_register(*events++, icon_changed, &icons[n]);
     char **events = split(icons[n].events, 0, 0, 0, 0);
     while(*events)
       event_register(*events++, icon_changed, &icons[n]);
+    event_register("connected-changed", icon_changed, &icons[n]);
   }
   /* create the adjustments for the volume control */
   volume_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, goesupto,
   }
   /* create the adjustments for the volume control */
   volume_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, goesupto,
@@ -351,15 +350,18 @@ static void volume_changed(const char attribute((unused)) *event,
 static void icon_changed(const char attribute((unused)) *event,
                          void attribute((unused)) *evendata,
                          void *callbackdata) {
 static void icon_changed(const char attribute((unused)) *event,
                          void attribute((unused)) *evendata,
                          void *callbackdata) {
+  //fprintf(stderr, "icon_changed (%s)\n", event);
   const struct icon *const icon = callbackdata;
   int on = icon->on ? icon->on() : 1;
   int sensitive = icon->sensitive ? icon->sensitive() : 1;
   const struct icon *const icon = callbackdata;
   int on = icon->on ? icon->on() : 1;
   int sensitive = icon->sensitive ? icon->sensitive() : 1;
+  //fprintf(stderr, "sensitive->%d\n", sensitive);
   GtkWidget *child, *newchild;
 
   ++suppress_actions;
   /* If the connection is down nothing is ever usable */
   if(!(last_state & DISORDER_CONNECTED))
     sensitive = 0;
   GtkWidget *child, *newchild;
 
   ++suppress_actions;
   /* If the connection is down nothing is ever usable */
   if(!(last_state & DISORDER_CONNECTED))
     sensitive = 0;
+  //fprintf(stderr, "(checked connected) sensitive->%d\n", sensitive);
   /* Replace the child */
   newchild = on ? icon->image_on : icon->image_off;
   child = gtk_bin_get_child(GTK_BIN(icon->button));
   /* Replace the child */
   newchild = on ? icon->image_on : icon->image_off;
   child = gtk_bin_get_child(GTK_BIN(icon->button));
@@ -371,7 +373,7 @@ static void icon_changed(const char attribute((unused)) *event,
   }
   /* If you disable play or random play NOT via the icon (for instance, via the
    * edit menu or via a completely separate command line invocation) then the
   }
   /* If you disable play or random play NOT via the icon (for instance, via the
    * edit menu or via a completely separate command line invocation) then the
-   * icon shows up as insensitive.  Hover the mouse over it and the corrcet
+   * icon shows up as insensitive.  Hover the mouse over it and the correct
    * state is immediately displayed.  sensitive and GTK_WIDGET_SENSITIVE show
    * it to be in the correct state, so I think this is may be a GTK+ bug. */
   if(icon->tip_on)
    * state is immediately displayed.  sensitive and GTK_WIDGET_SENSITIVE show
    * it to be in the correct state, so I think this is may be a GTK+ bug. */
   if(icon->tip_on)
@@ -388,9 +390,9 @@ static void icon_changed(const char attribute((unused)) *event,
 }
 
 static void icon_action_completed(void attribute((unused)) *v,
 }
 
 static void icon_action_completed(void attribute((unused)) *v,
-                                  const char *error) {
-  if(error)
-    popup_protocol_error(0, error);
+                                  const char *err) {
+  if(err)
+    popup_protocol_error(0, err);
 }
 
 static void clicked_icon(GtkButton attribute((unused)) *button,
 }
 
 static void clicked_icon(GtkButton attribute((unused)) *button,
@@ -417,11 +419,11 @@ static void toggled_menu(GtkCheckMenuItem attribute((unused)) *menuitem,
 
 /** @brief Called when a volume command completes */
 static void volume_completed(void attribute((unused)) *v,
 
 /** @brief Called when a volume command completes */
 static void volume_completed(void attribute((unused)) *v,
-                             const char *error,
+                             const char *err,
                              int attribute((unused)) l,
                              int attribute((unused)) r) {
                              int attribute((unused)) l,
                              int attribute((unused)) r) {
-  if(error)
-    popup_protocol_error(0, error);
+  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
    * regardless of the reason it changed */
 }
   /* We don't set the UI's notion of the volume here, it is set from the log
    * regardless of the reason it changed */
 }