summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS2
-rw-r--r--src/modules/clock/e_mod_main.c45
3 files changed, 39 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 36649b6726..f355968e4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-07 Carsten Haitzler
+
+ * fix clock timerfd usage to actually detect a date change.
+ * improve clock to also listen to /etc/timezone changes too.
+
2013-02-06 Mike Blumenkrantz
* added api to automatically disable widgets when checkboxes are checked or unchecked
diff --git a/NEWS b/NEWS
index 728050ef23..9e8d82ca7d 100644
--- a/NEWS
+++ b/NEWS
@@ -94,6 +94,7 @@ Improvements:
* improve load time of apps dialogs
* new tab in focus settings for pointer warping
* unify all pointer warp animators
+ * clock listens to /etc/timezone changes now too
Fixes:
* IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar.
@@ -156,3 +157,4 @@ Fixes:
* fix bug where edge flips would stop functioning after dragging to an invalid edge containing a shelf
* moved "allow windows above fullscreen windows" option to geometry settings dialog
* fix filemanager efreet cache listeners and updates
+ * fix clock timerfd usage to actually detect date changes
diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c
index 44fa483cea..11ee509e9e 100644
--- a/src/modules/clock/e_mod_main.c
+++ b/src/modules/clock/e_mod_main.c
@@ -40,6 +40,7 @@ static Config_Item *_conf_item_get(const char *id);
static void _clock_popup_free(Instance *inst);
static Eio_Monitor *clock_tz_monitor = NULL;
+static Eio_Monitor *clock_tz2_monitor = NULL;
static Eina_List *clock_eio_handlers = NULL;
Config *clock_config = NULL;
@@ -805,6 +806,8 @@ _clock_eio_error(void *d __UNUSED__, int type __UNUSED__, void *event __UNUSED__
{
eio_monitor_del(clock_tz_monitor);
clock_tz_monitor = eio_monitor_add("/etc/localtime");
+ eio_monitor_del(clock_tz2_monitor);
+ clock_tz2_monitor = eio_monitor_add("/etc/timezone");
return ECORE_CALLBACK_RENEW;
}
@@ -869,6 +872,7 @@ e_modapi_init(E_Module *m)
clock_config->module = m;
clock_tz_monitor = eio_monitor_add("/etc/localtime");
+ clock_tz2_monitor = eio_monitor_add("/etc/timezone");
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_ERROR, _clock_eio_error, NULL);
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_FILE_CREATED, _clock_eio_update, NULL);
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_FILE_MODIFIED, _clock_eio_update, NULL);
@@ -880,19 +884,32 @@ e_modapi_init(E_Module *m)
e_gadcon_provider_register(&_gadcon_class);
#ifdef HAVE_SYS_TIMERFD_H
- int timer_fd;
- int flags;
-
- /* on old systems, flags must be 0, so we'll play nice and do it always */
- timer_fd = timerfd_create(CLOCK_REALTIME, 0);
- if (timer_fd < 0) return m;
- fcntl(timer_fd, F_SETFL, O_NONBLOCK);
-
- flags = fcntl(timer_fd, F_GETFD);
- flags |= FD_CLOEXEC;
- fcntl(timer_fd, F_SETFD, flags);
-
- timerfd_handler = ecore_main_fd_handler_add(timer_fd, ECORE_FD_READ, _clock_fd_update, NULL, NULL, NULL);
+
+#ifndef TFD_TIMER_CANCELON_SET
+# define TFD_TIMER_CANCELON_SET (1 << 1)
+#endif
+ {
+ int timer_fd;
+ int flags;
+ struct itimerspec its;
+
+ // on old systems, flags must be 0, so we'll play nice and do it always
+ timer_fd = timerfd_create(CLOCK_REALTIME, 0);
+ if (timer_fd < 0) return m;
+ fcntl(timer_fd, F_SETFL, O_NONBLOCK);
+
+ flags = fcntl(timer_fd, F_GETFD);
+ flags |= FD_CLOEXEC;
+ fcntl(timer_fd, F_SETFD, flags);
+
+ memset(&its, 0, sizeof(its));
+ timerfd_settime(timer_fd, TFD_TIMER_ABSTIME | TFD_TIMER_CANCELON_SET,
+ &its, NULL);
+
+ timerfd_handler = ecore_main_fd_handler_add(timer_fd, ECORE_FD_READ,
+ _clock_fd_update, NULL,
+ NULL, NULL);
+ }
#endif
return m;
}
@@ -935,7 +952,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
update_today = NULL;
}
eio_monitor_del(clock_tz_monitor);
+ eio_monitor_del(clock_tz2_monitor);
clock_tz_monitor = NULL;
+ clock_tz2_monitor = NULL;
#ifdef HAVE_SYS_TIMERFD_H
timerfd_handler = ecore_main_fd_handler_del(timerfd_handler);
#endif