From 41620fc8626ab2c0f1b00b9d695b5b773273745d Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 12 Apr 2024 17:55:07 +0100 Subject: [PATCH] [build] Improve custom command dialog Show the command stem in the label. Use command label for dialog title. --- src/build.c | 13 ++++++++++--- src/dialogs.c | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/build.c b/src/build.c index a5c4cc7ad2..cda7685696 100644 --- a/src/build.c +++ b/src/build.c @@ -1266,17 +1266,24 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data) if (grp == GEANY_GBG_NON_FT && cmd == GBO_TO_CMD(GEANY_GBO_CUSTOM)) { static GtkWidget *dialog = NULL; /* keep dialog for combo history */ + gchar *str; + bc = get_build_cmd(doc, grp, cmd, NULL); + str = g_strdup_printf(_("Enter custom text to append to the command \"%s\":"), + bc->command); if (! dialog) { - dialog = dialogs_show_input_persistent(_("Custom Text"), GTK_WINDOW(main_widgets.window), - _("Enter custom text here, all entered text is appended to the command."), - build_info.custom_target, &on_make_custom_input_response, NULL); + dialog = dialogs_show_input_persistent(NULL, GTK_WINDOW(main_widgets.window), + str, build_info.custom_target, &on_make_custom_input_response, NULL); } else { + gtk_label_set_label(GTK_LABEL(ui_lookup_widget(dialog, "label")), str); gtk_widget_show(dialog); } + SETPTR(str, utils_str_remove_chars(g_strdup(bc->label), "_")); + gtk_window_set_title(GTK_WINDOW(dialog), str); + g_free(str); return; } else if (grp == GEANY_GBG_EXEC) diff --git a/src/dialogs.c b/src/dialogs.c index ccb54045ff..fb07cbd515 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -954,6 +954,7 @@ dialogs_show_input_full(const gchar *title, GtkWindow *parent, GtkWidget *label = gtk_label_new(label_text); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + ui_hookup_widget(dialog, label, "label"); gtk_container_add(GTK_CONTAINER(vbox), label); }