]> git.scottworley.com Git - batteryviewer/commitdiff
Call collect_data() regularly
authorScott Worley <scottworley@scottworley.com>
Thu, 23 Feb 2023 18:32:04 +0000 (10:32 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 23 Feb 2023 18:32:26 +0000 (10:32 -0800)
batteryviewer.c

index a525a729b56ca9cdee6002a67b5f8142fd6caae5..65d70091b118606d32376ebd92c7472b698dcbe6 100644 (file)
@@ -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) {