summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03a2424)
raw | patch | inline | side by side (parent: 03a2424)
author | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 16:52:21 +0000 (18:52 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 16:52:21 +0000 (18:52 +0200) |
Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.
state with a checkbox.
src/screen_outputs.c | patch | blob | history |
diff --git a/src/screen_outputs.c b/src/screen_outputs.c
index 39d67d3dc2154bbd195304f441cfeb3c60b6c404..e4c3bc6cc618e90160b264d988f041d078cb9667 100644 (file)
--- a/src/screen_outputs.c
+++ b/src/screen_outputs.c
#include "screen_outputs.h"
#include "screen_interface.h"
#include "screen_message.h"
+#include "paint.h"
#include "i18n.h"
#include "list_window.h"
#include "mpdclient.h"
list_window_set_length(lw, mpd_outputs->len);
}
-static const char *
-outputs_list_callback(unsigned int output_index, bool *highlight,
- G_GNUC_UNUSED char **sc, G_GNUC_UNUSED void *data)
-{
- struct mpd_output *output;
-
- assert(mpd_outputs != NULL);
- assert(output_index < mpd_outputs->len);
-
- output = g_ptr_array_index(mpd_outputs, output_index);
-
- if (mpd_output_get_enabled(output))
- *highlight = true;
-
- return mpd_output_get_name(output);
-}
-
static void
outputs_init(WINDOW *w, int cols, int rows)
{
return _("Outputs");
}
+static void
+screen_outputs_paint_callback(WINDOW *w, unsigned i,
+ G_GNUC_UNUSED unsigned y, unsigned width,
+ bool selected, G_GNUC_UNUSED void *data)
+{
+ const struct mpd_output *output;
+
+ assert(mpd_outputs != NULL);
+ assert(i < mpd_outputs->len);
+
+ output = g_ptr_array_index(mpd_outputs, i);
+
+ row_color(w, COLOR_LIST, selected);
+ waddstr(w, mpd_output_get_enabled(output) ? "[X] " : "[ ] ");
+ waddstr(w, mpd_output_get_name(output));
+ row_clear_to_eol(w, width, selected);
+}
+
static void
outputs_paint(void)
{
- list_window_paint(lw, outputs_list_callback, NULL);
+ list_window_paint2(lw, screen_outputs_paint_callback, NULL);
}
static void