ui/gtk/button.c

changeset 58
0d25f15e2625
parent 56
294d5515583a
--- a/ui/gtk/button.c	Wed Oct 23 18:25:28 2024 +0200
+++ b/ui/gtk/button.c	Wed Oct 23 18:25:43 2024 +0200
@@ -60,7 +60,8 @@
         const char *icon,
         ui_callback onclick,
         void *userdata,
-        int event_value)
+        int event_value,
+        bool activate_event)
 {
     GtkWidget *button = gtk_button_new_with_label(label);
     ui_button_set_icon_name(button, icon);
@@ -83,6 +84,13 @@
                 "destroy",
                 G_CALLBACK(ui_destroy_userdata),
                 event);
+        if(activate_event) {
+            g_signal_connect(
+                button,
+                "activate",
+                G_CALLBACK(ui_button_clicked),
+                event);
+        }
     }
     
     return button;
@@ -90,7 +98,7 @@
 
 UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs args) {
     UiObject* current = uic_current_obj(obj);
-    GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata, 0);
+    GtkWidget *button = ui_create_button(obj, args.label, args.icon, args.onclick, args.onclickdata, 0, FALSE);
     ui_set_name_and_style(button, args.name, args.style_class);
     ui_set_widget_groups(obj->ctx, button, args.groups);
     UI_APPLY_LAYOUT1(current, args);

mercurial