+static void hack_window_title(const char attribute((unused)) *event,
+ void attribute((unused)) *eventdata,
+ void attribute((unused)) *callbackdata) {
+ char *p;
+ const char *note;
+ static const char *last_note = 0;
+
+ if(!(last_state & DISORDER_CONNECTED))
+ note = "(disconnected)";
+ else if(last_state & DISORDER_TRACK_PAUSED)
+ note = "(paused)";
+ else if(playing_track) {
+ byte_asprintf(&p, "'%s' by %s, from '%s'",
+ namepart(playing_track->track, "display", "title"),
+ namepart(playing_track->track, "display", "artist"),
+ namepart(playing_track->track, "display", "album"));
+ note = p;
+ } else if(!(last_state & DISORDER_PLAYING_ENABLED))
+ note = "(playing disabled)";
+ else if(!(last_state & DISORDER_RANDOM_ENABLED))
+ note = "(random play disabled)";
+ else
+ note = "(nothing to play for unknown reason)";
+
+ if(last_note && !strcmp(note, last_note))
+ return;
+ last_note = xstrdup(note);
+ byte_asprintf(&p, "Disobedience: %s", note);
+ gtk_window_set_title(GTK_WINDOW(toplevel), p);
+}
+