diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-04-06 17:32:14 -0700 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-04-06 17:32:14 -0700 |
commit | ba02ee5d70c1d0c7ca56484e8a2efd5e472a0169 (patch) | |
tree | 97b92eb014235f2793c228113897a5e3b91bc948 /remote_plot.c | |
parent | a4ec4b272b2eae527f68cbd40488a7805dc5367b (diff) |
Edit button to print data
Diffstat (limited to 'remote_plot.c')
-rw-r--r-- | remote_plot.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/remote_plot.c b/remote_plot.c index 8f89e62..b41e2c6 100644 --- a/remote_plot.c +++ b/remote_plot.c @@ -309,9 +309,17 @@ static void draw_function (GtkDrawingArea *area, //printf("draw done\n"); } -static void print_hello (GtkWidget *widget, gpointer user_data) +static void print_data (GtkWidget *widget, gpointer user_data) { - g_print ("Hello World\n"); + DATA *data=user_data; + printf("t:"); + for(int i=0;i<10;i++) + printf(" %g",data->t[i]); + printf("\n"); + printf("buffer:"); + for(int i=0;i<10;i++) + printf(" %g",data->buffer[i]); + printf("\n"); } static void activate (GtkApplication *app, gpointer user_data) @@ -332,8 +340,8 @@ static void activate (GtkApplication *app, gpointer user_data) draw_function, user_data, NULL); - button = gtk_button_new_with_label ("Hello World"); - g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL); + button = gtk_button_new_with_label ("Print data"); + g_signal_connect (button, "clicked", G_CALLBACK (print_data), user_data); gtk_box_append(GTK_BOX(box), button); gtk_box_append(GTK_BOX(box), data->area); |