#include <gtk/gtk.h>

#include <stdio.h>

static void on_button_clicked(GtkButton *button, gpointer user_data)
{
    printf("Label text: %s\n", gtk_label_get_text(GTK_LABEL(user_data)));
}

int main(int argc, char **argv)
{
    GtkBuilder *builder;
    GtkWidget  *window;

    gtk_init(&argc, &argv);

    builder = gtk_builder_new_from_file("user_data.glade");
    gtk_builder_add_callback_symbol(builder, "on_delete_event", G_CALLBACK(gtk_main_quit));
    gtk_builder_add_callback_symbol(builder, "on_button_clicked", G_CALLBACK(on_button_clicked));
    gtk_builder_connect_signals(builder, NULL);

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));

    gtk_widget_show_all(window);

    gtk_main();
    return 0;
}
