summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 14edf79)
raw | patch | inline | side by side (parent: 14edf79)
author | Max Kellermann <max@duempel.org> | |
Fri, 8 Nov 2013 17:04:36 +0000 (18:04 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 8 Nov 2013 17:04:36 +0000 (18:04 +0100) |
src/screen_status.c | patch | blob | history | |
src/screen_status.h | patch | blob | history | |
src/status_bar.c | patch | blob | history | |
src/status_bar.h | patch | blob | history |
diff --git a/src/screen_status.c b/src/screen_status.c
index 36f8753d8eec27c8bacd3db95fe293bff1a64a09..ca61fee17186304b3252720673c1cc8f8d6f563a 100644 (file)
--- a/src/screen_status.c
+++ b/src/screen_status.c
#include <stdarg.h>
+void
+screen_status_clear_message(void)
+{
+ status_bar_clear_message(&screen.status_bar);
+}
+
void
screen_status_message(const char *msg)
{
diff --git a/src/screen_status.h b/src/screen_status.h
index d951290ac1b50a6ae7f92cb16ffb8bef3dea3b17..60959eb321da5156e0223fb4117968585c1d7ef1 100644 (file)
--- a/src/screen_status.h
+++ b/src/screen_status.h
#ifndef NCMPC_SCREEN_STATUS_H
#define NCMPC_SCREEN_STATUS_H
+void
+screen_status_clear_message(void);
+
void
screen_status_message(const char *msg);
diff --git a/src/status_bar.c b/src/status_bar.c
index c6357f43e6b5f1caab63032d27a96bb30176ab3c..b1b301fd3df15524cbe4c4a60f29c9affe09e8bc 100644 (file)
--- a/src/status_bar.c
+++ b/src/status_bar.c
#endif
}
-static gboolean
-status_bar_clear_message(gpointer data)
+void
+status_bar_clear_message(struct status_bar *p)
{
- struct status_bar *p = data;
- WINDOW *w = p->window.w;
-
assert(p != NULL);
- assert(p->message_source_id != 0);
- p->message_source_id = 0;
+ if (p->message_source_id != 0) {
+ g_source_remove(p->message_source_id);
+ p->message_source_id = 0;
+ }
+
+ WINDOW *w = p->window.w;
wmove(w, 0, 0);
wclrtoeol(w);
wrefresh(w);
-
- return false;
}
#ifndef NCMPC_MINI
mvwin(p->window.w, y, x);
}
+static gboolean
+status_bar_clear_message_cb(gpointer data)
+{
+ struct status_bar *p = data;
+ assert(p->message_source_id != 0);
+ p->message_source_id = 0;
+
+ status_bar_clear_message(p);
+ return false;
+}
+
void
status_bar_message(struct status_bar *p, const char *msg)
{
if (p->message_source_id != 0)
g_source_remove(p->message_source_id);
p->message_source_id = g_timeout_add(options.status_message_time * 1000,
- status_bar_clear_message, p);
+ status_bar_clear_message_cb, p);
}
diff --git a/src/status_bar.h b/src/status_bar.h
index 71298e01f3d379e6870355e7d13560efda439c2c..9c8f4a9bf0a2125d452833a4c796d237f44ac02c 100644 (file)
--- a/src/status_bar.h
+++ b/src/status_bar.h
void
status_bar_message(struct status_bar *p, const char *msg);
+void
+status_bar_clear_message(struct status_bar *p);
+
#endif