From: Scott Worley Date: Thu, 23 Feb 2023 18:32:04 +0000 (-0800) Subject: Call collect_data() regularly X-Git-Url: http://git.scottworley.com/batteryviewer/commitdiff_plain/6f50819eef408d0d7bc691bc1a239e26aae01cf5?ds=sidebyside Call collect_data() regularly --- diff --git a/batteryviewer.c b/batteryviewer.c index a525a72..65d7009 100644 --- a/batteryviewer.c +++ b/batteryviewer.c @@ -6,6 +6,10 @@ struct State { BVChart *current; }; +static gboolean collect_data(struct State *state __attribute__((unused))) { + return TRUE; +} + static void activate(GtkApplication *app, gpointer user_data) { GtkWidget *window = gtk_application_window_new(app); @@ -33,6 +37,8 @@ static void activate(GtkApplication *app, gpointer user_data) { padding); gtk_widget_show_all(window); + + g_timeout_add_seconds(1, (GSourceFunc)collect_data, user_data); } int main(int argc, char **argv) {