aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2017-03-03 08:09:38 +0100
committerGravatar Christian Hesse <mail@eworm.de>2017-03-03 08:09:38 +0100
commitf371733fc4669a618bdfe569111a185f230e9955 (patch)
tree5c3c9e508e5d11f9de5523a2bfd0c1878e754f11
parent049feb0216cd7745ff3818b95e7f4a75f738de43 (diff)
downloadmpd-notification-f371733fc4669a618bdfe569111a185f230e9955.tar.gz
mpd-notification-f371733fc4669a618bdfe569111a185f230e9955.tar.zst
properly handly timeout values
The timeout value in the config file was expected to be in ms... Fixes #18
-rw-r--r--config.def.h2
-rw-r--r--mpd-notification.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/config.def.h b/config.def.h
index 717e907..0e0bb44 100644
--- a/config.def.h
+++ b/config.def.h
@@ -9,7 +9,7 @@
#define _CONFIG_H
/* how long to display notifications */
-#define NOTIFICATION_TIMEOUT 10000
+#define NOTIFICATION_TIMEOUT 10
/* name of the icon used for notifications */
#define ICON_AUDIO_X_GENERIC "audio-x-generic"
diff --git a/mpd-notification.c b/mpd-notification.c
index 0d55607..92f1ab2 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -318,7 +318,7 @@ int main(int argc, char ** argv) {
scale = atof(optarg);
break;
case 't':
- notification_timeout = atof(optarg) * 1000;
+ notification_timeout = atof(optarg);
if (verbose > 0)
printf("%s: using notification-timeout %d\n", program, notification_timeout);
break;
@@ -356,7 +356,7 @@ int main(int argc, char ** argv) {
}
#endif
- conn = mpd_connection_new(mpd_host, mpd_port, mpd_timeout);
+ conn = mpd_connection_new(mpd_host, mpd_port, mpd_timeout * 1000);
if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) {
fprintf(stderr,"%s: %s\n", program, mpd_connection_get_error_message(conn));
@@ -474,7 +474,7 @@ int main(int argc, char ** argv) {
/* Call this unconditionally! When pixbuf is NULL this clears old image. */
notify_notification_set_image_from_pixbuf(notification, pixbuf);
- notify_notification_set_timeout(notification, notification_timeout);
+ notify_notification_set_timeout(notification, notification_timeout * 1000);
while(notify_notification_show(notification, &error) == FALSE) {
if (errcount > 1) {