# HG changeset patch # User Olaf Wintermann # Date 1707944441 -3600 # Node ID a252f68c665aadfaea0ca41c0d989e5772c2ab4a # Parent a334f9ebc5d0ba7f7e97f27c80991a325e3d6a33 port radiobutton to the new API (GTK) diff -r a334f9ebc5d0 -r a252f68c665a ui/gtk/button.c --- a/ui/gtk/button.c Mon Feb 12 22:11:33 2024 +0100 +++ b/ui/gtk/button.c Wed Feb 14 22:00:41 2024 +0100 @@ -163,16 +163,25 @@ -UIWIDGET ui_radiobutton_var(UiObject *obj, char *label, UiVar *var) { +UIWIDGET ui_radiobutton_create(UiObject *obj, UiToggleArgs args) { + UiObject* current = uic_current_obj(obj); + GSList *rg = NULL; UiInteger *rgroup; + UiVar* var = NULL; + if (args.value) { + var = uic_create_value_var(current->ctx, args.value); + } else if (args.varname) { + var = uic_create_var(obj->ctx, args.varname, UI_VAR_INTEGER); + } + if(var) { rgroup = var->value; rg = rgroup->obj; } - GtkWidget *rbutton = gtk_radio_button_new_with_label(rg, label); + GtkWidget *rbutton = gtk_radio_button_new_with_label(rg, args.label ? args.label : ""); rg = gtk_radio_button_get_group(GTK_RADIO_BUTTON(rbutton)); if(rgroup) { @@ -205,21 +214,6 @@ return rbutton; } -UIWIDGET ui_radiobutton_deprecated(UiObject *obj, char *label, UiInteger *rgroup) { - UiVar *var = NULL; - if(rgroup) { - var = malloc(sizeof(UiVar)); - var->value = rgroup; - var->type = UI_VAR_SPECIAL; - } - return ui_radiobutton_var(obj, label, var); -} - -UIWIDGET ui_radiobutton_nv(UiObject *obj, char *label, char *varname) { - UiVar *var = uic_create_var(obj->ctx, varname, UI_VAR_INTEGER); - return ui_radiobutton_var(obj, label, var); -} - void ui_radio_obs(GtkToggleToolButton *widget, UiVarEventData *event) { UiInteger *i = event->var->value;