From c97dccc19aa44368832a7ee6b2b523e69ab5c23d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 27 Oct 2025 15:40:53 +0600 Subject: [PATCH] Added new launch argument --ini --- source/ubinstall-gtk-saving.c | 8 ++++++++ source/ubinstall-gtk.c | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 710c80f..df0b3c3 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -58,6 +58,10 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ void on_config_local_load(GtkWidget *,main_window *widgets){ + if (!yon_char_is_empty(main_config.force_ini)) { + on_config_custom_load_last(NULL,widgets); + return; + } if (!yon_char_is_empty(main_config.config_load_path)) free(main_config.config_load_path); main_config.config_load_path = yon_char_new("system"); yon_load_proceed(YON_CONFIG_LOCAL); @@ -66,6 +70,10 @@ void on_config_local_load(GtkWidget *,main_window *widgets){ } void on_config_global_load(GtkWidget *,main_window *widgets){ + if (!yon_char_is_empty(main_config.force_ini)) { + on_config_custom_load_last(NULL,widgets); + return; + } if (!yon_char_is_empty(main_config.config_load_path)) free(main_config.config_load_path); main_config.config_load_path = yon_char_new("global"); yon_load_proceed(YON_CONFIG_GLOBAL); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 111db04..7683b64 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1130,6 +1130,14 @@ void yon_main_window_create(main_window *widgets){ // locale = setlocale(LC_ALL,NULL); // } // yon_ubl_window_init(TITLE_LABEL,DESCRIPTION_LABEL,locale,CssPath,LocaleName,version_application,WIKI_LINK); + if (main_config.force_ini){ + g_signal_handlers_block_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); + gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets); + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox),"config_mode",CONFIGURATION_MODE_STATUS_LABEL,BACKGROUND_IMAGE_INFO_TYPE); + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox2),"config_mede",CONFIG_PATH_LABEL(main_config.config_save_path),BACKGROUND_IMAGE_INFO_TYPE); + } yon_locale_init(); set_locales_list(widgets); // { @@ -1175,14 +1183,10 @@ int main(int argc, char *argv[]){ int option_index = 0; struct option long_options[] = { {"dry-run", 0, 0, 'D'}, - {"ini", 0, 0, 'I'}, + {"ini", 1, 0, 'I'}, {NULL, 0, NULL, 0} }; - - // Сбрасываем optind для повторного прохода optind = 1; - - // Перебор необработанных аргументов for (int i = 0; i < size; i++) { int argument = getopt_long(argc, argv, "DI:", long_options, &option_index); switch (argument) { @@ -1191,6 +1195,9 @@ int main(int argc, char *argv[]){ break; case 'I': main_config.force_ini = yon_char_new(optarg); + main_config.config_load_path = main_config.force_ini; + main_config.config_save_path = main_config.force_ini; + main_config.configure_mode = 1; break; default: break;