Fix bad performance with TimerFileWatcher

This commit is contained in:
Alexander Rosenberg 2022-11-08 14:53:51 -08:00
parent 67cb808401
commit 98dc75e02f
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
4 changed files with 4 additions and 2 deletions

View File

@ -57,7 +57,7 @@ static void timer_application_activate(GApplication *app) {
}
TimerApplication *timer_application_new() {
return g_object_new(TIMER_TYPE_APPLICATION, "application-id", "org.zander.practicetiemr", "flags", G_APPLICATION_FLAGS_NONE, NULL);
return g_object_new(TIMER_TYPE_APPLICATION, "application-id", "org.zander.practicetiemr", "flags", G_APPLICATION_DEFAULT_FLAGS, NULL);
}
const char *timer_application_get_config_file(TimerApplication *self) {

View File

@ -25,7 +25,7 @@ static void timer_clock_thread_callback(TimerClock *self) {
self->lastTick = now;
self->currentTime = 0;
}
g_usleep(50);
g_usleep(500);
}
}

View File

@ -31,6 +31,7 @@ static void timer_file_watcher_tick(TimerFileWatcher *self) {
}
last_tick = now;
}
g_usleep(500);
}
}

View File

@ -396,6 +396,7 @@ void timer_task_tree_set_data_path(TimerTaskTree *self, const char *path) {
if (self->fileWatcher) {
g_object_unref(self->fileWatcher);
}
self->fileWatcher = NULL;
self->fileWatcher = timer_file_watcher_new(path);
g_signal_connect(self->fileWatcher, "file-changed", G_CALLBACK(data_file_updated), self);
}