diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index d3ca4c4..f7df02d 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -18,17 +18,17 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: source/ubl-strings.h:2 -msgid "UBLinux installation" +msgid "System installation" msgstr "" #: source/ubl-strings.h:4 -msgid "Welcome to UBLinux installation" +msgid "Welcome to system installation" msgstr "" #: source/ubl-strings.h:5 msgid "" "This program will ask you few questions\n" -"and help you install UBLinux on your computer" +"and help you install system on your computer" msgstr "" #: source/ubl-strings.h:7 @@ -96,7 +96,7 @@ msgstr "" #: source/ubl-strings.h:24 msgid "" -"Deleting all data on the selected disk and then installing the UBLinux system" +"Deleting all data on the selected disk and then installing the system" msgstr "" #: source/ubl-strings.h:25 @@ -112,7 +112,7 @@ msgid "Installation on the same partition as another system" msgstr "" #: source/ubl-strings.h:28 -msgid "Unpacking the UBLinux file system into an existing system" +msgid "Unpacking the file system into an existing system" msgstr "" #: source/ubl-strings.h:29 source/ubl-strings.h:281 @@ -224,7 +224,7 @@ msgstr "" msgid "" "Attention! The selected partition will be modified: the size will be " "reduced. In the resulting free space, a partition will be created into which " -"the UBLinux OS will be\n" +"the system will be\n" "installed." msgstr "" @@ -245,7 +245,7 @@ msgid "Free" msgstr "" #: source/ubl-strings.h:64 -msgid "Specify the size of the new partition for UBLinux OS:" +msgid "Specify the size of the new partition for system:" msgstr "" #: source/ubl-strings.h:65 @@ -287,7 +287,7 @@ msgstr "" #: source/ubl-strings.h:77 msgid "" -"Attention! The selected OS UBLinux components will be installed\n" +"Attention! The selected system components will be installed\n" "separately into the selected partition." msgstr "" @@ -393,9 +393,9 @@ msgstr "" #: source/ubl-strings.h:107 msgid "" -"You have UBLinux installed on your computer.\n" +"You have system installed on your computer.\n" "You can reboot and use your new system\n" -"or continue working in the UBLinux Live environment." +"or continue working in the system Live environment." msgstr "" #: source/ubl-strings.h:111 @@ -447,7 +447,7 @@ msgid "Installation configuration has ended" msgstr "" #: source/ubl-strings.h:124 -msgid "UBLinux OS installation is about to begin" +msgid "system installation is about to begin" msgstr "" #: source/ubl-strings.h:126 @@ -482,7 +482,7 @@ msgstr "" #: source/ubl-strings.h:135 msgid "" -"Attention! The UBLinux OS will be installed on the selected partition with " +"Attention! The system will be installed on the selected partition with " "OS already installed. All user data will be saved." msgstr "" @@ -911,13 +911,13 @@ msgstr "" #: source/ubl-strings.h:267 msgid "" -"Attention! The UBLinux OS will be installed on the selected partition " +"Attention! The system will be installed on the selected partition " "with OS already installed. All user data will be saved." msgstr "" #: source/ubl-strings.h:268 msgid "" -"Attention! The selected OS UBLinux components will be installed\n" +"Attention! The selected system components will be installed\n" "separately into the selected partition." msgstr "" @@ -1168,3 +1168,15 @@ msgstr "" #: source/ubl-strings.h:331 msgid "Skip installation" msgstr "" + +#: source/ubl-strings.h:331 +msgid "Are you sure want to exit and\ninterrupt installation process?" +msgstr "" + +#: source/ubl-strings.h:331 +msgid "Are you sure want to interrupt installation process?" +msgstr "" + +#: source/ubl-strings.h:331 +msgid "About system installation" +msgstr "" \ No newline at end of file diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 4843548..ce95a19 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -18,17 +18,17 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: source/ubl-strings.h:2 -msgid "UBLinux installation" +msgid "System installation" msgstr "Программа установки UBLinux" #: source/ubl-strings.h:4 -msgid "Welcome to UBLinux installation" +msgid "Welcome to system installation" msgstr "Добро пожаловать в установку UBLinux" #: source/ubl-strings.h:5 msgid "" "This program will ask you few questions\n" -"and help you install UBLinux on your computer" +"and help you install system on your computer" msgstr "" "Эта программа задаст вам несколько вопросов\n" "и поможет установить UBLinux на ваш компьютер" @@ -102,7 +102,7 @@ msgstr "Завершение установки" #: source/ubl-strings.h:24 msgid "" -"Deleting all data on the selected disk and then installing the UBLinux system" +"Deleting all data on the selected disk and then installing the system" msgstr "" "Удаление всех данных на выбранном диске с последующей установкой системы " "UBLinux" @@ -120,7 +120,7 @@ msgid "Installation on the same partition as another system" msgstr "Установка в раздел другой системы" #: source/ubl-strings.h:28 -msgid "Unpacking the UBLinux file system into an existing system" +msgid "Unpacking the system into an existing system" msgstr "Установить ОС в уже существующий раздел" #: source/ubl-strings.h:29 source/ubl-strings.h:281 @@ -233,7 +233,7 @@ msgstr "Выберите раздел:" msgid "" "Attention! The selected partition will be modified: the size will be " "reduced. In the resulting free space, a partition will be created into which " -"the UBLinux OS will be\n" +"the system will be\n" "installed." msgstr "" "Внимание! Выбранный раздел будет модифицирован: размер будет " @@ -250,14 +250,14 @@ msgstr "Метка" #: source/ubl-strings.h:62 msgid "Size" -msgstr "Размер" +msgstr "Общий размер" #: source/ubl-strings.h:63 msgid "Free" msgstr "Свободно" #: source/ubl-strings.h:64 -msgid "Specify the size of the new partition for UBLinux OS:" +msgid "Specify the size of the new partition for system:" msgstr "Укажите размер нового раздела для ОС UBLinux:" #: source/ubl-strings.h:65 @@ -301,7 +301,7 @@ msgstr "" #: source/ubl-strings.h:77 msgid "" -"Attention! The selected OS UBLinux components will be installed\n" +"Attention! The selected system components will be installed\n" "separately into the selected partition." msgstr "" "Внимание! В выбранный раздел будет произведена раздельная установка " @@ -410,13 +410,13 @@ msgstr "Форматировать" #: source/ubl-strings.h:107 msgid "" -"You have UBLinux installed on your computer.\n" +"You have system installed on your computer.\n" "You can reboot and use your new system\n" -"or continue working in the UBLinux Live environment." +"or continue working in the environment, booted from the Live image." msgstr "" -"На вашем компьютере установлена система UBLinux.\n" +"На вашем компьютере установлена система.\n" "Вы можете перезагрузить и использовать свою новую систему\n" -"или продолжить работу в среде UBLinux Live." +"или продолжить работу в среде системы, загруженной с Live образа." #: source/ubl-strings.h:111 msgid "Apply" @@ -467,8 +467,8 @@ msgid "Installation configuration has ended" msgstr "Настройка установщика завершена" #: source/ubl-strings.h:124 -msgid "UBLinux OS installation is about to begin" -msgstr "Начало установки ОС UBLinux" +msgid "system installation is about to begin" +msgstr "Начало установки системы" #: source/ubl-strings.h:126 msgid "Documentation" @@ -505,7 +505,7 @@ msgstr "Ошибка установки" #: source/ubl-strings.h:135 msgid "" -"Attention! The UBLinux OS will be installed on the selected partition with " +"Attention! The system will be installed on the selected partition with " "OS already installed. All user data will be saved." msgstr "" "Внимание! В выбранный раздел будет произведена установка системы. " @@ -659,6 +659,10 @@ msgstr "" "Вы уверены, что хотите закрыть программу и\n" "прервать процесс установки?" +#: source/ubl-strings.h:331 +msgid "Are you sure want to interrupt installation process?" +msgstr "Вы уверены, что хотите прервать процесс установки?" + #: source/ubl-strings.h:187 msgid "Are you sure want to reboot system?" msgstr "Вы уверены что хотите перезагрузить систему?" @@ -941,7 +945,7 @@ msgstr "Фиксированный размер:" #: source/ubl-strings.h:267 msgid "" -"Attention! The UBLinux OS will be installed on the selected partition " +"Attention! The system will be installed on the selected partition " "with OS already installed. All user data will be saved." msgstr "" "Внимание! В выбранный раздел будет произведена установка системы. " @@ -950,11 +954,11 @@ msgstr "" #: source/ubl-strings.h:268 msgid "" -"Attention! The selected OS UBLinux components will be installed\n" +"Attention! The selected system components will be installed\n" "separately into the selected partition." msgstr "" "Внимание! В выбранный раздел будет произведена раздельная установка " -"выбранных компонентов ОС UBLinux." +"выбранных компонентов системы." #: source/ubl-strings.h:269 msgid "Enable VNC server" @@ -1213,6 +1217,10 @@ msgstr "" "Если не менять тип ФС и не форматировать, все данные на разделе будут " "сохранены." +#: source/ubl-strings.h:331 +msgid "About system installation" +msgstr "О Программе установки системы" + msgid "Exit" msgstr "Выйти" @@ -3011,4 +3019,4 @@ msgid "Zulu" msgstr "Зулу" msgid "Zurich" -msgstr "Цюрих" +msgstr "Цюрих" \ No newline at end of file diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index da860f5..1dc3111 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -51,7 +51,7 @@ int yon_bootloader_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,save_size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,save_size); } diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index d283a05..ee5bc3f 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -1,5 +1,6 @@ #include "ubinstall-gtk.h" + int yon_kernel_save(main_window *widgets){ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); char *install_modules = ""; @@ -33,7 +34,7 @@ int yon_kernel_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -44,22 +45,21 @@ int yon_kernel_save(main_window *widgets){ int yon_kernel_addon_save(main_window *widgets){ // yon_kernel_save(widgets); + char *parameter = config(modules_extra_parameter); GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); - char *install_modules = ""; + char *install_modules = yon_char_new(parameter); for(GList *iter = list;iter;iter = iter->next){ kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ - char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); + char *temp = yon_char_append_element(install_modules,row->modules," "); if (!yon_char_is_empty(install_modules)) free(install_modules); install_modules = temp; } } if (!yon_char_is_empty(install_modules)){ - char *parameter = config(modules_extra_parameter); - char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?" ":"",install_modules,NULL); - yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); - free(parameter_new); + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,install_modules); + free(install_modules); } if (!main_config.configure_mode){ int size; @@ -67,7 +67,7 @@ int yon_kernel_addon_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -79,6 +79,7 @@ int yon_os_components_save(main_window *widgets){ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); GList *iter; int size; + int overall_num=0; config_str modules = NULL; for(iter = list;iter;iter=iter->next){ os_row *row = g_object_get_data(iter->data,"kernel_row"); @@ -87,9 +88,12 @@ int yon_os_components_save(main_window *widgets){ if (status){ yon_char_parsed_add_or_create_if_exists(modules,&size,target); } + overall_num++; } g_list_free(list); - if (size){ + if (size&&size==overall_num){ + yon_config_register(modules_parameter,modules_parameter_command,"auto"); + } else if (size){ char *final = yon_char_parsed_to_string(modules,size,","); yon_config_register(modules_parameter,modules_parameter_command,final); } else { @@ -101,7 +105,7 @@ int yon_os_components_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,parameters_size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,parameters_size); } @@ -152,10 +156,12 @@ void yon_os_row_setup(os_row *row, char *name, char *version,char *tags, char *d free(description_full); } -gboolean yon_os_component_insert(os_row *row){ - main_window *widgets = g_object_get_data(G_OBJECT(row->row),"widgets"); +gboolean yon_os_component_insert(struct row_data *row_input){ + os_row *row = yon_os_row_new(); + + main_window *widgets = row_input->widgets; gtk_list_box_insert(GTK_LIST_BOX(widgets->OSSoftwareListBox),row->row,-1); - yon_os_row_setup(row,row->name,row->version,row->tags,row->description); + yon_os_row_setup(row,row_input->name,row_input->version,row_input->tags,row_input->description); return G_SOURCE_REMOVE; } @@ -172,12 +178,12 @@ void *yon_os_components_setup(main_window *widgets){ yon_char_remove_last_symbol(base[i],'\n'); int parsed_size; config_str parsed = yon_char_parse(base[i],&parsed_size,";"); - os_row *row = yon_os_row_new(); + struct row_data *row = malloc(sizeof(struct row_data)); row->version = parsed[1]; row->name = parsed[0]; row->tags = yon_char_replace(parsed[2]," ",", "); row->description = parsed[3]; - g_object_set_data(G_OBJECT(row->row),"widgets",widgets); + row->widgets=widgets; g_idle_add((GSourceFunc)yon_os_component_insert,row); } g_idle_add((GSourceFunc)yon_spinner_switch_off,widgets->OSSpinner); @@ -220,7 +226,6 @@ void yon_os_components_init(main_window *widgets){ } int yon_software_save(main_window *widgets){ - GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->AdditionalSoftwareList); int size = 0; @@ -246,7 +251,7 @@ int yon_software_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -311,7 +316,7 @@ int yon_pacman_software_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index 2d4f99f..2e97ea6 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -53,18 +53,20 @@ void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ gtk_widget_show(window->Window); gtk_main(); - 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); - GList *revealerlist = gtk_container_get_children(GTK_CONTAINER(widgets->StatusBox2)); - GList *list = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(revealerlist,0))); - GtkWidget *box = GTK_WIDGET(list->data); + if (main_config.config_save_path){ + 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); + GList *revealerlist = gtk_container_get_children(GTK_CONTAINER(widgets->StatusBox2)); + GList *list = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(revealerlist,0))); + GtkWidget *box = GTK_WIDGET(list->data); - g_list_free(revealerlist); - g_list_free(list); + g_list_free(revealerlist); + g_list_free(list); - gtk_style_context_remove_class(gtk_widget_get_style_context(box),"boxInfoMessOK"); - gtk_style_context_add_class(gtk_widget_get_style_context(box),"boxInfoMessGray"); - main_config.configure_mode = 1; + gtk_style_context_remove_class(gtk_widget_get_style_context(box),"boxInfoMessOK"); + gtk_style_context_add_class(gtk_widget_get_style_context(box),"boxInfoMessGray"); + main_config.configure_mode = 1; + } gtk_widget_destroy(window->Window); return; diff --git a/source/ubinstall-gtk-grub.c b/source/ubinstall-gtk-grub.c index 2d65341..749f496 100644 --- a/source/ubinstall-gtk-grub.c +++ b/source/ubinstall-gtk-grub.c @@ -26,7 +26,7 @@ int yon_grub_install_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -60,7 +60,7 @@ int yon_grub_update_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index ce9c789..15a1863 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -35,7 +35,7 @@ int yon_install_common_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -105,7 +105,7 @@ int yon_install_separate_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } @@ -163,7 +163,7 @@ int yon_install_same_partition_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index 05d660b..2ca7d6e 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -58,7 +58,7 @@ int yon_keyboard_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index b3f1766..81f85f8 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -291,7 +291,7 @@ int yon_network_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,save_size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,save_size); } diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 52522d9..65def82 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -29,13 +29,17 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_RECOVERY_GRUB_UPDATE: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_RECOVERY_OS_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_RECOVERY_USRDATA_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_INSTALLATION_BEGIN; break; - // case YON_PAGE_COMPLETED: + case YON_PAGE_INSTALLATION: break; + case YON_PAGE_CONFIGURE_SAVE: break; + case YON_PAGE_COMPLETED: case YON_PAGE_INSTALL_ERROR: case YON_PAGE_CONFIGURE_END: case YON_PAGE_COMPLETION: on_reboot_accepted(widgets); + gtk_main_quit(); + exit(0); break; - default:return YON_PAGE_WELCOME; + // default:return YON_PAGE_WELCOME; } return YON_PAGE_WELCOME; } @@ -291,7 +295,7 @@ void yon_switch_page_render(main_window *widgets){ void yon_configuration_mode_check(main_window *widgets){ enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); - if (page==YON_PAGE_WELCOME){ + if (page==YON_PAGE_WELCOME&&!main_config.force_ini){ gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); } else { gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0); @@ -426,9 +430,20 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,1); yon_page_update(widgets); + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text=INTERRUPT_TEXT_LABEL; + data->title=WARNING_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ + if (main_config.install_thread){ + gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); + gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); + pthread_cancel((pthread_t)main_config.install_thread); + } + } } void on_system_setup_pass(GtkWidget *, main_window *widgets){ + main_config.save_configured=1; if (main_config.configure_mode){ gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_CONFIGURE_END); } else { diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 69135ab..9732ec9 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -45,7 +45,7 @@ int yon_region_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index c59c8b6..ac7102b 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -29,15 +29,8 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ yon_config_load_config(type,yon_config_get_command(main_config.config_load_path),NULL); } else if (type==YON_CONFIG_CUSTOM){ textdomain(template_ui_LocaleName); - GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + GtkWidget *dialog = yon_config_save_window_new(); textdomain(LocaleName); - gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubl-settings-services"); - gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); - GtkFileFilter *filter = gtk_file_filter_new(); - gtk_file_filter_add_pattern(filter,"*.ini"); - gtk_file_filter_set_name(filter, "*.ini"); - gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); - gtk_widget_show(dialog); int response = gtk_dialog_run(GTK_DIALOG(dialog)); if (response == GTK_RESPONSE_ACCEPT){ char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); @@ -56,8 +49,11 @@ 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 +62,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); @@ -571,25 +571,29 @@ void *on_config_save(void *data){ g_signal_connect(G_OBJECT(widgets->install_info_monitor),"changed",G_CALLBACK(yon_installation_progress_update),widgets); g_object_unref(file_desc); gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); - char *command = yon_debug_output("%s\n",save_config_command(yon_char_parsed_to_string(parameters,size," "))); - yon_char_parsed_free(parameters,size); - yon_debug_output("%s\n","Entered installation"); - if (system(yon_debug_output("%s\n",command))){ - - gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); + if (!main_config.dry_run){ + char *command = yon_debug_output("%s\n",save_config_command(yon_char_parsed_to_string(parameters,size," "))); + yon_char_parsed_free(parameters,size); + yon_debug_output("%s\n","Entered installation"); + if (system(yon_debug_output("%s\n",command))){ + + gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); + free(command); + g_mutex_lock(&main_config.install_mutex); + main_config.install_complete=1; + g_mutex_unlock(&main_config.install_mutex); + return 0; + }; free(command); g_mutex_lock(&main_config.install_mutex); main_config.install_complete=1; g_mutex_unlock(&main_config.install_mutex); - return 0; - }; - free(command); - g_mutex_lock(&main_config.install_mutex); - main_config.install_complete=1; - g_mutex_unlock(&main_config.install_mutex); - if ((!main_config.save_done)&&main_config.save_configured){ - on_setup_system_configuration(widgets); - on_page_next_clicked(NULL,widgets); + if ((!main_config.save_done)&&main_config.save_configured){ + on_setup_system_configuration(widgets); + on_page_next_clicked(NULL,widgets); + } + } else { + yon_launch("ubconfig --source system get /"); } return 0; } @@ -674,12 +678,17 @@ void *on_setup_system_configuration(void * data){ } + + if (!main_config.dry_run){ char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); char *command = set_user_config_command(parameter_string); if (system(yon_debug_output("%s\n",command))){}; yon_char_parsed_free(all_parameters,size); free(command); if (parameter_string) free(parameter_string); + } else { + yon_launch("ubconfig --source system get /"); + } } g_idle_add((GSourceFunc)on_install_success,widgets); return NULL; diff --git a/source/ubinstall-gtk-separate.c b/source/ubinstall-gtk-separate.c index 3485f71..5403d94 100644 --- a/source/ubinstall-gtk-separate.c +++ b/source/ubinstall-gtk-separate.c @@ -28,7 +28,7 @@ int yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char * if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-startup-services.c b/source/ubinstall-gtk-startup-services.c index 4ad1d67..45bb8db 100644 --- a/source/ubinstall-gtk-startup-services.c +++ b/source/ubinstall-gtk-startup-services.c @@ -216,7 +216,7 @@ int yon_startup_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,size); } diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index 43631f5..18db20c 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -41,7 +41,7 @@ int yon_users_save(main_window *widgets){ if (parameters){ char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(command)){} + if (!system(yon_debug_output("%s\n",command))){} free(command); yon_char_parsed_free(parameters,save_size); } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index dcb080a..fd64d2c 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1,6 +1,135 @@ #include "ubinstall-gtk.h" config main_config; +void yon_open_browser(GtkWidget *, char *link){ + GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); + if (window) + gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +} + +void on_open_documentation_confirmation(GtkWidget *self, char *link){ + if (template_app_information.always_open_documentation==0){ + GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); + template_documentation_confirmation_window *window = malloc(sizeof(template_documentation_confirmation_window)); + window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); + window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); + window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); + window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); + gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); + gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); + gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",LocaleName)); + gtk_widget_show_all(window->Window); + g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + + } else { + yon_open_browser(self,link); + } +} + +/**on_link(GtkWidget *self, char* uri, gpointer user_data) + * [EN] + * Signal for hadnling AboutDialog links. + * Connect to "activate-link" signal. + * [self] is AboutDialog window; + * [uri] is activated link; + * [user_data] is pointer for user data, hasn't used in standard handler; + * [RU] + * Функция для обработки сигнала нажатия на ссылку окна AboutDialog. + * Присоединять к сигналу "activate-link". + * [self] - окно AboutDialog; + * [uri] - ссылка, по которой совершается переход; + * [user_data] - указатель на любые другие данные, не используется в стандартном обработчике; +*/ +void on_link(GtkWidget *self, char* uri, gpointer ){ + gtk_widget_destroy(self); + on_open_documentation_confirmation(self,uri); +} + +void on_about(GtkWidget *, char *version_application){ + GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); + GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); + GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); + GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); + gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); + gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); + char *title_str = ABOUT_TITLE_LABEL; + gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); + gtk_label_set_text(GTK_LABEL(title),ABOUT_TITLE_LABEL); + g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL); + gtk_widget_set_visible(hideButtonBox,0); + gtk_widget_destroy(hideButtonBox); + gtk_window_set_title(GTK_WINDOW(window),title_str); + gtk_widget_show(window); +} + +//functions + + +int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){ + textdomain(template_ui_LocaleName); + GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,GTK_WINDOW(gtk_widget_get_toplevel(self)),GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL); + textdomain(LocaleName); + gtk_window_set_modal(GTK_WINDOW(dialog),1); + gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); + gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); + gtk_widget_set_size_request(dialog,450,-1); + GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_header_bar(GTK_DIALOG(dialog)))); + GtkWidget *image_cancel = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.cancel-symbolic",GTK_ICON_SIZE_BUTTON); + GtkWidget *image_accept = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.accept-symbolic",GTK_ICON_SIZE_BUTTON); + gtk_button_set_image((GtkButton*)g_list_nth_data(list,0),image_cancel); + gtk_button_set_image((GtkButton*)g_list_nth_data(list,1),image_accept); + gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,0)),"marginright"); + gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,1)),"marginright"); + + g_list_free(list); + GtkWidget *header_label = gtk_label_new(yon_char_is_empty(data->title)?TITLE_LABEL:data->title); + gtk_widget_show(header_label); + PangoAttrList *attributes = pango_attr_list_new(); + PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); + pango_attr_list_insert(attributes, boldAttr); + gtk_label_set_attributes(GTK_LABEL(header_label),attributes); + + GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); + gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label); + gtk_widget_show(header); + + GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG); + gtk_widget_show(image); + gtk_widget_set_margin_start(image,20); + gtk_widget_set_margin_end(image,20); + gtk_widget_set_margin_bottom(image,20); + gtk_widget_set_margin_top(image,20); + + GtkWidget *label = gtk_label_new(""); + gtk_widget_set_margin_end(label,20); + gtk_widget_show(label); + gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD); + gtk_label_set_line_wrap(GTK_LABEL(label),1); + gtk_label_set_markup(GTK_LABEL(label),data->action_text); + + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + gtk_widget_show(box); + gtk_box_pack_start(GTK_BOX(box),image,0,0,5); + gtk_box_pack_start(GTK_BOX(box),label,0,0,5); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); + + gtk_window_set_default_size(GTK_WINDOW(dialog),450,-1); + + int resp = gtk_dialog_run(GTK_DIALOG(dialog)); + if (resp == GTK_RESPONSE_ACCEPT){ + if (data->function){ + data->function(NULL,data->data); + } + } else resp=0; + gtk_widget_destroy(dialog); + return resp; +} // //functions // void yon_encryption_type_setup(GtkComboBoxText *target){ @@ -127,6 +256,21 @@ double yon_size_long_convert_to_mod(double size, char mod){ return final_size; } +void on_source_changed(GtkComboBox *self){ + GtkWidget *devices_combo = g_object_get_data(G_OBJECT(self),"target"); + GtkWidget *path_button = g_object_get_data(G_OBJECT(self),"button"); + GtkWidget *path_combo = g_object_get_data(G_OBJECT(self),"combo"); + if (gtk_combo_box_get_active(self)){ + gtk_widget_show(path_button); + gtk_widget_show(path_combo); + gtk_widget_hide(devices_combo); + } else{ + gtk_widget_hide(path_button); + gtk_widget_hide(path_combo); + gtk_widget_show(devices_combo); + } +} + source_element *yon_source_element_new(){ source_element *element = new(source_element); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_source_element); @@ -134,19 +278,46 @@ source_element *yon_source_element_new(){ element->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); element->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); element->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry"); + element->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo"); element->PathButton = yon_gtk_builder_get_widget(builder,"PathButton"); element->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); g_signal_connect(G_OBJECT(element->RemoveButton),"clicked",G_CALLBACK(on_source_remove),element); g_signal_connect(G_OBJECT(element->PathButton),"clicked",G_CALLBACK(on_source_choose),element); + g_signal_connect(G_OBJECT(element->TypeCombo),"changed",G_CALLBACK(on_source_changed),element); g_object_set_data(G_OBJECT(element->PathButton),"combo",element->TypeCombo); + g_object_set_data(G_OBJECT(element->PathButton),"target_combo",element->TypeCombo); + g_object_set_data(G_OBJECT(element->TypeCombo),"target",element->DeviceCombo); + g_object_set_data(G_OBJECT(element->TypeCombo),"button",element->PathButton); + g_object_set_data(G_OBJECT(element->TypeCombo),"combo",element->PathEntry); + int size; + config_str parts = yon_config_load(get_parts_and_devices_command, &size); + for (int i=0;iDeviceCombo),parsed[1],parsed[1]); + } + yon_char_parsed_free(parsed,parsed_size); + } + gtk_combo_box_set_active(GTK_COMBO_BOX(element->DeviceCombo),0); + yon_char_parsed_free(parts,size); return element; } void yon_source_element_add(char *key,void*,source_window *window){ source_element *element = yon_source_element_new(); - gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key); + if (yon_char_check_begins_with(key,"/dev/")){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(element->DeviceCombo),key); + gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),0); + } else if (g_regex_match_simple(".*\\.iso",key,G_REGEX_DEFAULT,G_REGEX_MATCH_DEFAULT)){ + gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key); + gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),2); + } else { + gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key); + gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),1); + } gtk_box_pack_start(GTK_BOX(window->AddBox),element->MainBox,0,0,0); g_object_set_data(G_OBJECT(element->MainBox),"window",window); g_object_set_data(G_OBJECT(element->PathButton),"target",window->PathEntry); @@ -158,22 +329,32 @@ void yon_source_update(source_window *window){ for (iter=list;iter;iter=iter->next){ gtk_widget_destroy(GTK_WIDGET(iter->data)); } - g_hash_table_foreach(window->sources,(GHFunc)yon_source_element_add,window); + dictionary *dict; + if (!window->sources) return; + for_dictionaries(dict,window->sources){ + yon_source_element_add(dict->key,NULL,window); + + } } void on_source_add(GtkWidget *,source_window *window){ - const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry)); - if (!g_hash_table_contains(window->sources,path)){ - g_hash_table_add(window->sources,yon_char_new(path)); + const char *path = gtk_widget_get_visible(window->PathEntry)?gtk_entry_get_text(GTK_ENTRY(window->PathEntry)):gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->DeviceCombo)); + if (!yon_dictionary_get(&window->sources,(char*)path)){ + yon_dictionary_add_or_create_if_exists_with_data(window->sources,yon_char_new(path),NULL); + gtk_entry_set_text(GTK_ENTRY(window->PathEntry),""); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceCombo),0); yon_source_update(window); + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),VALUE_REPEAT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); } } void on_source_remove(GtkWidget *,source_element *element){ source_window *window = g_object_get_data(G_OBJECT(element->MainBox),"window"); - const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry)); - if (g_hash_table_contains(window->sources,path)){ - g_hash_table_remove(window->sources,path); + const char *path = gtk_widget_get_visible(element->PathEntry)?gtk_entry_get_text(GTK_ENTRY(element->PathEntry)):gtk_combo_box_get_active_id(GTK_COMBO_BOX(element->DeviceCombo)); + dictionary *dict = yon_dictionary_get(&window->sources,(char*)path); + if (dict){ + window->sources = yon_dictionary_rip(dict); yon_source_update(window); } } @@ -182,9 +363,6 @@ void on_source_choose(GtkWidget *self){ GtkWidget *target_entry = g_object_get_data(G_OBJECT(self),"target"); GtkWidget *target_mode = g_object_get_data(G_OBJECT(self),"combo"); switch (gtk_combo_box_get_active(GTK_COMBO_BOX(target_mode))){ - case 0: { - - } break; case 1:{ filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(dialog->Window),OPEN_LABEL,icon_path,"filechooser_window"); @@ -214,9 +392,24 @@ void on_source_choose(GtkWidget *self){ void on_source_accept(GtkWidget *,source_window *window){ if (gtk_switch_get_active(GTK_SWITCH(window->AutoSwitch))){ yon_config_register(source_parameter,source_parameter_command,"auto"); + on_subwindow_close(window->Window); + return; + } + const char *creation_path = gtk_widget_get_visible(window->PathEntry)? gtk_entry_get_text(GTK_ENTRY(window->PathEntry)):NULL; + if (!yon_char_is_empty(creation_path)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),SOURCE_CREATE_ONGOING_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + } + int size; + config_str paths = NULL; + dictionary *dict; + if (!window->sources) return; + for_dictionaries(dict,window->sources){ + if (yon_char_parsed_check_exist(paths,size,dict->key)>-1){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),VALUE_REPEAT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + yon_char_parsed_add_or_create_if_exists(paths,&size,dict->key); } - guint size; - config_str paths = (config_str)g_hash_table_get_keys_as_array(window->sources,&size); if (!size){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->PathEntry); @@ -238,6 +431,8 @@ void on_source_accept(GtkWidget *,source_window *window){ yon_char_parsed_free(parameters,size); } } + yon_dictionary_free_all(window->sources,NULL); + free(window); } source_window *yon_source_window_new(){ @@ -251,28 +446,52 @@ source_window *yon_source_window_new(){ window->AutoSwitch = yon_gtk_builder_get_widget(builder,"AutoSwitch"); window->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); window->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry"); + window->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo"); window->PathButton = yon_gtk_builder_get_widget(builder,"PathButton"); window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton"); window->AddBox = yon_gtk_builder_get_widget(builder,"AddBox"); - window->sources = g_hash_table_new(g_str_hash,g_str_equal); + window->sources = NULL; g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_source_accept),window); g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_source_add),window); g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_source_choose),window); - g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->AddBox); - g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->TypeCombo); - g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->AddButton); - g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathButton); - g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathEntry); + g_signal_connect(G_OBJECT(window->TypeCombo),"changed",G_CALLBACK(on_source_changed),window); + g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),gtk_widget_get_parent(gtk_widget_get_parent(window->AddBox))); g_object_set_data(G_OBJECT(window->PathButton),"combo",window->TypeCombo); g_object_set_data(G_OBJECT(window->PathButton),"target",window->PathEntry); + g_object_set_data(G_OBJECT(window->TypeCombo),"target",window->DeviceCombo); + g_object_set_data(G_OBJECT(window->TypeCombo),"button",window->PathButton); + g_object_set_data(G_OBJECT(window->TypeCombo),"combo",window->PathEntry); + int size; + config_str parts = yon_config_load(get_parts_and_devices_command, &size); + for (int i=0;iDeviceCombo),parsed[1],parsed[1]); + } + yon_char_parsed_free(parsed,parsed_size); + } + gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceCombo),0); + yon_char_parsed_free(parts,size); return window; } void on_source_clicked(GtkWidget *,main_window *widgets){ source_window *window = yon_source_window_new(); + char *sources = config(source_parameter); + if (!yon_char_is_empty(sources)&&strcmp(sources,"auto")){ + gtk_switch_set_active(GTK_SWITCH(window->AutoSwitch),0); + int size; + config_str parsed = yon_char_parse(sources,&size,","); + for (int i=0;isources,parsed[i],NULL); + } + yon_char_parsed_free(parsed,size); + } g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + yon_source_update(window); gtk_widget_show(window->Window); } @@ -331,6 +550,8 @@ void config_init(){ main_config.config_load_path = NULL; main_config.config_save_path = NULL; yon_packages_init(); + main_config.dry_run=0; + main_config.force_ini=NULL; main_config.network_types = g_hash_table_new(g_str_hash,g_str_equal); main_config.cur_slide=0; } @@ -353,7 +574,6 @@ void on_gparted_open(){ yon_launch_app_with_arguments(open_gparted_command,NULL); } - void on_reboot_accepted(main_window *){ g_mutex_lock(&main_config.install_mutex); if (main_config.install_thread){ @@ -380,7 +600,7 @@ gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){ if (!main_config.exit_accepted||(main_config.save_done&&main_config.install_complete)){ if (widgets){}; dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); - data->action_text=WARNING_TEXT_LABEL; + data->action_text=INTERRUPT_TEXT_LABEL; data->title=WARNING_TITLE_LABEL; if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ on_exit_accepted(widgets); @@ -933,6 +1153,9 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedVirtualDeviceCombo),"changed",G_CALLBACK(on_advanced_virtual_device_changed),widgets); + g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); + g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); + gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),(GtkTreeModelFilterVisibleFunc)on_country_filter,widgets,NULL); { @@ -996,6 +1219,15 @@ 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){ + main_config.configure_mode=1; + 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); // { @@ -1033,8 +1265,28 @@ int main(int argc, char *argv[]){ config_init(); config_str unfound = NULL; int size=0; - yon_ubl_connect_config((_template_config*)&main_config); - yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL); + yon_ubl_connect_config((_template_config*)&main_config); + opterr=0; + yon_ubl_window_init(TITLE_LABEL,"",LocaleName,CssPath,LocaleName,version_application,WIKI_LINK); + yon_ubl_setup_arguments(argc,argv,&unfound,&size,ADDITIONAL_ARGS); + if (size) { + int option_index = 0; + struct option long_options[] = { + {"dry-run", 0, 0, 'D'}, + {NULL, 0, NULL, 0} + }; + optind = 1; + for (int i = 0; i < size; i++) { + int argument = getopt_long(argc, argv, "D", long_options, &option_index); + switch (argument) { + case 'D': + main_config.dry_run = 1; + break; + default: + break; + } + } + } gtk_init(&argc,&argv); main_window *widgets = NULL; widgets = yon_main_window_complete(); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 98729f2..02e1875 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -17,7 +17,7 @@ #endif #include "ubl-strings.h" -#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubinstall-gtk" +#define WIKI_LINK "https://wiki.ublinux.com/Software/Programs_and_utilities/All/ubinstall-gtk" #define _(String) gettext(String) @@ -94,7 +94,7 @@ NULL -#define get_modules_command "pacman --color never -Ss ^ubm- | sed -Enr -e 'N;s/\\n/ ;/' -e \"s/^([^\\/]+)\\/([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)[[:blank:]]+(\\(([^\\)]+)\\)[^\\;]+|[^\\;]*);[[:blank:]]*(.*)/\\2;\\3;\\5;\\6/p\"" +#define get_modules_command "pacman --color never -Qs ^ubm- | sed -Enr -e 'N;s/\\n/ ;/' -e \"s/^([^\\/]+)\\/([^[:blank:]]+)[[:blank:]]+([^[:blank:]]+)[[:blank:]]+(\\(([^\\)]+)\\)[^\\;]+|[^\\;]*);[[:blank:]]*(.*)/\\2;\\3;\\5;\\6/p\"" #define get_local_module_info_command(target) yon_char_unite("pacman --color never -Sp $(pacman -Ssq '",target,"') --print-format '%n;%v;%d' | grep -v \"^::\"",NULL); @@ -395,9 +395,8 @@ typedef struct { GHashTable *network_types; GtkWidget *kernel_unchosen_radio; - char *config_load_path; - char *config_save_path; unsigned int cur_slide; + gboolean dry_run; } config; extern config main_config; @@ -924,16 +923,19 @@ typedef struct { GtkWidget *AutoSwitch; GtkWidget *TypeCombo; GtkWidget *PathEntry; + GtkWidget *DeviceCombo; GtkWidget *PathButton; GtkWidget *AddButton; GtkWidget *AddBox; - GHashTable *sources; + dictionary *sources; } source_window; + typedef struct { GtkWidget *MainBox; GtkWidget *TypeCombo; GtkWidget *PathEntry; + GtkWidget *DeviceCombo; GtkWidget *PathButton; GtkWidget *RemoveButton; @@ -962,6 +964,14 @@ typedef struct { advanced_partition *partition_widgets; } advanced_section; +struct row_data { + main_window *widgets; + char *version; + char *name; + char *tags; + char *description; +}; + void config_init(); main_window *yon_main_window_complete(); @@ -1164,7 +1174,7 @@ void set_locales_list(main_window *widgets); void on_installer_language_changed(GtkWidget *self, main_window *widgets); gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *widgets); int yon_char_parsed_compare(const void *a, const void *b); -gboolean yon_os_component_insert(os_row *row); +gboolean yon_os_component_insert(struct row_data *row_input); void *yon_os_components_setup(main_window *widgets); gboolean yon_spinner_switch_off(GtkSpinner *target); void on_advanced_added(GtkWidget *, char *, main_window *); @@ -1188,4 +1198,7 @@ int yon_advanced_section_get_by_part(advanced_partition *part); void yon_advanced_section_remove_by_name(char *part); void on_advanced_virtual_device_changed(GtkWidget *, main_window *widgets); int yon_advanced_section_append(advanced_section *section); -gboolean on_format_changed(GtkWidget *self, gboolean state, advanced_partition *part); \ No newline at end of file +gboolean on_format_changed(GtkWidget *self, gboolean state, advanced_partition *part); +int yon_layouts_get(); +void on_link(GtkWidget *self, char* uri, gpointer ); +void on_source_changed(GtkComboBox *self); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 29b814d..04c031f 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -1,11 +1,16 @@ -#define TITLE_LABEL _("UBLinux installation") +#define TITLE_LABEL _("System installation") -#define WELCOME_LABEL _("Welcome to UBLinux installation") -#define WELCOME_BOTTOM_LABEL _("This program will ask you few questions\nand help you install UBLinux on your computer") +#define WELCOME_LABEL _("Welcome to system installation") +#define WELCOME_BOTTOM_LABEL _("This program will ask you few questions\nand help you install system on your computer") #define OPEN_LABEL _("Open") +#define ADDITIONAL_ARGS yon_char_unite(\ + " --dry-run ",_("Dry run; Installation will not start"),"\n",\ + " --ini ", _("Set ini file for configuration mode"),\ +NULL) + #define KEYBOARD_TITLE_LABEL _("Keyboard layout") #define CUSTOM_CONFIG_CREATION_ERROR_LABEL _("New configuration file creation failed") @@ -21,11 +26,11 @@ #define KEYBOARD_TAB_LABEL _("Keyboard") #define USERS_TAB_LABEL _("Users") #define COMPLETION_TAB_LABEL _("Installation completion") -#define COMMON_INSTALL_INFO_LABEL _("Deleting all data on the selected disk and then installing the UBLinux system") +#define COMMON_INSTALL_INFO_LABEL _("Deleting all data on the selected disk and then installing the system") #define NEAR_INSTALL_LABEL _("Installation next to another system") #define NEAR_INSTALL_INFO_LABEL _("Shrinking a partition and creating a new one for installing OS") #define SHRINK_SECTION_INSTALL_LABEL _("Installation on the same partition as another system") -#define SHRINK_SECTION_INSTALL_INFO_LABEL _("Unpacking the UBLinux file system into an existing system") +#define SHRINK_SECTION_INSTALL_INFO_LABEL _("Unpacking the file system into an existing system") #define ADDITIONAL_INSTALL_INFO_LABEL _("Selecting additional software to install from the repository via the Internet") #define CHOSEN_LABEL _("Chosen") #define MODULE_NAME_LABEL _("Module name") @@ -56,12 +61,12 @@ #define INSTALLATION_COMPLETION_LABEL _("Installation completion") #define SELECT_DEVICE_LABEL _("Select device:") #define CHOOSE_SECTION_LABEL _("Choose a section:") -#define ATTENSION_LABEL _("Attention! The selected partition will be modified: the size will be reduced. In the resulting free space, a partition will be created into which the UBLinux OS will be\ninstalled.") +#define ATTENSION_LABEL _("Attention! The selected partition will be modified: the size will be reduced. In the resulting free space, a partition will be created into which the system will be\ninstalled.") #define DEVICE_LABEL _("Device") #define MARK_LABEL _("Label") #define SIZE_LABEL _("Size") #define FREE_LABEL _("Free") -#define SPECIFY_LABEL _("Specify the size of the new partition for UBLinux OS:") +#define SPECIFY_LABEL _("Specify the size of the new partition for system:") #define TB_LABEL _("Tb") #define GB_LABEL _("Gb") #define MB_LABEL _("Mb") @@ -74,7 +79,7 @@ #define ADVANCED_INSTALLATION_HEAD_LABEL _("Advanced installation mode") #define ADVANCED_INSTALLATION_LABEL _("Installing OS files, user data on different partitions, creating RAID, etc.") -#define ADVANCED_INSTALLATION_ATTENTION_LABEL _("Attention! The selected OS UBLinux components will be installed\nseparately into the selected partition.") +#define ADVANCED_INSTALLATION_ATTENTION_LABEL _("Attention! The selected system components will be installed\nseparately into the selected partition.") #define GRUB_INSTALL_HEAD_LABEL _("GRUB install") #define GRUB_INSTALL_LABEL _("Install the GRUB bootloader") #define GRUB_UPDATE_HEAD_LABEL _("GRUB update") @@ -104,7 +109,7 @@ #define SECTION_NAME_LABEL _("Section name:") #define FORMAT_LABEL _("Format") -#define INSTALL_SUCCESS_LABEL _("You have UBLinux installed on your computer.\nYou can reboot and use your new system\nor continue working in the UBLinux Live environment.") +#define INSTALL_SUCCESS_LABEL _("You have system installed on your computer.\nYou can reboot and use your new system\nor continue working in the system Live environment.") #define LANGUAGES_TITLE_LABEL _("Available languages in the system") #define LAYOUTS_TITLE_LABEL _("Keyboard layout language") @@ -121,7 +126,7 @@ #define DEFAULT_MODEL_LABEL _("Default (Regular 105-key)") #define INSTALL_BEGIN_HEADER_LABEL _("Installation configuration has ended") -#define INSTALL_BEGIN_LABEL _("UBLinux OS installation is about to begin") +#define INSTALL_BEGIN_LABEL _("System installation is about to begin") #define DOCUMENTATION_LABEL _("Documentation") #define ABOUT_LABEL _("About") @@ -132,7 +137,7 @@ #define OPEN_DOCUMENTATION_LABEL _("Open documentation") #define INSTALLATION_ERROR _("Installation error") -#define ATTENTION_NEXT_LABEL _("Attention! The UBLinux OS will be installed on the selected partition with OS already installed. All user data will be saved.") +#define ATTENTION_NEXT_LABEL _("Attention! The system will be installed on the selected partition with OS already installed. All user data will be saved.") #define INSTALLATION_OPTIONS_LABEL _("Installation options") @@ -184,6 +189,7 @@ #define WARNING_TITLE_LABEL _("Warning") #define WARNING_TEXT_LABEL _("Are you sure want to exit and\ninterrupt installation process?") +#define INTERRUPT_TEXT_LABEL _("Are you sure want to interrupt installation process?") #define WARNING_REBOOT_TEXT_LABEL _("Are you sure want to reboot system?") #define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") @@ -217,6 +223,9 @@ #define PARITY_INVALID_LABEL(target) yon_char_unite(_("Cu"),target,NULL) #define COUNT_INVALID_LABEL(target) yon_char_unite(_("Cues"),target,NULL) +#define ABOUT_TITLE_LABEL _("About system installation") +#define VALUE_REPEAT_LABEL _("Repeating values") +#define SOURCE_CREATE_ONGOING_ERROR_LABEL _("Source creation were not done") // #define _LABEL _("New section at") // #define _LABEL _("\"/ublinux-data/\" user data section") // #define _LABEL _("\"/ublinux/\" system section") @@ -268,8 +277,8 @@ // #define _LABEL _("Swap file") // #define _LABEL _("Corresponds to RAM size") // #define _LABEL _("Fixed size:") -// #define _LABEL _("Attention! The UBLinux OS will be installed on the selected partition with OS already installed. All user data will be saved.") -// #define _LABEL _("Attention! The selected OS UBLinux components will be installed\nseparately into the selected partition.") +// #define _LABEL _("Attention! The system will be installed on the selected partition with OS already installed. All user data will be saved.") +// #define _LABEL _("Attention! The selected system components will be installed\nseparately into the selected partition.") // #define _LABEL _("Enable VNC server") // #define _LABEL _("Preparation") // #define _LABEL _("Additional") diff --git a/ubinstall-gtk-os-row.glade b/ubinstall-gtk-os-row.glade index b9ff25b..58c5b7e 100644 --- a/ubinstall-gtk-os-row.glade +++ b/ubinstall-gtk-os-row.glade @@ -6,7 +6,7 @@ True False - 11 + 5 True @@ -14,36 +14,73 @@ False True True - - - False - True - 0 - - - - - True - False - 1 - vertical - 1 True False - 7 + 1 + vertical + 1 - + True False - Name - 0 - False - 0 - - - + 7 + + + True + False + Name + 0 + False + 0 + + + + + + False + True + 0 + + + + + True + False + Version + True + 15 + False + 0 + + + False + True + 1 + + + + + True + False + start + 3 + 5 + 2 + + + + + + False + True + 6 + + + False @@ -52,81 +89,39 @@ - + True False - Version - True - 15 - False + 2 + Description 0 + 0 - False + True True + end 1 - + True False - start - 3 - 5 - 2 - - - False True - 6 + 2 - - - - False - True - 0 - - - - - True - False - 2 - Description - 0 - 0 - - True - True - end - 1 - - - - - True - False - - - False - True - 2 - True True - 1 + 0