Tue, 29 Oct 2024 10:28:52 +0100
implement menu item groups
ui/common/menu.c | file | annotate | diff | comparison | revisions | |
ui/gtk/window.c | file | annotate | diff | comparison | revisions | |
ui/ui/toolbar.h | file | annotate | diff | comparison | revisions | |
ui/ui/window.h | file | annotate | diff | comparison | revisions |
--- 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; }
--- 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); }
--- 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 {
--- 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;