From bb51507b8964c688b87901dec1737fb5ad8c29ed Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 23 Sep 2025 18:14:35 +0600 Subject: [PATCH 1/9] Languages loading rework --- source/ubinstall-gtk.c | 229 ++++++++++++++++------------------------- source/ubinstall-gtk.h | 3 +- ubinstall-gtk.css | 5 + 3 files changed, 96 insertions(+), 141 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 7914616..7aaa0de 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -310,6 +310,59 @@ void config_init(){ // void *on_setup_system_configuration(void *data); +void on_additional_software_toggled(GtkWidget *, char *path, main_window *widgets){ + GtkTreeIter iter; + int status; + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,path); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,0,&status,-1); + gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,!status,-1); +} + +void on_gparted_open(){ + yon_launch_app_with_arguments(open_gparted_command,NULL); +} + + +void on_reboot_accepted(main_window *widgets){ + g_mutex_lock(&main_config.install_mutex); + if (main_config.install_thread){ + pthread_cancel((pthread_t)main_config.install_thread); + g_mutex_unlock(&main_config.install_mutex); + } + main_config.exit_accepted=1; + g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); + while(gtk_events_pending()) gtk_main_iteration(); + if (system("reboot")){}; +} + +void on_exit_accepted(main_window *widgets){ + g_mutex_lock(&main_config.install_mutex); + if (main_config.install_thread){ + pthread_cancel((pthread_t)main_config.install_thread); + g_mutex_unlock(&main_config.install_mutex); + } + main_config.exit_accepted=1; + // g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); + while(gtk_events_pending()) gtk_main_iteration(); + gtk_widget_destroy(widgets->MainWindow); +} + +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->title=WARNING_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ + on_exit_accepted(widgets); + gtk_main_quit(); + return 1; + } + } + + return 1; +} + void on_locale_changed(GtkWidget *,main_window *widgets){ GtkTreeIter iter; GtkTreeModel *model; @@ -368,59 +421,6 @@ void on_installer_language_changed(GtkWidget *self, main_window *widgets){ } -void on_additional_software_toggled(GtkWidget *, char *path, main_window *widgets){ - GtkTreeIter iter; - int status; - gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,path); - gtk_tree_model_get(GTK_TREE_MODEL(widgets->AdditionalSoftwareList),&iter,0,&status,-1); - gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,!status,-1); -} - -void on_gparted_open(){ - yon_launch_app_with_arguments(open_gparted_command,NULL); -} - - -void on_reboot_accepted(main_window *widgets){ - g_mutex_lock(&main_config.install_mutex); - if (main_config.install_thread){ - pthread_cancel((pthread_t)main_config.install_thread); - g_mutex_unlock(&main_config.install_mutex); - } - main_config.exit_accepted=1; - g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); - while(gtk_events_pending()) gtk_main_iteration(); - if (system("reboot")){}; -} - -void on_exit_accepted(main_window *widgets){ - g_mutex_lock(&main_config.install_mutex); - if (main_config.install_thread){ - pthread_cancel((pthread_t)main_config.install_thread); - g_mutex_unlock(&main_config.install_mutex); - } - main_config.exit_accepted=1; - // g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event"); - while(gtk_events_pending()) gtk_main_iteration(); - gtk_widget_destroy(widgets->MainWindow); -} - -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->title=WARNING_TITLE_LABEL; - if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ - on_exit_accepted(widgets); - gtk_main_quit(); - return 1; - } - } - - return 1; -} - typedef struct{ char *locale_name; char *code; @@ -428,99 +428,47 @@ typedef struct{ char *code_full; } locale_struct; +int yon_char_parsed_compare(const void *a, const void *b){ + const config_str str_a = (const config_str)a; + const config_str str_b = (const config_str)b; + + return strcmp(*str_a,*str_b); +} + void set_locales_list(main_window *widgets){ gtk_list_store_clear(widgets->InstallerLanguageList); gtk_list_store_clear(widgets->InstallerCountryList); - GHashTable *localisations = g_hash_table_new(g_str_hash,g_str_equal); - int locales_size; - config_str locales = yon_dir_get_contents(locales_list_command,&locales_size); - dictionary *locale_dict = NULL; - for (int i=0;iInstallerCountryList,&iter); - gtk_list_store_set(widgets->InstallerCountryList,&iter,0,code,1,_(country),2,locales[i],3,_(tooltip),-1); - } - if (!g_hash_table_contains(localisations,code)) { - locale_struct *locale = malloc(sizeof(locale_struct)); - memset(locale,0,sizeof(locale_struct)); - - locale->locale_name = yon_char_parsed_check_exist_begins_with(code_info,info_size,"language"); - locale->code = code; - locale->localised_name = yon_char_parsed_check_exist_begins_with(code_info,info_size,"lang_name"); - locale->code_full = yon_char_new(locales[i]); - - if (!yon_char_is_empty(locale->locale_name)){ - yon_char_remove_last_symbol(locale->locale_name,'\n'); - yon_char_remove_last_symbol(locale->locale_name,'"'); - } - if (!yon_char_is_empty(locale->localised_name)){ - yon_char_remove_last_symbol(locale->localised_name,'\n'); - yon_char_remove_last_symbol(locale->localised_name,'"'); - } - yon_dictionary_add_or_create_if_exists_with_data(locale_dict,locales[i],locale); - free(yon_char_divide_search(locale->locale_name,"\"",-1)); - free(yon_char_divide_search(locale->localised_name,"\"",-1)); - g_hash_table_add(localisations,code); - } - yon_char_parsed_free(code_info,info_size); - } - yon_char_parsed_free(locales,locales_size); - + int size; + config_str locales = yon_locale_get_all_codes(&size); + qsort(locales,size,sizeof(char*),yon_char_parsed_compare); GtkTreeIter iter; - dictionary *dict; - char *config_val = yon_char_new(config(installer_lang_parameter)); - char *config_code = NULL; - if (yon_char_is_empty(config_val)) config_val = yon_char_new(setlocale(LC_ALL,NULL)); - if(strstr(config_val,"_")){ - config_code = yon_char_divide_search(config_val,"_",-1); - free(config_val); - - } - for_dictionaries(dict,locale_dict){ - locale_struct *locale = yon_dictionary_get_data(dict,locale_struct*); - gtk_list_store_append(widgets->InstallerLanguageList,&iter); - gtk_list_store_set(widgets->InstallerLanguageList,&iter,0,locale->code,1,locale->locale_name,2,_(locale->localised_name),3,locale->code_full,-1); - if (!yon_char_is_empty(config_code)){ - if (!strcmp(config_code,locale->code)){ - g_signal_handlers_block_by_func(G_OBJECT(widgets->CountryLanguagesTree),G_CALLBACK(on_installer_language_changed),widgets); - gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&iter); - on_locale_changed(NULL,widgets); - g_signal_handlers_unblock_by_func(G_OBJECT(widgets->CountryLanguagesTree),G_CALLBACK(on_installer_language_changed),widgets); - } + GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); + for (int i=0;iInstallerLanguageList,&iter); + gtk_list_store_set(widgets->InstallerLanguageList,&iter, + 0,lang_ab, + 1,_(language), + 2,lang_name, + 3,locales[i], + -1); } - + gtk_list_store_append(widgets->InstallerCountryList,&iter); + gtk_list_store_set(widgets->InstallerCountryList,&iter, + 0,lang_ab, + 1,_(country), + 2,locales[i], + 3,title, + -1); } } @@ -988,6 +936,7 @@ 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); + yon_locale_init(); set_locales_list(widgets); // { // char *parameter = config(installer_lang_parameter); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 541ba2a..5ab7220 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1133,4 +1133,5 @@ void on_vnc_toggled(GtkWidget *self, main_window *widgets); void yon_main_window_create(main_window *widgets); 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); \ No newline at end of file +gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *widgets); +int yon_char_parsed_compare(const void *a, const void *b); \ No newline at end of file diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 9823f36..f7f4c36 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -318,4 +318,9 @@ treeview row:nth-child(even) { background-color: #ffffff; } border-style: solid; border-color: @theme_fg_color; +} + +button { + min-width: 26px; + min-height: 24px; } \ No newline at end of file From 118b60104e91abb024ef3161b99c68f2744183ba Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 24 Sep 2025 18:04:17 +0600 Subject: [PATCH 2/9] WIP localisation for locale table --- source/ubinstall-gtk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 7aaa0de..638c58e 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -444,6 +444,7 @@ void set_locales_list(main_window *widgets){ qsort(locales,size,sizeof(char*),yon_char_parsed_compare); GtkTreeIter iter; GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); + textdomain(LOCALES_DOMAIN_NAME); for (int i=0;i Date: Fri, 26 Sep 2025 15:19:03 +0600 Subject: [PATCH 3/9] OS components loading changes; language fixes --- gresource.xml | 1 - languages.csv | 66 ---- locale/locales.pot | 515 ---------------------------- locale/locales_ru.po | 534 ------------------------------ locales.csv | 130 -------- source/CMakeLists.txt | 1 - source/ubinstall-gtk-components.c | 57 ++-- source/ubinstall-gtk.c | 29 +- source/ubinstall-gtk.h | 7 +- ubinstall-gtk.glade | 55 +-- 10 files changed, 102 insertions(+), 1293 deletions(-) delete mode 100644 languages.csv delete mode 100644 locale/locales.pot delete mode 100644 locale/locales_ru.po delete mode 100644 locales.csv diff --git a/gresource.xml b/gresource.xml index 022eda4..8cfa3cf 100644 --- a/gresource.xml +++ b/gresource.xml @@ -56,7 +56,6 @@ kernel-list-addon.csv services-list.csv network-list.csv - languages.csv filesystems-format-list.csv \ No newline at end of file diff --git a/languages.csv b/languages.csv deleted file mode 100644 index 7e96286..0000000 --- a/languages.csv +++ /dev/null @@ -1,66 +0,0 @@ -LANG;LANG_NAME -af_ZA.UTF-8;Afrikaans -ar_AE.UTF-8;Arabic -as_IN.UTF-8;Assamese -az_AZ.UTF-8;Azerbaijani -be_BY.UTF-8;Belarusian -bg_BG.UTF-8;Bulgarian -bn_IN.UTF-8;Bengali -bs_BA.UTF-8;Bosnian -ca_ES.UTF-8;Catalan -cs_CZ.UTF-8;Czech -da_DK.UTF-8;Danish -de_DE.UTF-8;German -el_GR.UTF-8;Greek -en_GB.UTF-8;English -es_ES.UTF-8;Spanish -et_EE.UTF-8;Estonian -fi_FI.UTF-8;Finnish -fr_FR.UTF-8;French -gu_IN.UTF-8;Gujarati -he_IL.UTF-8;Hebrew -hi_IN.UTF-8;Hindi -hr_HR.UTF-8;Croatian -hu_HU.UTF-8;Hungarian -hy_AM.UTF-8;Armenian -id_ID.UTF-8;Indonesian -is_IS.UTF-8;Icelandic -it_IT.UTF-8;Italian -ja_JP.UTF-8;Japanese -ka_GE.UTF-8;Georgian -kk_KZ.UTF-8;Kazakh -kn_IN.UTF-8;Kannada -ko_KR.UTF-8;Korean -ks_IN.UTF-8;Kashmiri -ku_TR.UTF-8;Kurdish -ky_KG.UTF-8;Kirghiz -lt_LT.UTF-8;Lithuanian -lv_LV.UTF-8;Latvian -mk_MK.UTF-8;Macedonian -ml_IN.UTF-8;Malayalam -mr_IN.UTF-8;Marathi -ms_MY.UTF-8;Malay -mt_MT.UTF-8;Maltese -nb_NO.UTF-8;Bokmal -nl_NL.UTF-8;Dutch -nn_NO.UTF-8;Nynorsk -or_IN.UTF-8;Oriya -pa_IN.UTF-8;Punjabi -pl_PL.UTF-8;Polish -pt_PT.UTF-8;Portuguese -ro_RO.UTF-8;Romanian -ru_RU.UTF-8;Russian -sa_IN.UTF-8;Sanskrit -sk_SK.UTF-8;Slovak -sl_SI.UTF-8;Slovenian -sq_AL.UTF-8;Albanian -sr_ME.UTF-8;Serbian -sr_RS.UTF-8;Serbian -sv_SE.UTF-8;Swedish -ta_IN.UTF-8;Tamil -te_IN.UTF-8;Telugu -th_TH.UTF-8;Thai -tr_TR.UTF-8;Turkish -uk_UA.UTF-8;Ukrainian -vi_VN.UTF-8;Vietnamese -zh_CN.UTF-8;Simplified Chinese \ No newline at end of file diff --git a/locale/locales.pot b/locale/locales.pot deleted file mode 100644 index f3ed5d1..0000000 --- a/locale/locales.pot +++ /dev/null @@ -1,515 +0,0 @@ -#: ./locales.csv:1 -msgid "Afrikaans, South Africa" -msgstr "" - -#: ./locales.csv:2 -msgid "Arabic, United Arab Emirates" -msgstr "" - -#: ./locales.csv:3 -msgid "Arabic, Bahrain" -msgstr "" - -#: ./locales.csv:4 -msgid "Arabic, Algeria" -msgstr "" - -#: ./locales.csv:5 -msgid "Arabic, Egypt" -msgstr "" - -#: ./locales.csv:6 -msgid "Arabic, Iraq" -msgstr "" - -#: ./locales.csv:7 -msgid "Arabic, Jordan" -msgstr "" - -#: ./locales.csv:8 -msgid "Arabic, Kuwait" -msgstr "" - -#: ./locales.csv:9 -msgid "Arabic, Libya" -msgstr "" - -#: ./locales.csv:10 -msgid "Arabic, Morocco" -msgstr "" - -#: ./locales.csv:11 -msgid "Arabic, Oman" -msgstr "" - -#: ./locales.csv:12 -msgid "Arabic, Qatar" -msgstr "" - -#: ./locales.csv:13 -msgid "Arabic, Saudi Arabia" -msgstr "" - -#: ./locales.csv:14 -msgid "Arabic, Tunisia" -msgstr "" - -#: ./locales.csv:15 -msgid "Arabic, Yemen" -msgstr "" - -#: ./locales.csv:16 -msgid "Assamese, India" -msgstr "" - -#: ./locales.csv:17 -msgid "Azerbaijani, Azerbaijan" -msgstr "" - -#: ./locales.csv:18 -msgid "Belarusian, Belarus" -msgstr "" - -#: ./locales.csv:19 -msgid "Bulgarian, Bulgaria" -msgstr "" - -#: ./locales.csv:20 -msgid "Bengali, India" -msgstr "" - -#: ./locales.csv:21 -msgid "Bosnian, Bosnia and Herzegovina" -msgstr "" - -#: ./locales.csv:22 -msgid "Catalan, Spain" -msgstr "" - -#: ./locales.csv:23 -msgid "Czech, Czech Republic" -msgstr "" - -#: ./locales.csv:24 -msgid "Danish, Denmark" -msgstr "" - -#: ./locales.csv:25 -msgid "German, Austria" -msgstr "" - -#: ./locales.csv:26 -msgid "German, Belgium" -msgstr "" - -#: ./locales.csv:27 -msgid "German, Switzerland" -msgstr "" - -#: ./locales.csv:28 -msgid "German, Germany" -msgstr "" - -#: ./locales.csv:29 -msgid "German, Liechtenstein" -msgstr "" - -#: ./locales.csv:30 -msgid "German, Luxembourg" -msgstr "" - -#: ./locales.csv:31 -msgid "Greek, Cyprus" -msgstr "" - -#: ./locales.csv:32 -msgid "Greek, Greece" -msgstr "" - -#: ./locales.csv:33 -msgid "English, Australia" -msgstr "" - -#: ./locales.csv:34 -msgid "English, Botswana" -msgstr "" - -#: ./locales.csv:35 -msgid "English, Canada" -msgstr "" - -#: ./locales.csv:36 -msgid "English, United Kingdom" -msgstr "" - -#: ./locales.csv:37 -msgid "English, Hong Kong SAR China" -msgstr "" - -#: ./locales.csv:38 -msgid "English, Ireland" -msgstr "" - -#: ./locales.csv:39 -msgid "English, India" -msgstr "" - -#: ./locales.csv:40 -msgid "English, Malta" -msgstr "" - -#: ./locales.csv:41 -msgid "English, New Zealand" -msgstr "" - -#: ./locales.csv:42 -msgid "English, Philippines" -msgstr "" - -#: ./locales.csv:43 -msgid "English, Singapore" -msgstr "" - -#: ./locales.csv:44 -msgid "English, U.S.A." -msgstr "" - -#: ./locales.csv:45 -msgid "English, Zimbabwe" -msgstr "" - -#: ./locales.csv:46 -msgid "Spanish, Argentina" -msgstr "" - -#: ./locales.csv:47 -msgid "Spanish, Bolivia" -msgstr "" - -#: ./locales.csv:48 -msgid "Spanish, Chile" -msgstr "" - -#: ./locales.csv:49 -msgid "Spanish, Colombia" -msgstr "" - -#: ./locales.csv:50 -msgid "Spanish, Costa Rica" -msgstr "" - -#: ./locales.csv:51 -msgid "Spanish, Dominican Republic" -msgstr "" - -#: ./locales.csv:52 -msgid "Spanish, Ecuador" -msgstr "" - -#: ./locales.csv:53 -msgid "Spanish, Spain" -msgstr "" - -#: ./locales.csv:54 -msgid "Spanish, Guatemala" -msgstr "" - -#: ./locales.csv:55 -msgid "Spanish, Honduras" -msgstr "" - -#: ./locales.csv:56 -msgid "Spanish, Mexico" -msgstr "" - -#: ./locales.csv:57 -msgid "Spanish, Nicaragua" -msgstr "" - -#: ./locales.csv:58 -msgid "Spanish, Panama" -msgstr "" - -#: ./locales.csv:59 -msgid "Spanish, Peru" -msgstr "" - -#: ./locales.csv:60 -msgid "Spanish, Puerto Rico" -msgstr "" - -#: ./locales.csv:61 -msgid "Spanish, Paraguay" -msgstr "" - -#: ./locales.csv:62 -msgid "Spanish, El Salvador" -msgstr "" - -#: ./locales.csv:63 -msgid "Spanish, U.S.A." -msgstr "" - -#: ./locales.csv:64 -msgid "Spanish, Uruguay" -msgstr "" - -#: ./locales.csv:65 -msgid "Spanish, Venezuela" -msgstr "" - -#: ./locales.csv:66 -msgid "Estonian, Estonia" -msgstr "" - -#: ./locales.csv:67 -msgid "Finnish, Finland" -msgstr "" - -#: ./locales.csv:68 -msgid "French, Belgium" -msgstr "" - -#: ./locales.csv:69 -msgid "French, Canada" -msgstr "" - -#: ./locales.csv:70 -msgid "French, Switzerland" -msgstr "" - -#: ./locales.csv:71 -msgid "French, France" -msgstr "" - -#: ./locales.csv:72 -msgid "French, Luxembourg" -msgstr "" - -#: ./locales.csv:73 -msgid "Gujarati, India" -msgstr "" - -#: ./locales.csv:74 -msgid "Hebrew, Israel" -msgstr "" - -#: ./locales.csv:75 -msgid "Hindi, India" -msgstr "" - -#: ./locales.csv:76 -msgid "Croatian, Croatia" -msgstr "" - -#: ./locales.csv:77 -msgid "Hungarian, Hungary" -msgstr "" - -#: ./locales.csv:78 -msgid "Armenian, Armenia" -msgstr "" - -#: ./locales.csv:79 -msgid "Indonesian, Indonesia" -msgstr "" - -#: ./locales.csv:80 -msgid "Icelandic, Iceland" -msgstr "" - -#: ./locales.csv:81 -msgid "Italian, Switzerla" -msgstr "" - -#: ./locales.csv:82 -msgid "Italian, Italy" -msgstr "" - -#: ./locales.csv:83 -msgid "Japanese, Japan" -msgstr "" - -#: ./locales.csv:84 -msgid "Georgian, Georgia" -msgstr "" - -#: ./locales.csv:85 -msgid "Kazakh, Kazakhstan" -msgstr "" - -#: ./locales.csv:86 -msgid "Kannada, India" -msgstr "" - -#: ./locales.csv:87 -msgid "Korean, Korea" -msgstr "" - -#: ./locales.csv:88 -msgid "Kashmiri, India" -msgstr "" - -#: ./locales.csv:89 -msgid "Kurdish, Turkey" -msgstr "" - -#: ./locales.csv:90 -msgid "Kurdish (Sorani), Turkey" -msgstr "" - -#: ./locales.csv:91 -msgid "Kirghiz, Kyrgyzstan" -msgstr "" - -#: ./locales.csv:92 -msgid "Lithuanian, Lithuania" -msgstr "" - -#: ./locales.csv:93 -msgid "Latvian, Latvia" -msgstr "" - -#: ./locales.csv:94 -msgid "Macedonian, Macedonia" -msgstr "" - -#: ./locales.csv:95 -msgid "Malayalam, India" -msgstr "" - -#: ./locales.csv:96 -msgid "Marathi, India" -msgstr "" - -#: ./locales.csv:97 -msgid "Malay, Malaysia" -msgstr "" - -#: ./locales.csv:98 -msgid "Maltese, Malta" -msgstr "" - -#: ./locales.csv:99 -msgid "Bokmal, Norway" -msgstr "" - -#: ./locales.csv:100 -msgid "Dutch, Belgium" -msgstr "" - -#: ./locales.csv:101 -msgid "Dutch, Netherlands" -msgstr "" - -#: ./locales.csv:102 -msgid "Nynorsk, Norway" -msgstr "" - -#: ./locales.csv:103 -msgid "Oriya, India" -msgstr "" - -#: ./locales.csv:104 -msgid "Punjabi, India" -msgstr "" - -#: ./locales.csv:105 -msgid "Polish, Poland" -msgstr "" - -#: ./locales.csv:106 -msgid "Portuguese, Brazil" -msgstr "" - -#: ./locales.csv:107 -msgid "Portuguese, Portugal" -msgstr "" - -#: ./locales.csv:108 -msgid "Romanian, Romania" -msgstr "" - -#: ./locales.csv:109 -msgid "Russian, Russia" -msgstr "" - -#: ./locales.csv:110 -msgid "Russian, Ukraine" -msgstr "" - -#: ./locales.csv:111 -msgid "Sanskrit, India" -msgstr "" - -#: ./locales.csv:112 -msgid "Slovak, Slovakia" -msgstr "" - -#: ./locales.csv:113 -msgid "Slovenian, Slovenia" -msgstr "" - -#: ./locales.csv:114 -msgid "Albanian, Albania" -msgstr "" - -#: ./locales.csv:115 -msgid "Serbian, Montenegro" -msgstr "" - -#: ./locales.csv:116 -msgid "Serbian, Montenegro (Latin)" -msgstr "" - -#: ./locales.csv:117 -msgid "Serbian, Serbia" -msgstr "" - -#: ./locales.csv:118 -msgid "Serbian, Serbia (Latin)" -msgstr "" - -#: ./locales.csv:119 -msgid "Swedish, Sweden" -msgstr "" - -#: ./locales.csv:120 -msgid "Tamil, India" -msgstr "" - -#: ./locales.csv:121 -msgid "Telugu, India" -msgstr "" - -#: ./locales.csv:122 -msgid "Thai, Thailand" -msgstr "" - -#: ./locales.csv:123 -msgid "Turkish, Turkey" -msgstr "" - -#: ./locales.csv:124 -msgid "Ukrainian, Ukraine" -msgstr "" - -#: ./locales.csv:125 -msgid "Vietnamese, Vietnam" -msgstr "" - -#: ./locales.csv:126 -msgid "Simplified Chinese, China" -msgstr "" - -#: ./locales.csv:127 -msgid "Traditional Chinese, Hong Kong SAR China" -msgstr "" - -#: ./locales.csv:128 -msgid "Chinese, Singapore" -msgstr "" - -#: ./locales.csv:129 -msgid "Traditional Chinese, Taiwan" -msgstr "" diff --git a/locale/locales_ru.po b/locale/locales_ru.po deleted file mode 100644 index 34a7601..0000000 --- a/locale/locales_ru.po +++ /dev/null @@ -1,534 +0,0 @@ -# Language translations for ubinstal package. -# Copyright (C) 2022, UBTech LLC -# This file is distributed under the same license as the ubinstal package. -# UBLinux Team , 2022 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: ubinstal 1.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-22 16:12+0600\n" -"PO-Revision-Date: \n" -"Last-Translator: \n" -"Language-Team: \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ./locales.csv:1 -msgid "Afrikaans, South Africa" -msgstr "Африкаанс, Южная Африка" - -#: ./locales.csv:2 -msgid "Arabic, United Arab Emirates" -msgstr "Арабский, Объединенные Арабские Эмираты" - -#: ./locales.csv:3 -msgid "Arabic, Bahrain" -msgstr "Арабский, Бахрейн" - -#: ./locales.csv:4 -msgid "Arabic, Algeria" -msgstr "Арабский, Алжир" - -#: ./locales.csv:5 -msgid "Arabic, Egypt" -msgstr "Арабский, Египет" - -#: ./locales.csv:6 -msgid "Arabic, Iraq" -msgstr "Арабский, Ирак" - -#: ./locales.csv:7 -msgid "Arabic, Jordan" -msgstr "Арабский, Иордания" - -#: ./locales.csv:8 -msgid "Arabic, Kuwait" -msgstr "Арабский, Кувейт" - -#: ./locales.csv:9 -msgid "Arabic, Libya" -msgstr "Арабский, Ливия" - -#: ./locales.csv:10 -msgid "Arabic, Morocco" -msgstr "Арабский, Марокко" - -#: ./locales.csv:11 -msgid "Arabic, Oman" -msgstr "Арабский, Оман" - -#: ./locales.csv:12 -msgid "Arabic, Qatar" -msgstr "Арабский, Катар" - -#: ./locales.csv:13 -msgid "Arabic, Saudi Arabia" -msgstr "Арабский, Саудовская Аравия" - -#: ./locales.csv:14 -msgid "Arabic, Tunisia" -msgstr "Арабский, Тунис" - -#: ./locales.csv:15 -msgid "Arabic, Yemen" -msgstr "Арабский, Йемен" - -#: ./locales.csv:16 -msgid "Assamese, India" -msgstr "Ассамский, Индия" - -#: ./locales.csv:17 -msgid "Azerbaijani, Azerbaijan" -msgstr "Азербайджанский, Азербайджан" - -#: ./locales.csv:18 -msgid "Belarusian, Belarus" -msgstr "Белорусский, Беларусь" - -#: ./locales.csv:19 -msgid "Bulgarian, Bulgaria" -msgstr "Болгарский, Болгария" - -#: ./locales.csv:20 -msgid "Bengali, India" -msgstr "Бенгальский, Индия" - -#: ./locales.csv:21 -msgid "Bosnian, Bosnia and Herzegovina" -msgstr "Боснийский, Босния и Герцеговина" - -#: ./locales.csv:22 -msgid "Catalan, Spain" -msgstr "Каталанский, Испания" - -#: ./locales.csv:23 -msgid "Czech, Czech Republic" -msgstr "Чешский, Чехия" - -#: ./locales.csv:24 -msgid "Danish, Denmark" -msgstr "Датский, Дания" - -#: ./locales.csv:25 -msgid "German, Austria" -msgstr "Немецкий, Австрия" - -#: ./locales.csv:26 -msgid "German, Belgium" -msgstr "Немецкий, Бельгия" - -#: ./locales.csv:27 -msgid "German, Switzerland" -msgstr "Немецкий, Швейцария" - -#: ./locales.csv:28 -msgid "German, Germany" -msgstr "Немецкий, Германия" - -#: ./locales.csv:29 -msgid "German, Liechtenstein" -msgstr "Немецкий, Лихтенштейн" - -#: ./locales.csv:30 -msgid "German, Luxembourg" -msgstr "Немецкий, Люксембург" - -#: ./locales.csv:31 -msgid "Greek, Cyprus" -msgstr "Греческий, Кипр" - -#: ./locales.csv:32 -msgid "Greek, Greece" -msgstr "Греческий, Греция" - -#: ./locales.csv:33 -msgid "English, Australia" -msgstr "Английский, Австралия" - -#: ./locales.csv:34 -msgid "English, Botswana" -msgstr "Английский, Ботсвана" - -#: ./locales.csv:35 -msgid "English, Canada" -msgstr "Английский, Канада" - -#: ./locales.csv:36 -msgid "English, United Kingdom" -msgstr "Английский, Великобритания" - -#: ./locales.csv:37 -msgid "English, Hong Kong SAR China" -msgstr "Английский, Гонконг (САР Китай)" - -#: ./locales.csv:38 -msgid "English, Ireland" -msgstr "Английский, Ирландия" - -#: ./locales.csv:39 -msgid "English, India" -msgstr "Английский, Индия" - -#: ./locales.csv:40 -msgid "English, Malta" -msgstr "Английский, Мальта" - -#: ./locales.csv:41 -msgid "English, New Zealand" -msgstr "Английский, Новая Зеландия" - -#: ./locales.csv:42 -msgid "English, Philippines" -msgstr "Английский, Филиппины" - -#: ./locales.csv:43 -msgid "English, Singapore" -msgstr "Английский, Сингапур" - -#: ./locales.csv:44 -msgid "English, U.S.A." -msgstr "Английский, США" - -#: ./locales.csv:45 -msgid "English, Zimbabwe" -msgstr "Английский, Зимбабве" - -#: ./locales.csv:46 -msgid "Spanish, Argentina" -msgstr "Испанский, Аргентина" - -#: ./locales.csv:47 -msgid "Spanish, Bolivia" -msgstr "Испанский, Боливия" - -#: ./locales.csv:48 -msgid "Spanish, Chile" -msgstr "Испанский, Чили" - -#: ./locales.csv:49 -msgid "Spanish, Colombia" -msgstr "Испанский, Колумбия" - -#: ./locales.csv:50 -msgid "Spanish, Costa Rica" -msgstr "Испанский, Коста-Рика" - -#: ./locales.csv:51 -msgid "Spanish, Dominican Republic" -msgstr "Испанский, Доминиканская Республика" - -#: ./locales.csv:52 -msgid "Spanish, Ecuador" -msgstr "Испанский, Эквадор" - -#: ./locales.csv:53 -msgid "Spanish, Spain" -msgstr "Испанский, Испания" - -#: ./locales.csv:54 -msgid "Spanish, Guatemala" -msgstr "Испанский, Гватемала" - -#: ./locales.csv:55 -msgid "Spanish, Honduras" -msgstr "Испанский, Гондурас" - -#: ./locales.csv:56 -msgid "Spanish, Mexico" -msgstr "Испанский, Мексика" - -#: ./locales.csv:57 -msgid "Spanish, Nicaragua" -msgstr "Испанский, Никарагуа" - -#: ./locales.csv:58 -msgid "Spanish, Panama" -msgstr "Испанский, Панама" - -#: ./locales.csv:59 -msgid "Spanish, Peru" -msgstr "Испанский, Перу" - -#: ./locales.csv:60 -msgid "Spanish, Puerto Rico" -msgstr "Испанский, Пуэрто-Рико" - -#: ./locales.csv:61 -msgid "Spanish, Paraguay" -msgstr "Испанский, Парагвай" - -#: ./locales.csv:62 -msgid "Spanish, El Salvador" -msgstr "Испанский, Сальвадор" - -#: ./locales.csv:63 -msgid "Spanish, U.S.A." -msgstr "Испанский, США" - -#: ./locales.csv:64 -msgid "Spanish, Uruguay" -msgstr "Испанский, Уругвай" - -#: ./locales.csv:65 -msgid "Spanish, Venezuela" -msgstr "Испанский, Венесуэла" - -#: ./locales.csv:66 -msgid "Estonian, Estonia" -msgstr "Эстонский, Эстония" - -#: ./locales.csv:67 -msgid "Finnish, Finland" -msgstr "Финский, Финляндия" - -#: ./locales.csv:68 -msgid "French, Belgium" -msgstr "Французский, Бельгия" - -#: ./locales.csv:69 -msgid "French, Canada" -msgstr "Французский, Канада" - -#: ./locales.csv:70 -msgid "French, Switzerland" -msgstr "Французский, Швейцария" - -#: ./locales.csv:71 -msgid "French, France" -msgstr "Французский, Франция" - -#: ./locales.csv:72 -msgid "French, Luxembourg" -msgstr "Французский, Люксембург" - -#: ./locales.csv:73 -msgid "Gujarati, India" -msgstr "Гуджарати, Индия" - -#: ./locales.csv:74 -msgid "Hebrew, Israel" -msgstr "Иврит, Израиль" - -#: ./locales.csv:75 -msgid "Hindi, India" -msgstr "Хинди, Индия" - -#: ./locales.csv:76 -msgid "Croatian, Croatia" -msgstr "Хорватский, Хорватия" - -#: ./locales.csv:77 -msgid "Hungarian, Hungary" -msgstr "Венгерский, Венгрия" - -#: ./locales.csv:78 -msgid "Armenian, Armenia" -msgstr "Армянский, Армения" - -#: ./locales.csv:79 -msgid "Indonesian, Indonesia" -msgstr "Индонезийский, Индонезия" - -#: ./locales.csv:80 -msgid "Icelandic, Iceland" -msgstr "Исландский, Исландия" - -#: ./locales.csv:81 -msgid "Italian, Switzerla" -msgstr "Итальянский, Швейцария" - -#: ./locales.csv:82 -msgid "Italian, Italy" -msgstr "Итальянский, Италия" - -#: ./locales.csv:83 -msgid "Japanese, Japan" -msgstr "Японский, Япония" - -#: ./locales.csv:84 -msgid "Georgian, Georgia" -msgstr "Грузинский, Грузия" - -#: ./locales.csv:85 -msgid "Kazakh, Kazakhstan" -msgstr "Казахский, Казахстан" - -#: ./locales.csv:86 -msgid "Kannada, India" -msgstr "Каннада, Индия" - -#: ./locales.csv:87 -msgid "Korean, Korea" -msgstr "Корейский, Корея" - -#: ./locales.csv:88 -msgid "Kashmiri, India" -msgstr "Кашмири, Индия" - -#: ./locales.csv:89 -msgid "Kurdish, Turkey" -msgstr "Курдский, Турция" - -#: ./locales.csv:90 -msgid "Kurdish (Sorani), Turkey" -msgstr "Курдский (Сорани), Турция" - -#: ./locales.csv:91 -msgid "Kirghiz, Kyrgyzstan" -msgstr "Киргизский, Киргизия" - -#: ./locales.csv:92 -msgid "Lithuanian, Lithuania" -msgstr "Литовский, Литва" - -#: ./locales.csv:93 -msgid "Latvian, Latvia" -msgstr "Латышский, Латвия" - -#: ./locales.csv:94 -msgid "Macedonian, Macedonia" -msgstr "Македонский, Македония" - -#: ./locales.csv:95 -msgid "Malayalam, India" -msgstr "Малаялам, Индия" - -#: ./locales.csv:96 -msgid "Marathi, India" -msgstr "Маратхи, Индия" - -#: ./locales.csv:97 -msgid "Malay, Malaysia" -msgstr "Малайский, Малайзия" - -#: ./locales.csv:98 -msgid "Maltese, Malta" -msgstr "Мальтийский, Мальта" - -#: ./locales.csv:99 -msgid "Bokmal, Norway" -msgstr "Букмол, Норвегия" - -#: ./locales.csv:100 -msgid "Dutch, Belgium" -msgstr "Нидерландский, Бельгия" - -#: ./locales.csv:101 -msgid "Dutch, Netherlands" -msgstr "Нидерландский, Нидерланды" - -#: ./locales.csv:102 -msgid "Nynorsk, Norway" -msgstr "Нюнорск, Норвегия" - -#: ./locales.csv:103 -msgid "Oriya, India" -msgstr "Ория, Индия" - -#: ./locales.csv:104 -msgid "Punjabi, India" -msgstr "Пенджаби, Индия" - -#: ./locales.csv:105 -msgid "Polish, Poland" -msgstr "Польский, Польша" - -#: ./locales.csv:106 -msgid "Portuguese, Brazil" -msgstr "Португальский, Бразилия" - -#: ./locales.csv:107 -msgid "Portuguese, Portugal" -msgstr "Португальский, Португалия" - -#: ./locales.csv:108 -msgid "Romanian, Romania" -msgstr "Румынский, Румыния" - -#: ./locales.csv:109 -msgid "Russian, Russia" -msgstr "Русский, Россия" - -#: ./locales.csv:110 -msgid "Russian, Ukraine" -msgstr "Русский, Украина" - -#: ./locales.csv:111 -msgid "Sanskrit, India" -msgstr "Санскрит, Индия" - -#: ./locales.csv:112 -msgid "Slovak, Slovakia" -msgstr "Словацкий, Словакия" - -#: ./locales.csv:113 -msgid "Slovenian, Slovenia" -msgstr "Словенский, Словения" - -#: ./locales.csv:114 -msgid "Albanian, Albania" -msgstr "Албанский, Албания" - -#: ./locales.csv:115 -msgid "Serbian, Montenegro" -msgstr "Сербский, Черногория" - -#: ./locales.csv:116 -msgid "Serbian, Montenegro (Latin)" -msgstr "Сербский, Черногория (Латиница)" - -#: ./locales.csv:117 -msgid "Serbian, Serbia" -msgstr "Сербский, Сербия" - -#: ./locales.csv:118 -msgid "Serbian, Serbia (Latin)" -msgstr "Сербский, Сербия (Латиница)" - -#: ./locales.csv:119 -msgid "Swedish, Sweden" -msgstr "Шведский, Швеция" - -#: ./locales.csv:120 -msgid "Tamil, India" -msgstr "Тамильский, Индия" - -#: ./locales.csv:121 -msgid "Telugu, India" -msgstr "Телугу, Индия" - -#: ./locales.csv:122 -msgid "Thai, Thailand" -msgstr "Тайский, Таиланд" - -#: ./locales.csv:123 -msgid "Turkish, Turkey" -msgstr "Турецкий, Турция" - -#: ./locales.csv:124 -msgid "Ukrainian, Ukraine" -msgstr "Украинский, Украина" - -#: ./locales.csv:125 -msgid "Vietnamese, Vietnam" -msgstr "Вьетнамский, Вьетнам" - -#: ./locales.csv:126 -msgid "Simplified Chinese, China" -msgstr "Упрощенный китайский, Китай" - -#: ./locales.csv:127 -msgid "Traditional Chinese, Hong Kong SAR China" -msgstr "Традиционный китайский, Гонконг (САР Китай)" - -#: ./locales.csv:128 -msgid "Chinese, Singapore" -msgstr "Китайский, Сингапур" - -#: ./locales.csv:129 -msgid "Traditional Chinese, Taiwan" -msgstr "Традиционный китайский, Тайвань" diff --git a/locales.csv b/locales.csv deleted file mode 100644 index 1d8d0ca..0000000 --- a/locales.csv +++ /dev/null @@ -1,130 +0,0 @@ -LANG_GROUP;LANG;LANG_NAME -af;af_ZA.UTF-8;Afrikaans, South Africa -ar;ar_AE.UTF-8;Arabic, United Arab Emirates -ar;ar_BH.UTF-8;Arabic, Bahrain -ar;ar_DZ.UTF-8;Arabic, Algeria -ar;ar_EG.UTF-8;Arabic, Egypt -ar;ar_IQ.UTF-8;Arabic, Iraq -ar;ar_JO.UTF-8;Arabic, Jordan -ar;ar_KW.UTF-8;Arabic, Kuwait -ar;ar_LY.UTF-8;Arabic, Libya -ar;ar_MA.UTF-8;Arabic, Morocco -ar;ar_OM.UTF-8;Arabic, Oman -ar;ar_QA.UTF-8;Arabic, Qatar -ar;ar_SA.UTF-8;Arabic, Saudi Arabia -ar;ar_TN.UTF-8;Arabic, Tunisia -ar;ar_YE.UTF-8;Arabic, Yemen -as;as_IN.UTF-8;Assamese, India -az;az_AZ.UTF-8;Azerbaijani, Azerbaijan -be;be_BY.UTF-8;Belarusian, Belarus -bg;bg_BG.UTF-8;Bulgarian, Bulgaria -bn;bn_IN.UTF-8;Bengali, India -bs;bs_BA.UTF-8;Bosnian, Bosnia and Herzegovina -ca;ca_ES.UTF-8;Catalan, Spain -cs;cs_CZ.UTF-8;Czech, Czech Republic -da;da_DK.UTF-8;Danish, Denmark -de;de_AT.UTF-8;German, Austria -de;de_BE.UTF-8;German, Belgium -de;de_CH.UTF-8;German, Switzerland -de;de_DE.UTF-8;German, Germany -de;de_LI.UTF-8;German, Liechtenstein -de;de_LU.UTF-8;German, Luxembourg -el;el_CY.UTF-8;Greek, Cyprus -el;el_GR.UTF-8;Greek, Greece -en;en_AU.UTF-8;English, Australia -en;en_BW.UTF-8;English, Botswana -en;en_CA.UTF-8;English, Canada -en;en_GB.UTF-8;English, United Kingdom -en;en_HK.UTF-8;English, Hong Kong SAR China -en;en_IE.UTF-8;English, Ireland -en;en_IN.UTF-8;English, India -en;en_MT.UTF-8;English, Malta -en;en_NZ.UTF-8;English, New Zealand -en;en_PH.UTF-8;English, Philippines -en;en_SG.UTF-8;English, Singapore -en;en_US.UTF-8;English, U.S.A. -en;en_ZW.UTF-8;English, Zimbabwe -es;es_AR.UTF-8;Spanish, Argentina -es;es_BO.UTF-8;Spanish, Bolivia -es;es_CL.UTF-8;Spanish, Chile -es;es_CO.UTF-8;Spanish, Colombia -es;es_CR.UTF-8;Spanish, Costa Rica -es;es_DO.UTF-8;Spanish, Dominican Republic -es;es_EC.UTF-8;Spanish, Ecuador -es;es_ES.UTF-8;Spanish, Spain -es;es_GT.UTF-8;Spanish, Guatemala -es;es_HN.UTF-8;Spanish, Honduras -es;es_MX.UTF-8;Spanish, Mexico -es;es_NI.UTF-8;Spanish, Nicaragua -es;es_PA.UTF-8;Spanish, Panama -es;es_PE.UTF-8;Spanish, Peru -es;es_PR.UTF-8;Spanish, Puerto Rico -es;es_PY.UTF-8;Spanish, Paraguay -es;es_SV.UTF-8;Spanish, El Salvador -es;es_US.UTF-8;Spanish, U.S.A. -es;es_UY.UTF-8;Spanish, Uruguay -es;es_VE.UTF-8;Spanish, Venezuela -et;et_EE.UTF-8;Estonian, Estonia -fi;fi_FI.UTF-8;Finnish, Finland -fr;fr_BE.UTF-8;French, Belgium -fr;fr_CA.UTF-8;French, Canada -fr;fr_CH.UTF-8;French, Switzerland -fr;fr_FR.UTF-8;French, France -fr;fr_LU.UTF-8;French, Luxembourg -gu;gu_IN.UTF-8;Gujarati, India -he;he_IL.UTF-8;Hebrew, Israel -hi;hi_IN.UTF-8;Hindi, India -hr;hr_HR.UTF-8;Croatian, Croatia -hu;hu_HU.UTF-8;Hungarian, Hungary -hy;hy_AM.UTF-8;Armenian, Armenia -id;id_ID.UTF-8;Indonesian, Indonesia -is;is_IS.UTF-8;Icelandic, Iceland -it;it_CH.UTF-8;Italian, Switzerland -it;it_IT.UTF-8;Italian, Italy -ja;ja_JP.UTF-8;Japanese, Japan -ka;ka_GE.UTF-8;Georgian, Georgia -kk;kk_KZ.UTF-8;Kazakh, Kazakhstan -kn;kn_IN.UTF-8;Kannada, India -ko;ko_KR.UTF-8;Korean, Korea -ks;ks_IN.UTF-8;Kashmiri, India -ku;ku_TR.UTF-8;Kurdish, Turkey -ku;ku_TR.UTF-8@sorani;Kurdish (Sorani), Turkey -ky;ky_KG.UTF-8;Kirghiz, Kyrgyzstan -lt;lt_LT.UTF-8;Lithuanian, Lithuania -lv;lv_LV.UTF-8;Latvian, Latvia -mk;mk_MK.UTF-8;Macedonian, Macedonia -ml;ml_IN.UTF-8;Malayalam, India -mr;mr_IN.UTF-8;Marathi, India -ms;ms_MY.UTF-8;Malay, Malaysia -mt;mt_MT.UTF-8;Maltese, Malta -nb;nb_NO.UTF-8;Bokmal, Norway -nl;nl_BE.UTF-8;Dutch, Belgium -nl;nl_NL.UTF-8;Dutch, Netherlands -nn;nn_NO.UTF-8;Nynorsk, Norway -or;or_IN.UTF-8;Oriya, India -pa;pa_IN.UTF-8;Punjabi, India -pl;pl_PL.UTF-8;Polish, Poland -pt;pt_BR.UTF-8;Portuguese, Brazil -pt;pt_PT.UTF-8;Portuguese, Portugal -ro;ro_RO.UTF-8;Romanian, Romania -ru;ru_RU.UTF-8;Russian, Russia -ru;ru_UA.UTF-8;Russian, Ukraine -sa;sa_IN.UTF-8;Sanskrit, India -sk;sk_SK.UTF-8;Slovak, Slovakia -sl;sl_SI.UTF-8;Slovenian, Slovenia -sq;sq_AL.UTF-8;Albanian, Albania -sr;sr_ME.UTF-8;Serbian, Montenegro -sr;sr_ME.UTF-8@latin;Serbian, Montenegro (Latin) -sr;sr_RS.UTF-8;Serbian, Serbia -sr;sr_RS.UTF-8@latin;Serbian, Serbia (Latin) -sv;sv_SE.UTF-8;Swedish, Sweden -ta;ta_IN.UTF-8;Tamil, India -te;te_IN.UTF-8;Telugu, India -th;th_TH.UTF-8;Thai, Thailand -tr;tr_TR.UTF-8;Turkish, Turkey -uk;uk_UA.UTF-8;Ukrainian, Ukraine -vi;vi_VN.UTF-8;Vietnamese, Vietnam -zh;zh_CN.UTF-8;Simplified Chinese, China -zh;zh_HK.UTF-8;Traditional Chinese, Hong Kong SAR China -zh;zh_SG.UTF-8;Chinese, Singapore -zh;zh_TW.UTF-8;Traditional Chinese, Taiwan \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index cec9547..3174321 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -78,7 +78,6 @@ set(DEPENDFILES ../kernel-list-addon.csv ../services-list.csv ../network-list.csv - ../languages.csv ../filesystems-format-list.csv ../icons-builtin/install_type_custom_normal.png ../icons-builtin/install_type_data_only_normal.png diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 20f028e..b187a57 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -152,31 +152,48 @@ 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"); + gtk_list_box_insert(GTK_LIST_BOX(widgets->OSSoftwareListBox),row->row,-1); + return G_SOURCE_REMOVE; +} + +gboolean yon_spinner_switch_off(GtkSpinner *target){ + gtk_spinner_stop(target); + gtk_widget_hide(GTK_WIDGET(target)); + return G_SOURCE_REMOVE; +} + +void *yon_os_components_setup(main_window *widgets){ + int base_size; + config_str base = yon_config_load(get_modules_command,&base_size); + for (int i=0;irow),"widgets",widgets); + yon_os_row_setup(row,name,version,tags,description); + g_idle_add((GSourceFunc)yon_os_component_insert,row); + } + g_idle_add((GSourceFunc)yon_spinner_switch_off,widgets->OSSpinner); + yon_char_parsed_free(base,base_size); + return NULL; +} + void yon_os_components_init(main_window *widgets){ int size = 0; GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); GList *iter; if (!list){ - int base_size; - config_str base = yon_config_load(get_modules_command,&base_size); - for (int i=0;iOSSoftwareListBox),row->row,-1); - int min_size=0; - gtk_widget_get_preferred_width(row->NameLabel,&min_size,NULL); - if (min_size>size) size=min_size; - - - } - yon_char_parsed_free(base,base_size); + gtk_overlay_add_overlay(GTK_OVERLAY(widgets->OSOverlay),widgets->OSSpinner); + gtk_spinner_start(GTK_SPINNER(widgets->OSSpinner)); + gtk_widget_show(widgets->OSSpinner); + g_thread_new("geag",(GThreadFunc)yon_os_components_setup,widgets); while(gtk_events_pending()) gtk_main_iteration(); list = gtk_container_get_children(GTK_CONTAINER(widgets->OSSoftwareListBox)); for(iter = list;iter;iter=iter->next){ diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 638c58e..e00263c 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -383,6 +383,9 @@ void on_locale_changed(GtkWidget *,main_window *widgets){ if (!strcmp(config_code,target)){ gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),&iter,&itar); gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&iter); + GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(widgets->InstallerCountryFilter),&iter); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widgets->CountryLanguagesTree),path,0,0,0,0); + gtk_tree_path_free(path); break; } } @@ -439,10 +442,11 @@ void set_locales_list(main_window *widgets){ gtk_list_store_clear(widgets->InstallerLanguageList); gtk_list_store_clear(widgets->InstallerCountryList); + char *config_code = config(installer_lang_parameter); int size; config_str locales = yon_locale_get_all_codes(&size); qsort(locales,size,sizeof(char*),yon_char_parsed_compare); - GtkTreeIter iter; + GtkTreeIter iter,itar; GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); textdomain(LOCALES_DOMAIN_NAME); for (int i=0;iInstallerCountryList,&iter); - gtk_list_store_set(widgets->InstallerCountryList,&iter, + gtk_list_store_append(widgets->InstallerCountryList,&itar); + gtk_list_store_set(widgets->InstallerCountryList,&itar, 0,lang_ab, 1,_(country), 2,locales[i], 3,title, -1); + if (yon_char_is_empty(config_code)){ + config_code=setlocale(LC_ALL,NULL); + char *temp = strstr(config_code,"."); + if (temp) temp[0]='\0'; + } + if (!strcmp(config_code,locales[i])){ + g_signal_handlers_block_by_func(G_OBJECT(widgets->CountryLanguagesTree),G_CALLBACK(on_installer_language_changed),widgets); + GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(widgets->InstallerLanguageList),&iter); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widgets->LanguagesTree),path,0,0,0,0); + gtk_tree_path_free(path); + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&iter); + on_locale_changed(NULL,widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->CountryLanguagesTree),G_CALLBACK(on_installer_language_changed),widgets); + } } textdomain(LocaleName); @@ -481,8 +499,9 @@ gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *w if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&model,&itar)) return 0; char *cur_code,*country; gtk_tree_model_get(self,iter,0,&cur_code,1,&country,-1); - char *code; + if (yon_char_is_empty(cur_code)) return 0; + char *code; gtk_tree_model_get(model,&itar,0,&code,-1); if (!strcmp(code,cur_code)){ char *config_lang = config(installer_lang_parameter); @@ -623,6 +642,8 @@ void yon_main_window_create(main_window *widgets){ widgets->GpartedGrubUpdateButton = yon_gtk_builder_get_widget(builder,"GpartedGrubUpdateButton"); widgets->OSDevicesTree = yon_gtk_builder_get_widget(builder,"OSDevicesTree"); + widgets->OSSpinner = yon_gtk_builder_get_widget(builder,"OSSpinner"); + widgets->OSOverlay = yon_gtk_builder_get_widget(builder,"OSOverlay"); widgets->OSSysSectionTree = yon_gtk_builder_get_widget(builder,"OSSysSectionTree"); widgets->GpartedOSButton = yon_gtk_builder_get_widget(builder,"GpartedOSButton"); widgets->OSFormatSwitch = yon_gtk_builder_get_widget(builder,"OSFormatSwitch"); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 5ab7220..307e6a6 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -560,6 +560,8 @@ typedef struct { GtkWidget *OSFormatFSMarkEntry; GtkWidget *OSFormatEncryptionCombo; GtkWidget *OSFormatEncryptionEntry; + GtkWidget *OSSpinner; + GtkWidget *OSOverlay; GtkWidget *GpartedUserdataButton; GtkWidget *UserdataDevicesTree; @@ -1134,4 +1136,7 @@ void yon_main_window_create(main_window *widgets); 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); \ No newline at end of file +int yon_char_parsed_compare(const void *a, const void *b); +gboolean yon_os_component_insert(os_row *row); +void *yon_os_components_setup(main_window *widgets); +gboolean yon_spinner_switch_off(GtkSpinner *target); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 31ad87d..acdfadb 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -148,6 +148,10 @@ + + True + False + @@ -1517,40 +1521,49 @@ and help you install UBLinux on your computer 5 5 - + True - True - in + False - + True - False - 5 - 5 - 5 - 5 - 5 - 5 + True + in - + True False - vertical + 5 + 5 + 5 + 5 + 5 + 5 - + True False - none + vertical + + + True + False + none + + + True + True + 1 + + - - True - True - 1 - + + -1 + From e482336d47e4af6e6449fba63c3f3e785a327baa Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 29 Sep 2025 18:34:27 +0600 Subject: [PATCH 4/9] WIP Advanced install --- source/CMakeLists.txt | 1 + source/ubinstall-gtk-advanced.c | 256 ++++++++++++++++++++++++++++ source/ubinstall-gtk-installation.c | 150 +--------------- source/ubinstall-gtk.c | 4 +- source/ubinstall-gtk.h | 28 ++- source/ubl-settings-advanced.c | 64 ------- 6 files changed, 291 insertions(+), 212 deletions(-) create mode 100644 source/ubinstall-gtk-advanced.c delete mode 100644 source/ubl-settings-advanced.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 3174321..7f8ebf7 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -125,6 +125,7 @@ endif() set(SOURCE_FILES ubinstall-gtk.c + ubinstall-gtk-advanced.c ubinstall-gtk-page-switch.c ubinstall-gtk-keyboard.c ubinstall-gtk-region.c diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c new file mode 100644 index 0000000..fca3dd9 --- /dev/null +++ b/source/ubinstall-gtk-advanced.c @@ -0,0 +1,256 @@ +#include "ubinstall-gtk.h" + +advanced_section *yon_advanced_section_new(); +void yon_advanced_section_remove(); + +int sections_size=0; +advanced_section *sections[2] = {NULL}; + +advanced_section *yon_advanced_section_new(){ + if (sections_size>=2) return NULL; + advanced_section *section = malloc(sizeof(advanced_section)); + memset(section,0,sizeof(advanced_section)); + return section; +} + +void yon_advanced_section_remove(char *part){ + int pos = yon_advanced_section_get(part); + switch(pos){ + case 0: + if (sections[0]){ + free(sections[0]); + if (sections[1]){ + sections[0]=sections[1]; + sections[1]=NULL; + } else { + sections[0]=NULL; + } + sections_size--; + } + break; + case 1: + if (sections[1]){ + free(sections[1]); + sections[1]=NULL; + sections_size--; + } + break; + default: return; + } +} + +int yon_advanced_section_get(char *partition){ + if (yon_char_is_empty(partition)) return -1; + if (sections_size>0&&!strcmp(sections[0]->part_label,partition)){ + return 0; + } else if (sections_size>1&&!strcmp(sections[1]->part_label,partition)){ + return 1; + } + return -1; +} + +void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_section *section){ + gtk_label_set_text(GTK_LABEL(part->SectionLabel),section->part_label); + if (section->format){ + gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(part->SizeSpin),section->size); + gtk_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),yon_get_size_get_from_letter(section->size_letter)); + gtk_entry_set_text(GTK_ENTRY(part->PartLabelEntry),section->part_label); + gtk_entry_set_text(GTK_ENTRY(part->FileSystemLabelEntry),section->fs_label); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo),section->fs_type); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->EncryptionCombo),section->encryption); + gtk_entry_set_text(GTK_ENTRY(part->EncryptionEntry),section->encryption_password); + } + +} + +void yon_advanced_update(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + GList *iter; + for (iter = list; iter; iter=iter->next){ + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + for (int i=0;iAdvancedPartitionAddBox),part->MainBox,0,0,0); + } +} + +void on_advanced_partition_create(GtkWidget *, main_window *widgets){ + GtkTreeIter iter; + for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){ + char *target; + int active; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,3,&active,-1); + gtk_list_store_set(widgets->DevicesList,&iter,3,!active,-1); + if (!active){ + if (sections_size==2) return; + advanced_section *section = yon_advanced_section_new(); + sections[sections_size]=section; + sections_size++; + } + } + yon_advanced_update(widgets); +} + +void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ + GtkTreeIter iter; + if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->PartitionsList),&iter,path)){ + char *target; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,5,&status,-1); + gtk_list_store_set(widgets->DevicesList,&iter,3,!status,-1); + if (!status){ + if (sections_size==2) return; + advanced_section *section = yon_advanced_section_new(); + sections[sections_size]=section; + sections_size++; + } else { + yon_advanced_section_remove(target); + } + } + yon_advanced_update(widgets); + +} + +void yon_install_advanced_init(main_window *){ +} + +void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); + + int chosen = 0; + chosen = yon_advanced_get_part_size(widgets); + + gtk_tree_model_get_iter_from_string(model,&iter,path); + int status; + char *target_part; + gtk_tree_model_get(model,&iter,0,&target_part,7,&status,-1); + + if (!status){ + if (chosen<2){ + gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); + chosen++; + advanced_partition *part = yon_advanced_partition_new(); + part->part_type = ADVANCED_PART_EXISTING; + part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); + part->part = target_part; + gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); + gtk_widget_show(part->MainBox); + yon_advanced_partition_setup(part,widgets); + on_advanced_parts_added(NULL,NULL,widgets); + } + } else { + gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); + advanced_partition *part = g_object_get_data(G_OBJECT(widgets->AdvancedPartitionAddBox),target_part); + if (part){ + on_advanced_part_remove(part->RemoveButton,widgets); + } + } +} + +void yon_advanced_parts_update(main_window *widgets){ + int size; + config_str partitions; + partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); + for (int i=0;iDevicesList); + GtkTreeIter iter; + for_iter (model,&iter){ + char *disk_path; + int status; + gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1); + if (!status) continue; + + for (int i=0;i2){ + char sizemod='\0'; + capacity_long = atol(parsed[2]); + + char *temp = yon_char_from_double(yon_size_long_convert_automatic(capacity_long,&sizemod)); + capacity = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>7&&!yon_char_is_empty(parsed[7])){ + char sizemod='\0'; + free_space_long = capacity_long-atol(parsed[7]); + char *temp = yon_char_from_double(yon_size_long_convert_automatic(free_space_long,&sizemod)); + free_space = yon_char_append_c(temp,sizemod); + free(temp); + } + if (parsed_size>3){ + fs_type = parsed[3]; + } + if (parsed_size>4){ + label = parsed[4]; + } + + GtkTreeIter itar; + gtk_list_store_append(widgets->PartitionsList,&itar); + gtk_list_store_set(widgets->PartitionsList,&itar,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,8,1,-1); + } + yon_char_parsed_free(parsed,parsed_size); + } + } + } + yon_char_parsed_free(partitions,size); +} + +void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ + gtk_list_store_clear(widgets->PartitionsList); + yon_advanced_partition_clear(widgets); + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); + + int chosen = 0; + chosen = yon_advanced_get_part_size(widgets); + + if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ + int status; + char *target; + gtk_tree_model_get(model,&iter,0,&target,5,&status,-1); + if (!status){ // checks + if (chosen <2){ + gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); + chosen++; + } else { + for_iter (model,&iter){ + gtk_tree_model_get(model,&iter,5,&status,-1); + if (!status){ + gtk_list_store_set(widgets->DevicesList,&iter,6,0,-1); + } + } + + } + } else { // unchecks + gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); + if (chosen == 2){ + for_iter (model,&iter){ + gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1); + } + } + chosen--; + } + } + + if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1); + else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0); + yon_advanced_parts_update(widgets); +} \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 064d435..b20b5e1 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -195,13 +195,13 @@ int yon_advanced_sections_save(dictionary *dict){ char *size = yon_char_unite(size_first,size_last?",":NULL,size_last,NULL); yon_config_register(part_size_parameter,part_size_parameter_command,size); - char *part_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->SectionMarkEntry)); - char *part_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->SectionMarkEntry)):NULL; + char *part_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->PartLabelEntry)); + char *part_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->PartLabelEntry)):NULL; char *part_label = yon_char_unite(part_label_first,part_label_last?",":NULL,part_label_last,NULL); yon_config_register(part_label_parameter,part_label_parameter_command,part_label); - char *fs_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemMarkentry)); - char *fs_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemMarkentry)):NULL; + char *fs_label_first = (char*)gtk_entry_get_text(GTK_ENTRY(first_section->FileSystemLabelEntry)); + char *fs_label_last = last_section&&!strcmp(format_last,"yes")?(char*)gtk_entry_get_text(GTK_ENTRY(last_section->FileSystemLabelEntry)):NULL; char *fs_label = yon_char_unite(fs_label_first,fs_label_last?",":NULL,fs_label_last,NULL); yon_config_register(part_fs_label_parameter,part_fs_label_parameter_command,fs_label); @@ -279,11 +279,6 @@ int yon_install_advanced_save(main_window *widgets){ return 1; } -void yon_install_advanced_init(main_window *){ - // char *boot = config(boot_parameter); - // char *swap = config(swap_parameter); -} - void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_button, GtkComboBox *spin_combo){ GtkTreeModel *model; GtkTreeIter iter; @@ -641,9 +636,9 @@ advanced_partition *yon_advanced_partition_new(){ part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch"); part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin"); part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo"); - part->SectionMarkEntry = yon_gtk_builder_get_widget(builder,"SectionMarkEntry"); + part->PartLabelEntry = yon_gtk_builder_get_widget(builder,"PartLabelEntry"); part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo"); - part->FileSystemMarkentry = yon_gtk_builder_get_widget(builder,"FileSystemMarkentry"); + part->FileSystemLabelEntry = yon_gtk_builder_get_widget(builder,"FileSystemLabelEntry"); part->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo"); part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry"); part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton"); @@ -719,136 +714,3 @@ void on_install_advanced_add_new(GtkWidget *, main_window *widgets){ yon_advanced_partition_setup(part,widgets); on_advanced_parts_added(NULL,NULL,widgets); } - -void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ - gtk_list_store_clear(widgets->PartitionsList); - yon_advanced_partition_clear(widgets); - - int size; - config_str partitions; - partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size); - for (int i=0;iDevicesList); - - int chosen = 0; - chosen = yon_advanced_get_part_size(widgets); - - if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ - int status; - gtk_tree_model_get(model,&iter,5,&status,-1); - if (!status){ - if (chosen <2){ - gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); - chosen++; - } else { - for_iter (model,&iter){ - gtk_tree_model_get(model,&iter,5,&status,-1); - if (!status){ - gtk_list_store_set(widgets->DevicesList,&iter,6,0,-1); - } - } - - } - } else { - gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); - if (chosen == 2){ - for_iter (model,&iter){ - gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1); - } - } - chosen--; - } - } - - if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1); - else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0); - - for_iter (model,&iter){ - char *disk_path; - int status; - gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1); - if (!status) continue; - - for (int i=0;i2){ - char sizemod='\0'; - capacity_long = atol(parsed[2]); - - char *temp = yon_char_from_double(yon_size_long_convert_automatic(capacity_long,&sizemod)); - capacity = yon_char_append_c(temp,sizemod); - free(temp); - } - if (parsed_size>7&&!yon_char_is_empty(parsed[7])){ - char sizemod='\0'; - free_space_long = capacity_long-atol(parsed[7]); - char *temp = yon_char_from_double(yon_size_long_convert_automatic(free_space_long,&sizemod)); - free_space = yon_char_append_c(temp,sizemod); - free(temp); - } - if (parsed_size>3){ - fs_type = parsed[3]; - } - if (parsed_size>4){ - label = parsed[4]; - } - - GtkTreeIter itar; - gtk_list_store_append(widgets->PartitionsList,&itar); - gtk_list_store_set(widgets->PartitionsList,&itar,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,8,1,-1); - } - yon_char_parsed_free(parsed,parsed_size); - } - } - } - -} - -void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); - - int chosen = 0; - chosen = yon_advanced_get_part_size(widgets); - - gtk_tree_model_get_iter_from_string(model,&iter,path); - int status; - char *target_part; - gtk_tree_model_get(model,&iter,0,&target_part,7,&status,-1); - - if (!status){ - if (chosen<2){ - gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); - chosen++; - advanced_partition *part = yon_advanced_partition_new(); - part->part_type = ADVANCED_PART_EXISTING; - part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); - part->part = target_part; - gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); - gtk_widget_show(part->MainBox); - yon_advanced_partition_setup(part,widgets); - on_advanced_parts_added(NULL,NULL,widgets); - } - } else { - gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); - advanced_partition *part = g_object_get_data(G_OBJECT(widgets->AdvancedPartitionAddBox),target_part); - if (part){ - on_advanced_part_remove(part->RemoveButton,widgets); - } - } -} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index e00263c..99e9cfb 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -886,7 +886,7 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->AdvancedSwapFixedSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->AdvancedSwapFixedSpin); g_signal_connect(G_OBJECT(widgets->AdvancedSwapFixedSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->AdvancedSwapFixedSizeSwitch); - g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); + // g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedDeviceChosenCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); g_signal_connect(G_OBJECT(widgets->KeyboardLayoutChosenCell),"toggled",G_CALLBACK(on_keyboard_layout_chosen),widgets); @@ -895,6 +895,8 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->StartScenarioButton),"clicked",G_CALLBACK(yon_quick_install),widgets); g_signal_connect(G_OBJECT(widgets->SourceButton),"clicked",G_CALLBACK(on_source_clicked),widgets); g_signal_connect(G_OBJECT(widgets->SkipInstallationButton),"clicked",G_CALLBACK(on_system_setup_pass),widgets); + // g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_advanced_new),widgets); + // g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_advanced_added),widgets); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),(GtkTreeModelFilterVisibleFunc)on_country_filter,widgets,NULL); { diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 307e6a6..c590248 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -701,9 +701,9 @@ typedef struct { GtkWidget *FormatRevealer; GtkWidget *SizeSpin; GtkWidget *SizeCombo; - GtkWidget *SectionMarkEntry; + GtkWidget *PartLabelEntry; GtkWidget *FileSystemTypeCombo; - GtkWidget *FileSystemMarkentry; + GtkWidget *FileSystemLabelEntry; GtkWidget *EncryptionCombo; GtkWidget *EncryptionEntry; GtkWidget *EncryptionButton; @@ -930,6 +930,20 @@ typedef struct { } source_element; +typedef struct { + char *partition; + char *device_source; + gboolean format; + unsigned long size; + char size_letter; + char *part_label; + char *fs_type; + char *fs_label; + char *encryption; + char *encryption_password; +} advanced_section; + + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -1139,4 +1153,12 @@ gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *w int yon_char_parsed_compare(const void *a, const void *b); gboolean yon_os_component_insert(os_row *row); void *yon_os_components_setup(main_window *widgets); -gboolean yon_spinner_switch_off(GtkSpinner *target); \ No newline at end of file +gboolean yon_spinner_switch_off(GtkSpinner *target); +void on_advanced_added(GtkWidget *, char *, main_window *); +void on_advanced_new(GtkWidget *, main_window *); +int yon_advanced_section_get(char *partition); +void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_section *section); +void yon_advanced_update(main_window *widgets); +void on_advanced_partition_create(GtkWidget *, main_window *widgets); +void yon_advanced_parts_update(main_window *widgets); +void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets); \ No newline at end of file diff --git a/source/ubl-settings-advanced.c b/source/ubl-settings-advanced.c deleted file mode 100644 index 57c7fed..0000000 --- a/source/ubl-settings-advanced.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "ubinstall-gtk.h" - -typedef struct { - char *section; - int sys_section; - int user_section; - int format; - int size; - char size_letter; - char *part_label; - char *fs_type; - char *fs_label; - char *encryption; - char *encryption_password; - -} advanced_section; - -int sections_size=0; -advanced_section *sections[2] = {NULL}; - -advanced_section *yon_advanced_section_new(){ - if (sections_size>=2) return NULL; - - advanced_section *section = malloc(sizeof(advanced_section)); - memset(section,0,sizeof(advanced_section)); - sections[sections_size] = section; - sections_size++; - return section; -} - -void yon_advanced_section_remove(int pos){ - switch(pos){ - case 0: - free(sections[0]); - if (sections[1]){ - sections[0]=sections[1]; - sections[1]=NULL; - } else { - sections[0]=NULL; - } - sections_size--; - break; - case 1: - if (sections[1]){ - free(sections[1]); - sections[1]=NULL; - sections_size--; - } - break; - default: return; - } -} - - - -// add section from tree view -void yon_advanced_add(main_window *widgets){ - -} - -//new section from button -void yon_advanced_new(main_window *widgets){ - -} \ No newline at end of file From 632531523313490328638ed2e565925b940e551e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 30 Sep 2025 18:03:54 +0600 Subject: [PATCH 5/9] WIP Advanced installation --- source/ubinstall-gtk-advanced.c | 186 +++++++++++++++++++--------- source/ubinstall-gtk-installation.c | 137 +------------------- source/ubinstall-gtk.c | 12 +- source/ubinstall-gtk.h | 9 +- ubinstall-gtk.glade | 1 - 5 files changed, 136 insertions(+), 209 deletions(-) diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index fca3dd9..e9cdcbd 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -13,6 +13,18 @@ advanced_section *yon_advanced_section_new(){ return section; } +void yon_advanced_section_remove_all(){ + if (sections[0]){ + free(sections[0]); + sections[0]=NULL; + } + if (sections[1]){ + free(sections[1]); + sections[1]=NULL; + } + sections_size=0; +} + void yon_advanced_section_remove(char *part){ int pos = yon_advanced_section_get(part); switch(pos){ @@ -41,52 +53,60 @@ void yon_advanced_section_remove(char *part){ int yon_advanced_section_get(char *partition){ if (yon_char_is_empty(partition)) return -1; - if (sections_size>0&&!strcmp(sections[0]->part_label,partition)){ + if (sections_size>0&&!strcmp(sections[0]->partition,partition)){ return 0; - } else if (sections_size>1&&!strcmp(sections[1]->part_label,partition)){ + } else if (sections_size>1&&!strcmp(sections[1]->partition,partition)){ return 1; } return -1; } void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_section *section){ - gtk_label_set_text(GTK_LABEL(part->SectionLabel),section->part_label); - if (section->format){ - gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(part->SizeSpin),section->size); - gtk_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),yon_get_size_get_from_letter(section->size_letter)); - gtk_entry_set_text(GTK_ENTRY(part->PartLabelEntry),section->part_label); - gtk_entry_set_text(GTK_ENTRY(part->FileSystemLabelEntry),section->fs_label); - gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo),section->fs_type); - gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->EncryptionCombo),section->encryption); - gtk_entry_set_text(GTK_ENTRY(part->EncryptionEntry),section->encryption_password); + if (part&§ion){ + gtk_label_set_text(GTK_LABEL(part->SectionLabel),section->partition); + part->part = yon_char_new(section->partition); + if (section->format){ + gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(part->SizeSpin),section->size); + gtk_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),yon_get_size_get_from_letter(section->size_letter)); + gtk_entry_set_text(GTK_ENTRY(part->PartLabelEntry),section->part_label); + gtk_entry_set_text(GTK_ENTRY(part->FileSystemLabelEntry),section->fs_label); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo),section->fs_type); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->EncryptionCombo),section->encryption); + gtk_entry_set_text(GTK_ENTRY(part->EncryptionEntry),section->encryption_password); + } } - } void yon_advanced_update(main_window *widgets){ - GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); - GList *iter; - for (iter = list; iter; iter=iter->next){ - gtk_widget_destroy(GTK_WIDGET(iter->data)); - } + yon_advanced_partition_clear(widgets); + for (int i=0;iRemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); yon_advanced_partition_set_from_section(part,sections[i]); gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); + + part->part_type = ADVANCED_PART_EXISTING; + } + if (sections_size==2){ + gtk_widget_hide(widgets->AdvancedAddButton); + } else { + gtk_widget_show(widgets->AdvancedAddButton); + } } void on_advanced_partition_create(GtkWidget *, main_window *widgets){ - GtkTreeIter iter; + GtkTreeIter iter, *last_found; for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){ char *target; int active; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,3,&active,-1); - gtk_list_store_set(widgets->DevicesList,&iter,3,!active,-1); - if (!active){ - if (sections_size==2) return; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,5,&active,-1); + if (active){ + if (sections_size==2) break; advanced_section *section = yon_advanced_section_new(); + section->partition = target; sections[sections_size]=section; sections_size++; } @@ -99,8 +119,8 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->PartitionsList),&iter,path)){ char *target; int status; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,5,&status,-1); - gtk_list_store_set(widgets->DevicesList,&iter,3,!status,-1); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,7,&status,-1); + gtk_list_store_set(widgets->DevicesList,&iter,7,!status,-1); if (!status){ if (sections_size==2) return; advanced_section *section = yon_advanced_section_new(); @@ -133,22 +153,17 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi if (chosen<2){ gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); chosen++; - advanced_partition *part = yon_advanced_partition_new(); - part->part_type = ADVANCED_PART_EXISTING; - part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); - part->part = target_part; - gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); - gtk_widget_show(part->MainBox); - yon_advanced_partition_setup(part,widgets); - on_advanced_parts_added(NULL,NULL,widgets); + + advanced_section *section = yon_advanced_section_new(); + section->partition = target_part; + sections[sections_size]=section; + sections_size++; } } else { gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); - advanced_partition *part = g_object_get_data(G_OBJECT(widgets->AdvancedPartitionAddBox),target_part); - if (part){ - on_advanced_part_remove(part->RemoveButton,widgets); - } + yon_advanced_section_remove(target_part); } + yon_advanced_update(widgets); } void yon_advanced_parts_update(main_window *widgets){ @@ -215,42 +230,91 @@ void yon_advanced_parts_update(main_window *widgets){ void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ gtk_list_store_clear(widgets->PartitionsList); - yon_advanced_partition_clear(widgets); + yon_advanced_section_remove_all(); GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); - - int chosen = 0; - chosen = yon_advanced_get_part_size(widgets); + // int chosen = 0; + // chosen = yon_advanced_get_part_size(widgets); if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ int status; char *target; gtk_tree_model_get(model,&iter,0,&target,5,&status,-1); if (!status){ // checks - if (chosen <2){ - gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); - chosen++; - } else { - for_iter (model,&iter){ - gtk_tree_model_get(model,&iter,5,&status,-1); - if (!status){ - gtk_list_store_set(widgets->DevicesList,&iter,6,0,-1); - } - } - - } + gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); + } else { // unchecks gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1); - if (chosen == 2){ - for_iter (model,&iter){ - gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1); - } + for_iter (model,&iter){ + gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1); } - chosen--; } } - if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1); - else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0); + // if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1); + // else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0); yon_advanced_parts_update(widgets); -} \ No newline at end of file + yon_advanced_update(widgets); +} + +void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){ + yon_password_open(GTK_ENTRY(part->EncryptionEntry)); +} + +void yon_advanced_partition_clear(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + advanced_partition *part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition"); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + free(part); + } +} + +int yon_advanced_get_part_size(main_window *widgets){ + int size = 0; + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + size = g_list_length(list); + g_list_free(list); + return size; +} + +advanced_partition *yon_advanced_partition_new(){ + advanced_partition *part = new(advanced_partition); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); + part->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + part->SectionLabel = yon_gtk_builder_get_widget(builder,"SectionLabel"); + part->SystemSectionToggle = yon_gtk_builder_get_widget(builder,"SystemSectionToggle"); + part->UserDataSectionToggle = yon_gtk_builder_get_widget(builder,"UserDataSectionToggle"); + part->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); + part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch"); + part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin"); + part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo"); + part->PartLabelEntry = yon_gtk_builder_get_widget(builder,"PartLabelEntry"); + part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo"); + part->FileSystemLabelEntry = yon_gtk_builder_get_widget(builder,"FileSystemLabelEntry"); + part->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo"); + part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry"); + part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton"); + part->FormatRevealer = yon_gtk_builder_get_widget(builder,"FormatRevealer"); + part->order_iter = NULL; + part->part = NULL; + + yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); + g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); + // g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_system_toggled),part); + // g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_user_toggled),part); + + g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); + g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part); + + return part; +} + +void on_advanced_part_remove(GtkWidget *self, main_window *widgets){ + advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition"); + + yon_advanced_section_remove(part->part); + yon_advanced_update(widgets); + +} diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index b20b5e1..8dbc822 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -578,139 +578,4 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } } -} - -void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){ - yon_password_open(GTK_ENTRY(part->EncryptionEntry)); -} - -void yon_advanced_partition_clear(main_window *widgets){ - GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); - GList *iter; - for (iter=list;iter;iter=iter->next){ - advanced_partition *part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition"); - gtk_widget_destroy(GTK_WIDGET(iter->data)); - free(part); - } - on_advanced_parts_removed(NULL,NULL,widgets); -} - -int yon_advanced_get_part_size(main_window *widgets){ - int size = 0; - GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); - size = g_list_length(list); - g_list_free(list); - return size; -} - -void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); - int status; - for_iter(model,&iter){ - gtk_tree_model_get(model,&iter,8,&status,-1); - if (!status){ - gtk_list_store_set(widgets->PartitionsList,&iter,8,state?state:0,-1); - } else { - gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1); - } - } -} - -void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList); - for_iter(model,&iter){ - gtk_list_store_set(widgets->DevicesList,&iter,6,state,-1); - } -} - -advanced_partition *yon_advanced_partition_new(){ - advanced_partition *part = new(advanced_partition); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); - part->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); - part->SectionLabel = yon_gtk_builder_get_widget(builder,"SectionLabel"); - part->SystemSectionToggle = yon_gtk_builder_get_widget(builder,"SystemSectionToggle"); - part->UserDataSectionToggle = yon_gtk_builder_get_widget(builder,"UserDataSectionToggle"); - part->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); - part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch"); - part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin"); - part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo"); - part->PartLabelEntry = yon_gtk_builder_get_widget(builder,"PartLabelEntry"); - part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo"); - part->FileSystemLabelEntry = yon_gtk_builder_get_widget(builder,"FileSystemLabelEntry"); - part->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo"); - part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry"); - part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton"); - part->FormatRevealer = yon_gtk_builder_get_widget(builder,"FormatRevealer"); - part->order_iter = NULL; - part->part = NULL; - - yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); - g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); - // g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_system_toggled),part); - // g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_user_toggled),part); - - g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); - g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part); - - return part; -} - -void on_advanced_part_remove(GtkWidget *self, main_window *widgets){ - advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition"); - - if (part->part_type == ADVANCED_PART_EXISTING){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); - for_iter(model,&iter){ - int status; - char *target; - gtk_tree_model_get(model,&iter,0,&target,7,&status,-1); - if (status&&!strcmp(target,part->part)){ - gtk_list_store_set(GTK_LIST_STORE(model),&iter,7,0,-1); - yon_advanced_set_part_sensitivity(widgets,1); - } - - } - } - g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,NULL); - g_sequence_remove(part->order_iter); - gtk_widget_destroy(part->MainBox); - on_advanced_parts_removed(NULL,NULL,widgets); - free(part); - -} - -void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets){ - if (yon_advanced_get_part_size(widgets)>=2){ - yon_advanced_set_part_sensitivity(widgets,0); - gtk_widget_hide(widgets->AdvancedAddButton); - } -} - -void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets){ - int size = yon_advanced_get_part_size(widgets); - if (size<2){ - yon_advanced_set_part_sensitivity(widgets,1); - gtk_widget_show(widgets->AdvancedAddButton); - } - if (!size){ - - } -} - -void yon_advanced_partition_setup(advanced_partition *part,main_window *widgets){ - g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); - g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,part); -} - -void on_install_advanced_add_new(GtkWidget *, main_window *widgets){ - advanced_partition *part = yon_advanced_partition_new(); - part->part_type = ADVANCED_PART_NEW; - part->order_iter = g_sequence_append(widgets->advanced_partition_order,part); - gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); - gtk_widget_show(part->MainBox); - yon_advanced_partition_setup(part,widgets); - on_advanced_parts_added(NULL,NULL,widgets); -} +} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 99e9cfb..cbf9a58 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -455,7 +455,11 @@ void set_locales_list(main_window *widgets){ char *lang_name = yon_locale_get_parameter(locales[i],YON_LOCALE_LANG_NAME); char *territory = yon_locale_get_parameter(locales[i],YON_LOCALE_TERRITORY); char *title = yon_locale_get_parameter(locales[i],YON_LOCALE_TITLE); - if (yon_char_is_empty(lang_ab)||yon_char_is_empty(language)||yon_char_is_empty(lang_name)||yon_char_is_empty(territory)||yon_char_is_empty(title)) continue; + if (yon_char_is_empty(lang_ab)|| + yon_char_is_empty(language)|| + yon_char_is_empty(lang_name)|| + yon_char_is_empty(territory)|| + yon_char_is_empty(title)) continue; char *country = yon_char_unite(language,", ",territory,NULL); if (!g_hash_table_contains(added,lang_ab)){ g_hash_table_add(added,yon_char_new(lang_ab)); @@ -888,15 +892,15 @@ void yon_main_window_create(main_window *widgets){ // g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_install_advanced_add_new),widgets); g_signal_connect(G_OBJECT(widgets->AdvancedDeviceChosenCell),"toggled",G_CALLBACK(on_install_advanced_device_chosen),widgets); - g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); + // g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); g_signal_connect(G_OBJECT(widgets->KeyboardLayoutChosenCell),"toggled",G_CALLBACK(on_keyboard_layout_chosen),widgets); // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"add",G_CALLBACK(on_advanced_parts_added),widgets); // g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"remove",G_CALLBACK(on_advanced_parts_removed),widgets); g_signal_connect(G_OBJECT(widgets->StartScenarioButton),"clicked",G_CALLBACK(yon_quick_install),widgets); g_signal_connect(G_OBJECT(widgets->SourceButton),"clicked",G_CALLBACK(on_source_clicked),widgets); g_signal_connect(G_OBJECT(widgets->SkipInstallationButton),"clicked",G_CALLBACK(on_system_setup_pass),widgets); - // g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_advanced_new),widgets); - // g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_advanced_added),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedAddButton),"clicked",G_CALLBACK(on_advanced_partition_create),widgets); + g_signal_connect(G_OBJECT(widgets->AdvancedPartChosenCell),"toggled",G_CALLBACK(on_install_advanced_partition_chosen),widgets); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),(GtkTreeModelFilterVisibleFunc)on_country_filter,widgets,NULL); { diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index c590248..97d8b4e 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1110,19 +1110,13 @@ void yon_install_advanced_init(main_window *widgets); void yon_os_components_init(main_window *widgets); void yon_pacman_init(main_window *widgets); void yon_software_init(main_window *widgets); -void on_install_advanced_add_new(GtkWidget *, main_window *widgets); void on_install_advanced_device_chosen(GtkCellRenderer*, gchar *path, main_window *widgets); void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets); void yon_devices_setup(main_window *widgets); void on_advanced_password_clicked(GtkWidget *, advanced_partition *part); advanced_partition *yon_advanced_partition_new(); -void yon_advanced_partition_setup(advanced_partition *part,main_window *widgets); void on_advanced_part_remove(GtkWidget *self, main_window *widgets); int yon_advanced_get_part_size(main_window *widgets); -void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state); -void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state); -void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets); -void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets); void yon_advanced_partition_clear(main_window *widgets); void yon_layout_build(char *key, GHashTable *value, main_window *widgets); void yon_os_row_setup(os_row *row, char *name, char *version,char *tags, char *description); @@ -1161,4 +1155,5 @@ void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_ void yon_advanced_update(main_window *widgets); void on_advanced_partition_create(GtkWidget *, main_window *widgets); void yon_advanced_parts_update(main_window *widgets); -void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets); \ No newline at end of file +void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets); +void yon_advanced_section_remove_all(); \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index acdfadb..918b567 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -7174,7 +7174,6 @@ separately into the selected partition. + True - False True True False @@ -105,6 +113,9 @@ True True image3 + False @@ -198,6 +209,7 @@ True True + adjustment1 False @@ -209,6 +221,7 @@ True False + 0 Mb Gb @@ -261,6 +274,7 @@ True False + 0 Default @@ -324,6 +338,7 @@ True False + 0 Off diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index f7f4c36..0636e16 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -323,4 +323,9 @@ treeview row:nth-child(even) { background-color: #ffffff; } button { min-width: 26px; min-height: 24px; +} + +.unsensitiveblock:disabled { + opacity:1; + background:@theme_selected_bg_color; } \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 918b567..0c189a4 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -6884,90 +6884,95 @@ separately into the selected partition. - + True - True + False + 0 in - 105 - + True - True - DevicesList - 0 - - - none - - + False - + + 125 + True + True + DevicesList + 0 - - - 6 - 5 - + + + + + 6 + 5 + + + - - - - - Device - - - 0 - + + Device + + + + 0 + + + - - - - - Description - - - 1 - + + Description + + + + 1 + + + - - - - - Label - - - 2 - + + Label + + + + 2 + + + - - - - - Size - - - 3 - + + Size + + + + 3 + + + - - - - - Serial - - - 4 - + + Serial + + + + 4 + + + + + + False @@ -7050,90 +7055,95 @@ separately into the selected partition. - + True - True + False + 0 in - 140 - + True - True - PartitionsList - 0 - - - none - - + False - + + 125 + True + True + PartitionsList + 0 - - - 8 - 7 - + + + + + 8 + 7 + + + - - - - - Section - - - 0 - + + Section + + + + 0 + + + - - - - - Capacity - - - 1 - + + Capacity + + + + 1 + + + - - - - - Free space - - - 2 - + + Free space + + + + 2 + + + - - - - - File system - - - 3 - + + File system + + + + 3 + + + - - - - - Label - - - 4 - + + Label + + + + 4 + + + + + + False @@ -9836,9 +9846,6 @@ separately into the selected partition. True DevicesList 0 - - - Device @@ -9940,9 +9947,6 @@ separately into the selected partition. True PartitionsList 0 - - - Section From 2abd3a7b86b7f06944c548aeea1657cde71cf499 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 3 Oct 2025 18:09:31 +0600 Subject: [PATCH 7/9] WIP advanced install saving --- source/ubinstall-gtk-advanced.c | 141 +++++++++++++++++++++++++++- source/ubinstall-gtk-installation.c | 109 +++++++++++---------- source/ubinstall-gtk-page-switch.c | 2 +- source/ubinstall-gtk.h | 11 ++- ubinstall-gtk-advanced-box.glade | 2 + 5 files changed, 204 insertions(+), 61 deletions(-) diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index 396e0d6..7182df4 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -89,6 +89,7 @@ void yon_advanced_update(main_window *widgets){ g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets); g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets); + g_signal_connect(G_OBJECT(part->SizeCombo),"changed",G_CALLBACK(on_advanced_size_changed),widgets); if (i==0){ gtk_widget_set_sensitive(part->SystemSectionToggle,0); gtk_widget_set_sensitive(part->UserDataSectionToggle,0); @@ -100,6 +101,7 @@ void yon_advanced_update(main_window *widgets){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->UserDataSectionToggle),1); } yon_advanced_partition_set_from_section(part,sections[i]); + yon_advanced_set_max_size_from_partition(part,widgets); gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); part->part_type = ADVANCED_PART_EXISTING; @@ -265,6 +267,39 @@ void yon_advanced_parts_update(main_window *widgets){ yon_char_parsed_free(partitions,size); } +void yon_advanced_set_max_size_from_partition(advanced_partition *part, main_window *widgets){ + char *cur_name = part->part; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList); + GtkTreeIter iter; + long selected_size; + + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,0,&target,-1); + if (!strcmp(target,cur_name)){ + gtk_tree_model_get(model,&iter,6,&selected_size,-1); + if (!selected_size){ + gtk_tree_model_get(model,&iter,5,&selected_size,-1); + } + if (selected_size){ + GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(part->SizeSpin)); + const char *sizemod = gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->SizeCombo)); + double new_size = yon_size_long_convert_to_mod(selected_size,sizemod[0]); + gtk_adjustment_set_upper(adj,new_size); + gdouble old_value = gtk_adjustment_get_value(adj); + if (old_value>new_size){ + gtk_adjustment_set_value(adj,new_size); + } + } + } + } +} + +void on_advanced_size_changed(GtkWidget *self,main_window *widgets){ + advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition"); + yon_advanced_set_max_size_from_partition(part,widgets); +} + void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ gtk_list_store_clear(widgets->PartitionsList); yon_advanced_section_remove_all(); @@ -295,7 +330,10 @@ void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_wind } void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){ - yon_password_open(GTK_ENTRY(part->EncryptionEntry)); + yon_password_window *window = yon_password_open(GTK_ENTRY(part->EncryptionEntry)); + gtk_widget_hide(gtk_widget_get_parent(window->EncryptionCombo)); + gtk_widget_hide(window->HashBox); + gtk_widget_hide(window->NoEncriptionCheck); } void yon_advanced_partition_clear(main_window *widgets){ @@ -338,6 +376,96 @@ void on_advanced_section_toggled(GtkWidget *self, main_window *widgets){ } } +int yon_advanced_save(main_window *){ + int devices_size; + config_str devices = NULL; + int parts_size; + config_str parts = NULL; + int part_size_size; + config_str part_size = NULL; + int part_label_size; + config_str part_label = NULL; + int fs_type_size; + config_str fs_type = NULL; + int fs_label_size; + config_str fs_label = NULL; + int encryption_size; + config_str encryption = NULL; + int format_size; + config_str format = NULL; + if (!sections_size){ + + return 0; + } + advanced_section *cur_section = sections[0]->sys_section?sections[0]:sections[1]; + yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device); + if (cur_section->user_section){ + yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device); + } + if (!yon_char_is_empty(cur_section->partition)){ + yon_char_parsed_add_or_create_if_exists(parts,&parts_size,cur_section->partition); + } else { + yon_char_parsed_add_or_create_if_exists(parts,&parts_size,""); + } + if (cur_section->size){ + char *size_str = yon_char_from_long(cur_section->size); + char *sz_str = yon_char_append_c(size_str,cur_section->size_letter); + yon_char_parsed_add_or_create_if_exists(part_size,&part_size_size,sz_str); + } + if (!yon_char_is_empty(cur_section->part_label)){ + yon_char_parsed_add_or_create_if_exists(part_label,&part_label_size,cur_section->part_label); + } + if (!yon_char_is_empty(cur_section->fs_type)){ + yon_char_parsed_add_or_create_if_exists(fs_type,&fs_type_size,cur_section->fs_type); + } + if (!yon_char_is_empty(cur_section->fs_label)){ + yon_char_parsed_add_or_create_if_exists(fs_label,&fs_label_size,cur_section->fs_label); + } + if (cur_section->format){ + yon_char_parsed_add_or_create_if_exists(format,&format_size,"yes"); + } else { + yon_char_parsed_add_or_create_if_exists(format,&format_size,"no"); + } + if (!yon_char_is_empty(cur_section->encryption)){ + char *encrypt_str = yon_char_unite(cur_section->encryption,":",cur_section->encryption_password,NULL); + yon_char_parsed_add_or_create_if_exists(encryption,&encryption_size,encrypt_str); + } + if (sections_size>1){ + cur_section = sections[0]->sys_section?sections[1]:sections[0]; + + yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device); + if (!yon_char_is_empty(cur_section->partition)){ + yon_char_parsed_add_or_create_if_exists(parts,&parts_size,cur_section->partition); + } else { + yon_char_parsed_add_or_create_if_exists(parts,&parts_size,""); + } + if (cur_section->size){ + char *size_str = yon_char_from_long(cur_section->size); + char *sz_str = yon_char_append_c(size_str,cur_section->size_letter); + yon_char_parsed_add_or_create_if_exists(part_size,&part_size_size,sz_str); + } + if (!yon_char_is_empty(cur_section->part_label)){ + yon_char_parsed_add_or_create_if_exists(part_label,&part_label_size,cur_section->part_label); + } + if (!yon_char_is_empty(cur_section->fs_type)){ + yon_char_parsed_add_or_create_if_exists(fs_type,&fs_type_size,cur_section->fs_type); + } + if (!yon_char_is_empty(cur_section->fs_label)){ + yon_char_parsed_add_or_create_if_exists(fs_label,&fs_label_size,cur_section->fs_label); + } + if (cur_section->format){ + yon_char_parsed_add_or_create_if_exists(format,&format_size,"yes"); + } else { + yon_char_parsed_add_or_create_if_exists(format,&format_size,"no"); + } + if (!yon_char_is_empty(cur_section->encryption)){ + char *encrypt_str = yon_char_unite(cur_section->encryption,":",cur_section->encryption_password,NULL); + yon_char_parsed_add_or_create_if_exists(encryption,&encryption_size,encrypt_str); + } + } + return 1; +} + advanced_partition *yon_advanced_partition_new(){ advanced_partition *part = new(advanced_partition); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); @@ -361,14 +489,23 @@ advanced_partition *yon_advanced_partition_new(){ yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); - + g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionButton); + g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionEntry); + yon_fs_type_setup(GTK_COMBO_BOX_TEXT(part->FileSystemTypeCombo)); g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); + g_object_set_data(G_OBJECT(part->SizeCombo),"advanced_partition",part); g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part); g_object_set_data(G_OBJECT(part->SystemSectionToggle),"advanced_partition",part); g_object_set_data(G_OBJECT(part->UserDataSectionToggle),"advanced_partition",part); + int size; + config_str encryptions = yon_char_parsed_new(&size,encryptions_list,NULL); + for (int i=0;iEncryptionCombo),encryptions[i],encryptions[i]); + } + yon_char_parsed_free(encryptions,size); return part; } diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 1ee56ae..91062f9 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -225,59 +225,59 @@ int yon_advanced_sections_save(dictionary *dict){ return 1; } -int yon_install_advanced_save(main_window *widgets){ - - GtkTreeModel *model; - GtkTreeIter iter; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedDeviceTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedDeviceTree)); - return 0; - } - char *device; - gtk_tree_model_get(model,&iter,0,&device,-1); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedPartitionTree)),&model,&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedPartitionTree)); - return 0; - } - yon_config_remove_by_key(part_size_parameter); - char *part; - gtk_tree_model_get(model,&iter,0,&part,-1); - - if (!yon_advanced_sections_save(widgets->advanced_sections)){ - return 0; - } - - if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){ - if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){ - yon_config_register(swap_parameter,swap_parameter_command,"auto"); - } else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapRamSwitch))){ - yon_config_register(swap_parameter,swap_parameter_command,"yes"); - yon_config_register(swap_size_parameter,swap_size_parameter_command,"ram"); - } else { - yon_config_register(swap_parameter,swap_parameter_command,"yes"); - char *swap = g_strdup_printf("%d%s",gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->AdvancedSwapFixedSpin)),yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdvancedSwapFixedSizeSwitch))+1)); - yon_config_register(swap_size_parameter,swap_size_parameter_command,swap); - } - } - const char *device_typevfs = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->AdvancedVirtualDeviceCombo)); - if (!yon_char_is_empty(device_typevfs)){ - yon_config_register(device_typevfs_parameter,device_typevfs_parameter_command,(char*)device_typevfs); - } else { - yon_config_remove_by_key(device_typevfs_parameter); - } - if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedLoadTypeSwitch))){ - char *bios = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedBiosSectorSwitch))?"bios":""; - char *efi = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedEFISwitch))?"efi":NULL; - char *boot = yon_char_unite(bios,!yon_char_is_empty(bios)&&!yon_char_is_empty(efi)?"+":"",efi,NULL); - yon_config_register(boot_parameter,boot_parameter_command,boot); - } else { - yon_config_register(boot_parameter,boot_parameter_command,"none"); - } - - return 1; -} +// int yon_install_advanced_save(main_window *widgets){ + +// GtkTreeModel *model; +// GtkTreeIter iter; +// if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedDeviceTree)),&model,&iter)){ +// yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); +// yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedDeviceTree)); +// return 0; +// } +// char *device; +// gtk_tree_model_get(model,&iter,0,&device,-1); +// if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->AdvancedPartitionTree)),&model,&iter)){ +// yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),NO_DEVICE_CHOSEN_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); +// yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->AdvancedPartitionTree)); +// return 0; +// } +// yon_config_remove_by_key(part_size_parameter); +// char *part; +// gtk_tree_model_get(model,&iter,0,&part,-1); + +// if (!yon_advanced_sections_save(widgets->advanced_sections)){ +// return 0; +// } + +// if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){ +// if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){ +// yon_config_register(swap_parameter,swap_parameter_command,"auto"); +// } else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapRamSwitch))){ +// yon_config_register(swap_parameter,swap_parameter_command,"yes"); +// yon_config_register(swap_size_parameter,swap_size_parameter_command,"ram"); +// } else { +// yon_config_register(swap_parameter,swap_parameter_command,"yes"); +// char *swap = g_strdup_printf("%d%s",gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->AdvancedSwapFixedSpin)),yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdvancedSwapFixedSizeSwitch))+1)); +// yon_config_register(swap_size_parameter,swap_size_parameter_command,swap); +// } +// } +// const char *device_typevfs = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->AdvancedVirtualDeviceCombo)); +// if (!yon_char_is_empty(device_typevfs)){ +// yon_config_register(device_typevfs_parameter,device_typevfs_parameter_command,(char*)device_typevfs); +// } else { +// yon_config_remove_by_key(device_typevfs_parameter); +// } +// if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedLoadTypeSwitch))){ +// char *bios = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedBiosSectorSwitch))?"bios":""; +// char *efi = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedEFISwitch))?"efi":NULL; +// char *boot = yon_char_unite(bios,!yon_char_is_empty(bios)&&!yon_char_is_empty(efi)?"+":"",efi,NULL); +// yon_config_register(boot_parameter,boot_parameter_command,boot); +// } else { +// yon_config_register(boot_parameter,boot_parameter_command,"none"); +// } + +// return 1; +// } void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_button, GtkComboBox *spin_combo){ GtkTreeModel *model; @@ -305,9 +305,6 @@ void on_partition_changed(GtkWidget *self, main_window *widgets){ if (self==widgets->NextInstallationSysSectionTree||self == widgets->NextInstallationSizeTypeSpin){ yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->NextInstallationSysSectionTree),GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin)); } - if (self==widgets->AdvancedPartitionTree){ - - } } diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index b13fbd6..ebd9902 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -191,7 +191,7 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ return yon_install_same_partition_save(widgets); break; case YON_PAGE_INSTALL_ADVANCED: - return yon_install_advanced_save(widgets); + return yon_advanced_save(widgets); break; case YON_PAGE_RECOVERY_GRUB_INSTALL: return yon_grub_install_save(widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index aed12c2..928ca8a 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -72,6 +72,8 @@ #define network_path "resource:///com/ublinux/csv/network-list.csv" #define fs_types_path "resource:///com/ublinux/csv/filesystems-format-list.csv" +#define encryptions_list "luks1","luks2" + #define locales_list_command "/usr/share/i18n/locales/" #define slide_0_path "/com/ublinux/images/slide-0.png" @@ -937,7 +939,9 @@ enum PART_SOURCE { typedef struct { char *partition; - char *device_source; + char *device; + int sys_section; + int user_section; gboolean format; unsigned long size; char size_letter; @@ -1164,4 +1168,7 @@ void yon_advanced_parts_update(main_window *widgets); void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets); void yon_advanced_section_remove_all(); void on_advanced_section_toggled(GtkWidget *self, main_window *widgets); -void yon_fs_type_setup(GtkComboBoxText *target); \ No newline at end of file +void yon_fs_type_setup(GtkComboBoxText *target); +void yon_advanced_set_max_size_from_partition(advanced_partition *part, main_window *widgets); +void on_advanced_size_changed(GtkWidget *self,main_window *widgets); +int yon_advanced_save(main_window *widgets); \ No newline at end of file diff --git a/ubinstall-gtk-advanced-box.glade b/ubinstall-gtk-advanced-box.glade index 137b215..648d669 100644 --- a/ubinstall-gtk-advanced-box.glade +++ b/ubinstall-gtk-advanced-box.glade @@ -364,6 +364,7 @@ True + False True @@ -375,6 +376,7 @@ True + False True True image4 From 207aae4b7f8d03dc80c0ae1d6b82af9d4408aa37 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 6 Oct 2025 18:06:35 +0600 Subject: [PATCH 8/9] WIP advanced saving --- source/ubinstall-gtk-advanced.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index 7182df4..fcbbe4e 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -463,6 +463,38 @@ int yon_advanced_save(main_window *){ yon_char_parsed_add_or_create_if_exists(encryption,&encryption_size,encrypt_str); } } + + if (devices_size){ + char *devices_str = yon_char_parsed_to_string(devices,devices_size,","); + } + if (parts_size){ + char *parts_str = yon_char_parsed_to_string(parts,parts_size,","); + + } + if (part_size_size){ + char *part_size_str = yon_char_parsed_to_string(part_size,part_size_size,","); + + } + if (part_label_size){ + char *part_label_str = yon_char_parsed_to_string(part_label,part_label_size,","); + + } + if (fs_type_size){ + char *fs_type_str = yon_char_parsed_to_string(fs_type,fs_type_size,","); + + } + if (fs_label_size){ + char *fs_label_str = yon_char_parsed_to_string(fs_label,fs_label_size,","); + + } + if (encryption_size){ + char *encryption_str = yon_char_parsed_to_string(encryption,encryption_size,","); + + } + if (format_size){ + char *format_str = yon_char_parsed_to_string(format,format_size,","); + + } return 1; } From b0d012501a57508115fa41de524e92c77fcc5f30 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 8 Oct 2025 18:36:17 +0600 Subject: [PATCH 9/9] WIP Advanced saving --- source/ubinstall-gtk-advanced.c | 98 ++++++++++++++++++++++++++--- source/ubinstall-gtk-installation.c | 2 +- source/ubinstall-gtk.h | 3 +- ubinstall-gtk-advanced-box.glade | 4 +- ubinstall-gtk.glade | 15 +++++ 5 files changed, 111 insertions(+), 11 deletions(-) diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index fcbbe4e..839fd21 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -129,6 +129,7 @@ void on_advanced_partition_create(GtkWidget *, main_window *widgets){ if (sections_size==2) break; advanced_section *section = yon_advanced_section_new(); section->part_source = PART_SOURCE_DEVICE; + section->device = target; section->partition = target; sections[sections_size]=section; sections_size++; @@ -144,6 +145,7 @@ void on_advanced_partition_create(GtkWidget *, main_window *widgets){ if (sections_size==2) return; advanced_section *section = yon_advanced_section_new(); section->part_source = PART_SOURCE_DEVICE; + section->device = target; section->partition = target; sections[sections_size]=section; sections_size++; @@ -154,14 +156,16 @@ void on_advanced_partition_create(GtkWidget *, main_window *widgets){ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ GtkTreeIter iter; if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->PartitionsList),&iter,path)){ - char *target; + char *target, *device; int status; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,7,&status,-1); + gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,7,&status,9,&device,-1); gtk_list_store_set(widgets->DevicesList,&iter,7,!status,-1); if (!status){ if (sections_size==2) return; advanced_section *section = yon_advanced_section_new(); section->part_source = PART_SOURCE_PART; + section->device = device; + section->partition = target = device; sections[sections_size]=section; sections_size++; } else { @@ -173,7 +177,6 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ } void yon_install_advanced_init(main_window *){ - } void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ @@ -185,8 +188,8 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi gtk_tree_model_get_iter_from_string(model,&iter,path); int status; - char *target_part; - gtk_tree_model_get(model,&iter,0,&target_part,7,&status,-1); + char *target_part, *device; + gtk_tree_model_get(model,&iter,0,&target_part,7,&status,9,&device,-1); if (!status){ if (chosen<2){ @@ -195,6 +198,8 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi advanced_section *section = yon_advanced_section_new(); section->part_source = PART_SOURCE_PART; section->partition = target_part; + section->device = device; + section->device = device; sections[sections_size]=section; sections_size++; } @@ -376,7 +381,8 @@ void on_advanced_section_toggled(GtkWidget *self, main_window *widgets){ } } -int yon_advanced_save(main_window *){ +int yon_advanced_save(main_window *widgets){ + yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"custom"); int devices_size; config_str devices = NULL; int parts_size; @@ -399,7 +405,7 @@ int yon_advanced_save(main_window *){ } advanced_section *cur_section = sections[0]->sys_section?sections[0]:sections[1]; yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device); - if (cur_section->user_section){ + if (cur_section->device){ yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device); } if (!yon_char_is_empty(cur_section->partition)){ @@ -466,38 +472,107 @@ int yon_advanced_save(main_window *){ if (devices_size){ char *devices_str = yon_char_parsed_to_string(devices,devices_size,","); + yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,devices_str); } if (parts_size){ char *parts_str = yon_char_parsed_to_string(parts,parts_size,","); + yon_config_register(part_parameter,part_parameter_command,parts_str); } if (part_size_size){ char *part_size_str = yon_char_parsed_to_string(part_size,part_size_size,","); + yon_config_register(part_size_parameter,part_size_parameter_command,part_size_str); } if (part_label_size){ char *part_label_str = yon_char_parsed_to_string(part_label,part_label_size,","); + yon_config_register(part_label_parameter,part_label_parameter_command,part_label_str); } if (fs_type_size){ char *fs_type_str = yon_char_parsed_to_string(fs_type,fs_type_size,","); + yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,fs_type_str); } if (fs_label_size){ char *fs_label_str = yon_char_parsed_to_string(fs_label,fs_label_size,","); + yon_config_register(part_fs_label_parameter,part_fs_label_parameter_command,fs_label_str); } if (encryption_size){ char *encryption_str = yon_char_parsed_to_string(encryption,encryption_size,","); + yon_config_register(part_crypt_parameter,part_crypt_parameter_command,encryption_str); } if (format_size){ char *format_str = yon_char_parsed_to_string(format,format_size,","); + yon_config_register(part_format_parameter,part_format_parameter_command,format_str); + + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedLoadTypeSwitch))){ + char *boot = NULL; + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedBiosSectorSwitch))){ + yon_char_append_element(boot,"bios","+"); + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedEFISwitch))){ + yon_char_append_element(boot,"efi","+"); + } + if (!yon_char_is_empty(boot)){ + yon_config_register(boot_parameter,boot_parameter_command,boot); + } else { + yon_config_remove_by_key(boot_parameter); + } + } else { + yon_config_remove_by_key(boot_parameter); + } + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){ + if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){ + yon_config_register(swap_parameter,swap_parameter_command,"auto"); + + } else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapRamSwitch))){ + yon_config_register(swap_parameter,swap_parameter_command,"yes"); + yon_config_register(swap_size_parameter,swap_parameter_command,"ram"); + + } else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapFixedSwitch))){ + yon_config_register(swap_parameter,swap_parameter_command,"yes"); + long swap_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->AdvancedSwapFixedSpin)); + int size_letter = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapFixedSizeSwitch)); + char *swap_str = yon_char_from_long(swap_size); + char *size_final = yon_char_unite(swap_str,size_letter?"G":"M",NULL); + yon_config_register(swap_size_parameter,swap_parameter_command,size_final); + } else { + yon_config_remove_by_key(swap_parameter); + yon_config_remove_by_key(swap_size_parameter); + } } return 1; } + +void yon_advanced_part_parameter_changed(GtkWidget *self, advanced_partition *part){ + advanced_section *section = sections[yon_advanced_section_get(part->part)]; + if (self == part->SizeCombo||self == part->SizeSpin){ + section->size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(part->SizeSpin)); + section->size_letter = *yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(part->SizeCombo))); + } else if (self == part->PartLabelEntry){ + section->part_label = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->PartLabelEntry))); + } else if (self == part->FileSystemTypeCombo){ + section->fs_type = yon_char_new(gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo))); + } else if (self == part->FileSystemLabelEntry){ + section->fs_label = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->FileSystemLabelEntry))); + } else if (self == part->EncryptionCombo||self == part->EncryptionEntry){ + section->encryption = yon_char_new(gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->EncryptionCombo))); + section->encryption_password = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->EncryptionEntry))); + } else if (self == part->FormatSwitch){ + if (gtk_switch_get_active(GTK_SWITCH(part->FormatSwitch))){ + section->format=1; + } else { + section->format=0; + } + } +} + advanced_partition *yon_advanced_partition_new(){ advanced_partition *part = new(advanced_partition); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); @@ -523,6 +598,15 @@ advanced_partition *yon_advanced_partition_new(){ g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionButton); g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionEntry); + g_signal_connect(G_OBJECT(part->EncryptionEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->FormatSwitch),"activate",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->SizeCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->SizeSpin),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->PartLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->FileSystemTypeCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->FileSystemLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); + yon_fs_type_setup(GTK_COMBO_BOX_TEXT(part->FileSystemTypeCombo)); diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 91062f9..ce9c789 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -355,7 +355,7 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ } gtk_list_store_append(widgets->PartitionsList,&iter); - gtk_list_store_set(widgets->PartitionsList,&iter,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,-1); + gtk_list_store_set(widgets->PartitionsList,&iter,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,9,disk_path,-1); } yon_char_parsed_free(parsed,parsed_size); } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 928ca8a..8095315 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1171,4 +1171,5 @@ void on_advanced_section_toggled(GtkWidget *self, main_window *widgets); void yon_fs_type_setup(GtkComboBoxText *target); void yon_advanced_set_max_size_from_partition(advanced_partition *part, main_window *widgets); void on_advanced_size_changed(GtkWidget *self,main_window *widgets); -int yon_advanced_save(main_window *widgets); \ No newline at end of file +int yon_advanced_save(main_window *widgets); +void yon_advanced_part_parameter_changed(GtkWidget *self, advanced_partition *part); \ No newline at end of file diff --git a/ubinstall-gtk-advanced-box.glade b/ubinstall-gtk-advanced-box.glade index 648d669..9594bbc 100644 --- a/ubinstall-gtk-advanced-box.glade +++ b/ubinstall-gtk-advanced-box.glade @@ -248,7 +248,7 @@ - + True True @@ -311,7 +311,7 @@ - + True True diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 0c189a4..9a3a93a 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -202,6 +202,8 @@ + + @@ -6900,6 +6902,9 @@ separately into the selected partition. True DevicesList 0 + + + @@ -7071,6 +7076,9 @@ separately into the selected partition. True PartitionsList 0 + + + @@ -7528,6 +7536,7 @@ separately into the selected partition. True True + True False @@ -9846,6 +9855,9 @@ separately into the selected partition. True DevicesList 0 + + + Device @@ -9947,6 +9959,9 @@ separately into the selected partition. True PartitionsList 0 + + + Section