comparison src/view_file.c @ 1660:da8afd03152f

improved file list update priority - update list with lower priority than the priority of file operations - make sure that it is updated at least once per 2 seconds
author nadvornik
date Sun, 21 Jun 2009 20:14:53 +0000
parents 349ebc02b8e2
children 8ebc26a4383f
comparison
equal deleted inserted replaced
1659:71b29f70d08c 1660:da8afd03152f
1008 1008
1009 void vf_refresh_idle(ViewFile *vf) 1009 void vf_refresh_idle(ViewFile *vf)
1010 { 1010 {
1011 if (!vf->refresh_idle_id) 1011 if (!vf->refresh_idle_id)
1012 { 1012 {
1013 vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf); 1013 vf->time_refresh_set = time(NULL);
1014 /* file operations run with G_PRIORITY_DEFAULT_IDLE */
1015 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE + 50, vf_refresh_idle_cb, vf, NULL);
1016 }
1017 else if (time(NULL) - vf->time_refresh_set > 1)
1018 {
1019 /* more than 1 sec since last update - increase priority */
1020 vf_refresh_idle_cancel(vf);
1021 vf->time_refresh_set = time(NULL);
1022 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 50, vf_refresh_idle_cb, vf, NULL);
1014 } 1023 }
1015 } 1024 }
1016 1025
1017 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data) 1026 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data)
1018 { 1027 {