From 1cf1259ca5bba1940cb5cba03b9b51fd134da37f Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Mon, 1 Dec 2025 17:58:44 +0600 Subject: [PATCH] Changes --- source/ubinstall-gtk-components.c | 55 +++++------ source/ubinstall-gtk-configuration-mode.c | 30 +++++- source/ubinstall-gtk-page-switch.c | 8 +- source/ubl-strings.h | 3 + ubinstall-gtk-os-row.glade | 3 +- ubinstall-gtk.glade | 106 ++++++++++------------ 6 files changed, 107 insertions(+), 98 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index ee5bc3f..fbef016 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -204,7 +204,14 @@ void yon_os_components_init(main_window *widgets){ list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); for(iter = list;iter;iter=iter->next){ os_row *row = g_object_get_data(iter->data,"kernel_row"); - gtk_widget_set_size_request(row->NameLabel,size,-1); + int cur_size = 0; + gtk_widget_realize(row->RowBox); + gtk_widget_get_preferred_width(row->RowBox,&cur_size,NULL); + if (sizenext){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + gtk_widget_set_size_request(row->RowBox,size,-1); } } @@ -260,37 +267,23 @@ int yon_software_save(main_window *widgets){ } void yon_software_init(main_window *widgets){ - GtkTreeIter iter; - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter)){ - int size; - config_str parsed = NULL; - parsed = yon_resource_open_file(additional_software_path,&size); - for (int i=1;iAdditionalSoftwareList,&iter); - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],2,module_parsed[1],3,module_parsed[2],-1); //2,module_parsed[2] - yon_char_parsed_free(module_parsed,module_size); - } - } - if (size) yon_char_parsed_free(parsed,size); - } - - char *modules = config(modules_extra_parameter); - - int size; - config_str parsed = yon_char_parse(modules,&size,","); - for_iter(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter){ - char *target; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,1,&target); - if (yon_char_parsed_check_exist(parsed,size,target)>-1){ - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,-1); - } else { - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,0,-1); - } + int base_size; + config_str base = yon_config_load(get_modules_command,&base_size); + for (int i=0;iversion = parsed[1]; + row->name = parsed[0]; + row->tags = yon_char_replace(parsed[2]," ",", "); + row->description = parsed[3]; + row->widgets=widgets; + g_idle_add((GSourceFunc)yon_os_component_insert,row); } - yon_char_parsed_free(parsed,size); + g_idle_add((GSourceFunc)yon_spinner_switch_off,widgets->OSSpinner); + yon_char_parsed_free(base,base_size); + return NULL; } int yon_pacman_software_save(main_window *widgets){ diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index 2e97ea6..1d0ef6a 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -7,8 +7,28 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){ yon_ubl_status_highlight_incorrect(window->PathEntry); return; } - if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path); - main_config.config_save_path = yon_char_new(path); + + if (access(path,F_OK)){ + int homedir_create = 0; + if (!strstr(path,"/")){ + homedir_create = 1; + } + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL; + data->title = WARNING_TITLE_LABEL; + if (yon_confirmation_dialog_call(window->Window,data)==GTK_RESPONSE_ACCEPT){ + char *full_path = NULL; + if (homedir_create){ + full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL); + } else { + full_path = yon_char_new(path); + } + + yon_launch(ubconfig_file_create(full_path)); + } else return; + } + if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path); + main_config.config_save_path = yon_char_new(path); gtk_widget_destroy(window->Window); } @@ -29,6 +49,9 @@ void on_configuration_exit(GtkWidget *,configuration_window *window){ main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),0); gtk_widget_destroy(window->Window); + if (getuid()){ + gtk_main_quit(); + } } void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ @@ -48,6 +71,9 @@ void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_path_choose),window); g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),CONFIGURATION_MODE_TITLE_LABEL,icon_path,"configuration_window"); + if (getuid()){ + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"force_configure_mode",ROOT_FORCE_CONFIGURATION_MODE_LABEL,BACKGROUND_IMAGE_INFO_TYPE); + } if (!yon_char_is_empty(main_config.config_save_path)) gtk_entry_set_text(GTK_ENTRY(window->PathEntry),main_config.config_save_path); gtk_widget_show(window->Window); diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 24ca3c8..22b2787 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -8,12 +8,12 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_WELCOME: return YON_PAGE_LICENCE; break; case YON_PAGE_LICENCE: return YON_PAGE_SECTIONS; break; case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; - case YON_PAGE_OS_COMPONENTS: return main_config.configure_mode? YON_PAGE_KERNEL : YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SOFTWARE; break; + case YON_PAGE_SOFTWARE: return main_config.configure_mode? YON_PAGE_KERNEL : YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; case YON_PAGE_KERNEL: return YON_PAGE_KERNEL_ADDON; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_REGION; - case YON_PAGE_SOFTWARE: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; @@ -50,11 +50,11 @@ enum YON_PAGES yon_page_get_prev(enum YON_PAGES page){ case YON_PAGE_LICENCE: return YON_PAGE_WELCOME; break; case YON_PAGE_SECTIONS: return YON_PAGE_LICENCE; break; case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SECTIONS; break; - case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_SECTIONS; break; + case YON_PAGE_SOFTWARE: return YON_PAGE_OS_COMPONENTS; break; + case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_SOFTWARE; break; case YON_PAGE_KERNEL: return YON_PAGE_SECTIONS; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_KERNEL; break; case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_KERNEL_ADDON; break; - case YON_PAGE_SOFTWARE: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_REGION: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_KEYBOARD: return YON_PAGE_REGION; break; case YON_PAGE_USERS: return YON_PAGE_KEYBOARD; break; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 8afdaaa..b5552cf 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -227,6 +227,9 @@ 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 CREATE_CONFIG_DIALOG_LABEL _("Configuration file does not exist. Create new configuration file?") +#define CREATE_CONFIG_DIALOG_LABEL_HOMEDIR _("Configuration file does not exist. Create new configuration file? New configuration file will be created at your user's home directory") +#define ROOT_FORCE_CONFIGURATION_MODE_LABEL _("Warning! Application was launched without root. Only configuration mode is allowed.") // #define _LABEL _("New section at") // #define _LABEL _("\"/ublinux-data/\" user data section") // #define _LABEL _("\"/ublinux/\" system section") diff --git a/ubinstall-gtk-os-row.glade b/ubinstall-gtk-os-row.glade index 58c5b7e..e3cd295 100644 --- a/ubinstall-gtk-os-row.glade +++ b/ubinstall-gtk-os-row.glade @@ -64,7 +64,7 @@ True False - start + center 3 5 2 @@ -75,6 +75,7 @@ False True + end 6 diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 53a7dd8..a55258b 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -3,18 +3,6 @@ - - - - - - - - - - - - 100 1 @@ -2196,63 +2184,61 @@ and help you install system on your computer 5 5 - + True - True - in + False - + True - True - AdditionalSoftwareList - 0 - - - - - - - - - 0 - - - - - - - Module name - - - - 1 - - - - - - - Type - - - - 2 - - - - + False + vertical + 5 - - Description + + True + True - - - 3 - + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + none + + + True + True + 1 + + + + + + + True + True + 1 + + + -1 +