<commit_before><commit_msg>Get the clock able to work<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <gtk/gtk.h>

#include "common.h"
#define MAX_BUF 512

GtkLabel *clockLabel;
GtkLabel *countLabel;
GtkEntry *intervalEntry;

void updateClock();

void on_timerSwitch_active_notify(GObject *obj, GParamSpec *pspec, gpointer data) {
    GtkSwitch *toggleSwitch = GTK_SWITCH(obj);
    switch(gtk_switch_get_active(toggleSwitch)) {
        case TRUE:
            updateClock();
            ;;
        case FALSE:
            updateClock();
            ;;
    }
}

void updateClock() {
    gchar *buffer = calloc(9, sizeof(char));
    time_t theTime = time(NULL);
    strftime(buffer, 9, "%T", localtime(&theTime));
    gtk_label_set_text(clockLabel, buffer);
}

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

    gtk_init(&argc, &argv);

    builder = gtk_builder_new();

    GError *err = NULL;

    if(gtk_builder_add_from_file(builder, "gladeFiles/LessonSeven.glade", &err) == 0) {
        g_error(err->message);
        return EXIT_FAILURE;
    }

    window = GTK_WIDGET(gtk_builder_get_object(builder, "window1"));
    clockLabel = GTK_LABEL(gtk_builder_get_object(builder, "clockLabel"));
    countLabel = GTK_LABEL(gtk_builder_get_object(builder, "countLabel"));
    intervalEntry = GTK_ENTRY(gtk_builder_get_object(builder, "intervalEntry"));

    gtk_builder_connect_signals(builder, NULL);

    g_object_unref(G_OBJECT(builder));

    gtk_widget_show(window);
    gtk_main();

    return EXIT_SUCCESS;
}

{'fraction_non_alphanumeric': 0.12531645569620253, 'fraction_numerical': 0.004430379746835443, 'mean_word_length': 3.940625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7602067', 'n_tokens_mistral': 568, 'n_tokens_neox': 538, 'n_words': 100}