From e830c9f0cb28356e1210373d209de84669e1803f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 28 Aug 2025 17:00:18 +0600 Subject: [PATCH] Added update button confirmation --- locale/ubl-settings-usergroups.pot | 4 ++++ locale/ubl-settings-usergroups_ru.po | 4 ++++ source/ubl-settings-usergroups.c | 13 +++++++++++++ source/ubl-strings.h | 1 + 4 files changed, 22 insertions(+) diff --git a/locale/ubl-settings-usergroups.pot b/locale/ubl-settings-usergroups.pot index 856d760..8d0540b 100644 --- a/locale/ubl-settings-usergroups.pot +++ b/locale/ubl-settings-usergroups.pot @@ -199,6 +199,10 @@ msgstr "" msgid "Update users and groups" msgstr "" +#: source/ubl-strings.h:51 +msgid "Refreshing to the last loaded configuration will lose unsaved changes!\nСontinue anyway?" +msgstr "" + #: source/ubl-strings.h:52 msgid "Additional saving configuration" msgstr "" diff --git a/locale/ubl-settings-usergroups_ru.po b/locale/ubl-settings-usergroups_ru.po index ddfab9a..0ec8912 100644 --- a/locale/ubl-settings-usergroups_ru.po +++ b/locale/ubl-settings-usergroups_ru.po @@ -213,6 +213,10 @@ msgstr "Удалить" msgid "Update users and groups" msgstr "Обновить список пользователей и групп" +#: source/ubl-strings.h:51 +msgid "Refreshing to the last loaded configuration will lose unsaved changes!\nСontinue anyway?" +msgstr "При обновлении до последней загруженной конфигурации несохраненные изменения будут потеряны! Обновить?" + #: source/ubl-strings.h:52 msgid "Additional saving configuration" msgstr "Дополнительные настройки сохранения" diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 5f9dce2..27f2079 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1960,6 +1960,19 @@ void on_user_info(GtkWidget *,main_window *widgets){ } void on_config_update(GtkWidget *, main_window *widgets){ + + int size; + config_str parameters = yon_config_get_save_parameters(&size); + if (size){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + + data->action_text = UPDATE_CONFIRMATION_LABEL; + data->title = UPDATE_LABEL; + if (yon_confirmation_dialog_call(widgets->Window,data)!=GTK_RESPONSE_ACCEPT) + return; + + yon_char_parsed_free(parameters,size); + } if (main_config.load_mode==YON_CONFIG_GLOBAL){ on_config_global_load(NULL,widgets); } else { diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 61da712..8755901 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -52,6 +52,7 @@ #define EDIT_LABEL _("Edit") #define REMOVE_LABEL _("Remove") #define UPDATE_LABEL _("Update users and groups") +#define UPDATE_CONFIRMATION_LABEL _("Refreshing to the last loaded configuration will lose unsaved changes!\nСontinue anyway?") #define SAVING_CONFIGURATION_LABEL _("Additional saving configuration") #define FILTER_NAME_CONFIG_LABEL yon_char_append(_("Configuration file")," *.ini")