From f371733fc4669a618bdfe569111a185f230e9955 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 3 Mar 2017 08:09:38 +0100 Subject: properly handly timeout values The timeout value in the config file was expected to be in ms... Fixes #18 --- config.def.h | 2 +- mpd-notification.c | 6 +++--- 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) { -- cgit v1.2.3-70-g09d2