diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-19 01:32:37 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-19 01:32:37 +0100 |
| commit | 07646612acbc833ec50479eee3564af37636f272 (patch) | |
| tree | b3cfa4d2e90218714c144277b0819065a80090f1 /src/comet.c | |
| parent | 6dd4c979c40804756ef4d3ca5ac34671c3bcc7e2 (diff) | |
Check button clicks and trigger actions
Diffstat (limited to 'src/comet.c')
| -rw-r--r-- | src/comet.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/comet.c b/src/comet.c index 21bad7a..2b0cf40 100644 --- a/src/comet.c +++ b/src/comet.c @@ -39,6 +39,11 @@ static void log_handler(const char *log_domain, g_print("%s\n", message); } +static void action(Button *btn) +{ + log_info("Called action: %s", btn->text); +} + int main(int argc, char **argv) { g_log_set_default_handler(log_handler, (gpointer)G_LOG_LEVEL_DEBUG); @@ -65,10 +70,12 @@ int main(int argc, char **argv) for (int i = 0; i < 9; ++i) { char text[] = { '1' + i, '\0' }; Button *btn = button_create(text, true); + button_set_action(btn, action); state_add_button(state, btn); } Button *btn = button_create("long button", false); + button_set_action(btn, action); state_add_button(state, btn); draw_compute_layout(draw, state->btns, window_get_context(win)); |
