summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_config.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-29 10:59:27 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-07-29 11:17:46 -0700
commitb561e9632e5d0b1a9feef2d9db54ed872b4568ee (patch)
tree0df472922ebaa53e642d429f19a7d014916f3675 /src/lib/elementary/elm_config.c
parent2057957d219996e5363d34475ceb39c2145d4005 (diff)
elm/config: monitor MODIFIED events on config files
eio/inotify now receives these events when the config file is modified, even though the file is copied onto that location. this fixes config updating at runtime @fix Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9432
Diffstat (limited to 'src/lib/elementary/elm_config.c')
-rw-r--r--src/lib/elementary/elm_config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index 72bc9f8004..9258939f79 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -34,6 +34,7 @@ Eina_Bool _config_profile_lock = EINA_FALSE;
34static Ecore_Timer *_config_change_delay_timer = NULL; 34static Ecore_Timer *_config_change_delay_timer = NULL;
35static Ecore_Timer *_config_profile_change_delay_timer = NULL; 35static Ecore_Timer *_config_profile_change_delay_timer = NULL;
36static Ecore_Event_Handler *_monitor_file_created_handler = NULL; 36static Ecore_Event_Handler *_monitor_file_created_handler = NULL;
37static Ecore_Event_Handler *_monitor_file_modified_handler = NULL;
37static Ecore_Event_Handler *_monitor_directory_created_handler = NULL; 38static Ecore_Event_Handler *_monitor_directory_created_handler = NULL;
38static Eio_Monitor *_eio_config_monitor = NULL; 39static Eio_Monitor *_eio_config_monitor = NULL;
39static Eio_Monitor *_eio_profile_monitor = NULL; 40static Eio_Monitor *_eio_profile_monitor = NULL;
@@ -4196,6 +4197,7 @@ _elm_config_sub_shutdown(void)
4196 ELM_SAFE_FREE(_config_change_delay_timer, ecore_timer_del); 4197 ELM_SAFE_FREE(_config_change_delay_timer, ecore_timer_del);
4197 ELM_SAFE_FREE(_config_profile_change_delay_timer, ecore_timer_del); 4198 ELM_SAFE_FREE(_config_profile_change_delay_timer, ecore_timer_del);
4198 ELM_SAFE_FREE(_monitor_file_created_handler, ecore_event_handler_del); 4199 ELM_SAFE_FREE(_monitor_file_created_handler, ecore_event_handler_del);
4200 ELM_SAFE_FREE(_monitor_file_modified_handler, ecore_event_handler_del);
4199 ELM_SAFE_FREE(_monitor_directory_created_handler, ecore_event_handler_del); 4201 ELM_SAFE_FREE(_monitor_directory_created_handler, ecore_event_handler_del);
4200} 4202}
4201 4203
@@ -4226,7 +4228,7 @@ _config_change_delay_cb(void *data EINA_UNUSED)
4226 4228
4227static Eina_Bool 4229static Eina_Bool
4228_elm_config_file_monitor_cb(void *data EINA_UNUSED, 4230_elm_config_file_monitor_cb(void *data EINA_UNUSED,
4229 int type EINA_UNUSED, 4231 int type,
4230 void *event) 4232 void *event)
4231{ 4233{
4232 Eio_Monitor_Event *ev = event; 4234 Eio_Monitor_Event *ev = event;
@@ -4234,7 +4236,7 @@ _elm_config_file_monitor_cb(void *data EINA_UNUSED,
4234 4236
4235 if (ev->monitor == _eio_config_monitor) 4237 if (ev->monitor == _eio_config_monitor)
4236 { 4238 {
4237 if (type == EIO_MONITOR_FILE_CREATED) 4239 if ((type == EIO_MONITOR_FILE_CREATED) || (type == EIO_MONITOR_FILE_MODIFIED))
4238 { 4240 {
4239 if (!strcmp(file, "base.cfg")) 4241 if (!strcmp(file, "base.cfg"))
4240 { 4242 {
@@ -4246,7 +4248,7 @@ _elm_config_file_monitor_cb(void *data EINA_UNUSED,
4246 } 4248 }
4247 if (ev->monitor == _eio_profile_monitor) 4249 if (ev->monitor == _eio_profile_monitor)
4248 { 4250 {
4249 if (type == EIO_MONITOR_FILE_CREATED) 4251 if ((type == EIO_MONITOR_FILE_CREATED) || (type == EIO_MONITOR_FILE_MODIFIED))
4250 { 4252 {
4251 if ((!_config_profile_lock) && (!strcmp(file, "profile.cfg"))) 4253 if ((!_config_profile_lock) && (!strcmp(file, "profile.cfg")))
4252 { 4254 {
@@ -4299,6 +4301,8 @@ _elm_config_sub_init(void)
4299 _eio_profile_monitor = eio_monitor_add(buf); 4301 _eio_profile_monitor = eio_monitor_add(buf);
4300 _monitor_file_created_handler = ecore_event_handler_add 4302 _monitor_file_created_handler = ecore_event_handler_add
4301 (EIO_MONITOR_FILE_CREATED, _elm_config_file_monitor_cb, NULL); 4303 (EIO_MONITOR_FILE_CREATED, _elm_config_file_monitor_cb, NULL);
4304 _monitor_file_modified_handler = ecore_event_handler_add
4305 (EIO_MONITOR_FILE_MODIFIED, _elm_config_file_monitor_cb, NULL);
4302 _monitor_directory_created_handler = ecore_event_handler_add 4306 _monitor_directory_created_handler = ecore_event_handler_add
4303 (EIO_MONITOR_DIRECTORY_CREATED, _elm_config_file_monitor_cb, NULL); 4307 (EIO_MONITOR_DIRECTORY_CREATED, _elm_config_file_monitor_cb, NULL);
4304 4308