# HG changeset patch # User Olaf Wintermann # Date 1730194132 -3600 # Node ID eaec7c62ce41563c3e2fb19f262dcb97fa89aaab # Parent cd221f1e9ff69702e9a3f9fdcd40c29f6347135b implement menu item groups diff -r cd221f1e9ff6 -r eaec7c62ce41 ui/common/menu.c --- a/ui/common/menu.c Mon Oct 28 13:15:17 2024 +0100 +++ b/ui/common/menu.c Tue Oct 29 10:28:52 2024 +0100 @@ -78,7 +78,7 @@ if (ngroups > 0) { int* newarray = calloc(n, sizeof(int)); - memcpy(newarray, groups, n); + memcpy(newarray, groups, n * sizeof(int)); *ngroups = n; return newarray; } diff -r cd221f1e9ff6 -r eaec7c62ce41 ui/gtk/window.c --- a/ui/gtk/window.c Mon Oct 28 13:15:17 2024 +0100 +++ b/ui/gtk/window.c Tue Oct 29 10:28:52 2024 +0100 @@ -239,8 +239,14 @@ } GtkWidget *entry = NULL; - if(args.input) { + if(args.input || args.password) { entry = gtk_entry_new(); + if(args.password) { + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + } + if(args.input_value) { + ENTRY_SET_TEXT(entry, args.input_value); + } adw_alert_dialog_set_extra_child(ADW_ALERT_DIALOG(dialog), entry); event->customdata = entry; } @@ -313,8 +319,14 @@ } GtkWidget *textfield = NULL; - if(args.input) { + if(args.input || args.password) { textfield = gtk_entry_new(); + if(args.password) { + gtk_entry_set_visibility(GTK_ENTRY(textfield), FALSE); + } + if(args.input_value) { + ENTRY_SET_TEXT(textfield, args.input_value); + } BOX_ADD(content_area, textfield); } diff -r cd221f1e9ff6 -r eaec7c62ce41 ui/ui/toolbar.h --- a/ui/ui/toolbar.h Mon Oct 28 13:15:17 2024 +0100 +++ b/ui/ui/toolbar.h Tue Oct 29 10:28:52 2024 +0100 @@ -43,6 +43,8 @@ ui_callback onclick; void* onclickdata; + + const int *groups; } UiToolbarItemArgs; typedef struct UiToolbarToggleItemArgs { @@ -53,6 +55,8 @@ const char* varname; ui_callback onchange; void* onchangedata; + + const int *groups; } UiToolbarToggleItemArgs; typedef struct UiToolbarMenuArgs { diff -r cd221f1e9ff6 -r eaec7c62ce41 ui/ui/window.h --- a/ui/ui/window.h Mon Oct 28 13:15:17 2024 +0100 +++ b/ui/ui/window.h Tue Oct 29 10:28:52 2024 +0100 @@ -45,7 +45,9 @@ const char *button1_label; const char *button2_label; const char *closebutton_label; + const char *input_value; UiBool input; + UiBool password; ui_callback result; void *resultdata; } UiDialogArgs;