From 5a440f1885409133ea2659c26db961558f4999de Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 9 Dec 2025 18:05:54 +0600 Subject: [PATCH 1/8] Navigation changes; Fixes --- source/ubinstall-gtk-components.c | 2 +- source/ubinstall-gtk-page-switch.c | 23 +- source/ubinstall-gtk-region.c | 2 - source/ubinstall-gtk.c | 1 - source/ubinstall-gtk.h | 1 + ubinstall-gtk.glade | 997 ++++++++++++++++++++++++----- 6 files changed, 846 insertions(+), 180 deletions(-) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index ad413ef..915582c 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -49,7 +49,7 @@ int yon_kernel_addon_save(main_window *widgets){ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); char *install_modules = yon_char_new(parameter); for(GList *iter = list;iter;iter = iter->next){ - kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + kernel_addon_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ char *temp = yon_char_append_element(install_modules,row->modules," "); if (!yon_char_is_empty(install_modules)) free(install_modules); diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 22b2787..d452c93 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -9,17 +9,18 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_LICENCE: return YON_PAGE_SECTIONS; break; case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SOFTWARE; break; - case YON_PAGE_SOFTWARE: return main_config.configure_mode? YON_PAGE_KERNEL : YON_PAGE_INSTALLATION_BEGIN; break; - case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; - case YON_PAGE_KERNEL: return YON_PAGE_KERNEL_ADDON; break; - case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACMAN_SOFTWARE; break; - case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_REGION; + case YON_PAGE_SOFTWARE: return main_config.configure_mode? YON_PAGE_REGION : YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KEYBOARD; break; + case YON_PAGE_KERNEL: return YON_PAGE_PACKAGES_HUB; break; + case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACKAGES_HUB; break; + case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_PACKAGES_HUB; break; case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; case YON_PAGE_BOOTLOADER: return YON_PAGE_NETWORK; break; - case YON_PAGE_NETWORK: return main_config.configure_mode? YON_PAGE_CONFIGURE_END : YON_PAGE_INSTALLATION; break; + case YON_PAGE_NETWORK: return YON_PAGE_KERNEL; break; + case YON_PAGE_PACKAGES_HUB: return main_config.configure_mode? YON_PAGE_CONFIGURE_END : YON_PAGE_INSTALLATION; case YON_PAGE_INSTALL_COMMON: return YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALL_SEPARATE: return YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_OS_COMPONENTS; break; @@ -52,10 +53,10 @@ enum YON_PAGES yon_page_get_prev(enum YON_PAGES page){ case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SECTIONS; break; case YON_PAGE_SOFTWARE: return YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_SOFTWARE; break; - case YON_PAGE_KERNEL: return YON_PAGE_SECTIONS; break; + case YON_PAGE_KERNEL: return YON_PAGE_NETWORK; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_KERNEL; break; case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_KERNEL_ADDON; break; - case YON_PAGE_REGION: return YON_PAGE_PACMAN_SOFTWARE; break; + case YON_PAGE_REGION: return YON_PAGE_SECTIONS; break; case YON_PAGE_KEYBOARD: return YON_PAGE_REGION; break; case YON_PAGE_USERS: return YON_PAGE_KEYBOARD; break; case YON_PAGE_STARTUP: return YON_PAGE_USERS; break; @@ -264,6 +265,7 @@ void yon_switch_page_render(main_window *widgets){ case YON_PAGE_BOOTLOADER: case YON_PAGE_STARTUP: case YON_PAGE_NETWORK: + case YON_PAGE_PACKAGES_HUB: page = 6; break; case YON_PAGE_INSTALLATION: @@ -451,8 +453,13 @@ void on_system_setup_pass(GtkWidget *, main_window *widgets){ } else { if (main_config.install_complete) { gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); + yon_page_init(widgets,YON_PAGE_COMPLETION); + yon_page_update(widgets); } else { gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); + yon_page_init(widgets,YON_PAGE_INSTALLATION); + yon_page_update(widgets); + } } yon_page_update(widgets); diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 5a51c75..22a8af0 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -77,8 +77,6 @@ void yon_region_init(main_window *widgets){ GtkTreeIter iter; gtk_list_store_clear(widgets->LanguagesList); - - yon_locale_init(); config_str languages = yon_config_load(languages_command,&size); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 5c88d01..190c330 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -977,7 +977,6 @@ void yon_main_window_create(main_window *widgets){ widgets->AdditionalComponentsList = yon_gtk_builder_get_widget(builder,"AdditionalComponentsList"); - widgets->InstallationProgress = yon_gtk_builder_get_widget(builder,"InstallationProgress"); widgets->InstallationLabel = yon_gtk_builder_get_widget(builder,"InstallationLabel"); widgets->ReadShortLogButton = yon_gtk_builder_get_widget(builder,"ReadShortLogButton"); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index fb7f732..afac26a 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -356,6 +356,7 @@ enum YON_PAGES { YON_PAGE_STARTUP, YON_PAGE_BOOTLOADER, YON_PAGE_NETWORK, + YON_PAGE_PACKAGES_HUB, YON_PAGE_INSTALLATION, YON_PAGE_COMPLETION, YON_PAGE_COMPLETED, diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index bb8bea3..d847ac4 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -4491,6 +4491,110 @@ agreement 0 + + + True + False + vertical + 5 + + + True + False + 10 + 10 + 10 + 10 + 5 + + + True + False + 48 + com.ublinux.ubinstall-gtk + 0 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Choose system kernel + True + 0 + + + + + + + + + False + True + 0 + + + + + True + False + This program will ask you few questions and help you install system on your computer + center + True + 0 + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 2 + + + + + False + True + 1 + + True @@ -4512,7 +4616,7 @@ agreement True True - 1 + 2 @@ -4571,7 +4675,7 @@ agreement False True - 2 + 3 @@ -4642,12 +4746,9 @@ agreement False True - 3 + 4 - - - 12 @@ -4688,6 +4789,110 @@ agreement 0 + + + True + False + vertical + 5 + + + True + False + 10 + 10 + 10 + 10 + 5 + + + True + False + 48 + com.ublinux.ubinstall-gtk + 0 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Choose system kernel + True + 0 + + + + + + + + + False + True + 0 + + + + + True + False + This program will ask you few questions and help you install system on your computer + center + True + 0 + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 2 + + + + + False + True + 1 + + True @@ -4709,7 +4914,7 @@ agreement True True - 1 + 2 @@ -5007,12 +5212,9 @@ agreement False True - 2 + 3 - - - 13 @@ -5053,31 +5255,8 @@ agreement 0 - - - True - False - 0 - none - - - True - False - - - - - - - - True - True - 1 - - - 350 True False vertical @@ -5086,11 +5265,18 @@ agreement True False + 10 + 10 + 10 + 10 5 - + True - True + False + 48 + com.ublinux.ubinstall-gtk + 0 False @@ -5099,11 +5285,131 @@ agreement - + True False - Domain name: - + vertical + + + True + False + Choose system kernel + True + 0 + + + + + + + + + False + True + 0 + + + + + True + False + This program will ask you few questions and help you install system on your computer + center + True + 0 + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + 0 + none + + + True + False + + + + + + + + True + True + 2 + + + + + 350 + True + False + vertical + 5 + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Domain name: + False True @@ -5232,33 +5538,383 @@ agreement - + + True + False + True + + + True + True + 3 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Host name: + 0 + + + False + True + 1 + + + + + True + False + True + auto + + + True + True + 2 + + + + + Automatically + True + False + True + False + True + + + False + True + 3 + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + True + + + True + False + none + + + True + False + vertical + 5 + + + + + + + + + + True + True + 0 + + + + + + + True + True + True + + + + False + True + end + 1 + + + + + + + + + True + False + Net interfaces + + + + + True + True + 3 + + + + + False + True + 3 + + + + + 14 + + + + + True + False + Network + + + 14 + False + + + + + True + False + vertical + 5 + + + True + False + vertical + 5 + + + True + False + 10 + 10 + 10 + 10 + 5 + + + True + False + 48 + com.ublinux.ubinstall-gtk + 0 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Choose system kernel + True + 0 + + + + + + + + + False + True + 0 + + + + + True + False + This program will ask you few questions and help you install system on your computer + center + True + 0 + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + 5 + 5 + 5 + 5 + + + True + False + Selecting additional installation components + + + False + True + 0 + + + + + button True - False True + True - True + False True - 3 + end + 1 False True - 1 + 0 + + + + False + True + 1 + + + + + True + False + vertical + 5 True False + 5 + 5 + 5 + 5 5 - + True - True + False + Selecting additional components for the system kernel False @@ -5267,160 +5923,165 @@ agreement - + + button True - False - Host name: - 0 + True + True False True + end 1 + + + False + True + 0 + + + + + + False + True + 2 + + + + + True + False + vertical + 5 + + + True + False + 5 + 5 + 5 + 5 + 5 - + True - False - True - auto + False + Selecting the system kernel - True + False True - 2 + 0 - - Automatically + + button True - False True - False - True + True False True - 3 + end + 1 False True - 2 + 0 + + + + False + True + 3 + + + + + True + False + vertical + 5 - + True False - 0.019999999552965164 - in + 5 + 5 + 5 + 5 + 5 - + True False - 5 - 5 - 5 - 5 - - - True - False - vertical - 5 - - - True - True - - - True - False - none - - - True - False - vertical - 5 - - - - - - - - - - True - True - 0 - - - - - + - True - True - True - - - - False - True - end - 1 - - - - + Selecting additional components from packages + + False + True + 0 + - - + + + button True - False - Net interfaces + True + True + + False + True + end + 1 + - True + False True - 3 + 0 + False True - 2 + 4 - - - - 14 + 15 True False - Network + Packages - 14 + 15 False @@ -5564,7 +6225,7 @@ agreement - 15 + 16 @@ -5574,7 +6235,7 @@ agreement Installation process - 15 + 16 False @@ -5755,7 +6416,7 @@ or continue working in the environment, booted from the Live image. - 16 + 17 @@ -5765,7 +6426,7 @@ or continue working in the environment, booted from the Live image. Completion - 16 + 17 False @@ -5944,7 +6605,7 @@ or continue working in the environment, booted from the Live image. - 17 + 18 @@ -5954,7 +6615,7 @@ or continue working in the environment, booted from the Live image. Completed - 17 + 18 False @@ -6133,7 +6794,7 @@ or continue working in the environment, booted from the Live image. - 18 + 19 @@ -6143,7 +6804,7 @@ or continue working in the environment, booted from the Live image. Configuration error - 18 + 19 False @@ -6322,7 +6983,7 @@ or continue working in the environment, booted from the Live image. - 19 + 20 @@ -6332,7 +6993,7 @@ or continue working in the environment, booted from the Live image. Configuration end - 19 + 20 False @@ -6511,7 +7172,7 @@ or continue working in the environment, booted from the Live image. - 20 + 21 @@ -6521,7 +7182,7 @@ or continue working in the environment, booted from the Live image. Configuration saved - 20 + 21 False @@ -6975,7 +7636,7 @@ or continue working in the environment, booted from the Live image. - 21 + 22 @@ -6985,7 +7646,7 @@ or continue working in the environment, booted from the Live image. Common Installation - 21 + 22 False @@ -7649,7 +8310,7 @@ or continue working in the environment, booted from the Live image. - 22 + 23 @@ -7659,7 +8320,7 @@ or continue working in the environment, booted from the Live image. Installation next to system - 22 + 23 False @@ -8278,7 +8939,7 @@ or continue working in the environment, booted from the Live image. - 23 + 24 @@ -8288,7 +8949,7 @@ or continue working in the environment, booted from the Live image. Installation on same partition - 23 + 24 False @@ -9334,7 +9995,7 @@ separately into the selected partition. - 24 + 25 @@ -9344,7 +10005,7 @@ separately into the selected partition. Advanced section - 24 + 25 False @@ -9819,7 +10480,7 @@ separately into the selected partition. - 25 + 26 @@ -9829,7 +10490,7 @@ separately into the selected partition. Recovery section - 25 + 26 False @@ -10221,7 +10882,7 @@ separately into the selected partition. - 26 + 27 @@ -10231,7 +10892,7 @@ separately into the selected partition. GRUB install - 26 + 27 False @@ -10610,7 +11271,7 @@ separately into the selected partition. - 27 + 28 @@ -10620,7 +11281,7 @@ separately into the selected partition. GRUB update - 27 + 28 False @@ -11346,7 +12007,7 @@ separately into the selected partition. - 28 + 29 @@ -11356,7 +12017,7 @@ separately into the selected partition. OS only - 28 + 29 False @@ -12152,7 +12813,7 @@ separately into the selected partition. - 29 + 30 @@ -12162,7 +12823,7 @@ separately into the selected partition. User data only - 29 + 30 False -- 2.35.1 From 0ddf95e9e3266eaa7908bae253abc51a9dac2161 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 10 Dec 2025 11:11:04 +0600 Subject: [PATCH 2/8] cancel installation fix --- source/ubinstall-gtk-page-switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index d452c93..e15313d 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -420,7 +420,6 @@ void on_page_prev_clicked(GtkWidget *, main_window *widgets){ } void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); gtk_widget_hide(widgets->BackButton); gtk_widget_hide(widgets->SourceButton); gtk_widget_hide(widgets->SkipInstallationButton); @@ -438,6 +437,7 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ data->title=WARNING_TITLE_LABEL; if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ if (main_config.install_thread){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); pthread_cancel((pthread_t)main_config.install_thread); -- 2.35.1 From f040b721b655f9820ef9169c1724cf345ac5e5d7 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 10 Dec 2025 11:50:56 +0600 Subject: [PATCH 3/8] Fixed VNC commands --- source/ubinstall-gtk.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index afac26a..0e5bb8b 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -134,8 +134,8 @@ layout && /description:/ {\ #define get_keyboard_layout_change_command "grep \"grp:\" /usr/share/X11/xkb/rules/base.lst | awk '{$1=$1; sub(/^!.*$/, \"\"); if ($1 ~ /^grp:/) {opt=$1; $1=\"\"; print opt \"|\" substr($0,2)}}'" -#define enable_vnc_command "ubconfig --target system set [desktop] X11VNC=ublinux" -#define disable_vnc_command "ubconfig --target system remove [desktop] X11VNC=ublinux" +#define enable_vnc_command "ubconfig --target system set [desktop] X11VNC[password]=ublinux" +#define disable_vnc_command "ubconfig --target system remove [desktop] X11VNC[password]" #define get_layouts_local_command(layout) yon_char_unite("xkbcli list --load-exotic | awk -v layout=\"",layout,"\" \"BEGIN {layout_pattern = sprintf(\\\"^ *- *layout: *'%s'\\\",layout);matched=0} matched && /variant:/ {match(\\$0, /: *'([^']+)'/, matches);variant = matches[1]} matched && /description:/ {match(\\$0, /: *(.+)/, matches);description = matches[1]} matched && /^ *-/{matched=0; if (variant) printf \\\"%s|%s\\n\\\",variant,description} \\$0 ~ layout_pattern {matched=1;variant=\\\"\\\";description=\\\"\\\";next}\" | sort -u",NULL) #define get_devices_command "lsblk --noheadings --nodeps -Jo PATH,SIZE,MODEL,VENDOR,SERIAL --exclude 7" -- 2.35.1 From 86f3f6e8847e0f60d7b9ab2e66d521e3eb329bc6 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 10 Dec 2025 16:08:52 +0600 Subject: [PATCH 4/8] Wiki link fix --- source/ubinstall-gtk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 0e5bb8b..13109c8 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -17,7 +17,7 @@ #endif #include "ubl-strings.h" -#define WIKI_LINK "https://wiki.ublinux.com/Software/Programs_and_utilities/All/ubinstall-gtk" +#define WIKI_LINK "https://wiki.ublinux.com/software/programs_and_utilities/all/ubinstall-gtk" #define _(String) gettext(String) -- 2.35.1 From 62684554e9ca32a0fc2947dfc098bb5ad47d3623 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 10 Dec 2025 18:06:47 +0600 Subject: [PATCH 5/8] Localisation; Cancel button fix --- locale/ubinstall-gtk.pot | 6 ++++++ locale/ubinstall-gtk_ru.po | 8 ++++++++ source/ubinstall-gtk-page-switch.c | 7 +++++++ source/ubinstall-gtk.c | 9 +++++++++ source/ubinstall-gtk.h | 6 +++++- source/ubl-strings.h | 2 ++ ubinstall-gtk-source.glade | 2 +- 7 files changed, 38 insertions(+), 2 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 68c41b1..73f1292 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -1201,4 +1201,10 @@ msgstr "" msgid "Module:" msgstr "" +#: source/ubl-strings.h:331 +msgid "Yes, I agree to the License Agreement" +msgstr "" +#: source/ubl-strings.h:331 +msgid "No, i do not agree" +msgstr "" diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 20d9b39..38b3438 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -3040,3 +3040,11 @@ msgstr "Пакет:" #: source/ubl-strings.h:331 msgid "Module:" msgstr "Модуль:" + +#: source/ubl-strings.h:331 +msgid "Yes, I agree to the License Agreement" +msgstr "Да, я согласен с лицензионным соглашением" + +#: source/ubl-strings.h:331 +msgid "No, i do not agree" +msgstr "Нет, я не согласен" diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index e15313d..e71202a 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -107,7 +107,11 @@ void yon_navigation_buttons_set_sensetiveness(main_window *widgets){ case YON_PAGE_LICENCE: gtk_widget_show(widgets->BackButton); gtk_widget_set_sensitive(widgets->BackButton,1); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LicenseAgreeRadio))) gtk_widget_set_sensitive(widgets->NextButton,1); + else + gtk_widget_set_sensitive(widgets->NextButton,0); + gtk_widget_set_sensitive(widgets->CancelInstallButton,1); break; case YON_PAGE_INSTALLATION: @@ -443,6 +447,9 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ pthread_cancel((pthread_t)main_config.install_thread); } } + } else { + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_LICENCE); + on_page_prev_clicked(NULL,widgets); } } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 190c330..dc003c3 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1,6 +1,11 @@ #include "ubinstall-gtk.h" config main_config; + +void yon_license_init(main_window *widgets){ + gtk_widget_set_sensitive(widgets->NextButton,0); +} + void yon_open_browser(GtkWidget *, char *link){ GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); if (window) @@ -803,6 +808,8 @@ void yon_main_window_create(main_window *widgets){ widgets->StatusBox2 = yon_gtk_builder_get_widget(builder,"StatusBox2"); widgets->Notebook = yon_gtk_builder_get_widget(builder,"Notebook"); widgets->MainSpinner=yon_gtk_builder_get_widget(builder,"MainSpinner"); + widgets->LicenseAgreeRadio = yon_gtk_builder_get_widget(builder,"LicenseAgreeRadio"); + widgets->LicenseDisgreeRadio = yon_gtk_builder_get_widget(builder,"LicenseDisgreeRadio"); widgets->EnableVNCMenuItem = yon_gtk_builder_get_widget(builder,"EnableVNCMenuItem"); widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL); @@ -1063,6 +1070,8 @@ void yon_main_window_create(main_window *widgets){ gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->DocumentationMenuItem); gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->AboutMenuItem); + g_signal_connect(G_OBJECT(widgets->LicenseAgreeRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->NextButton); + g_signal_connect(G_OBJECT(widgets->LoadGlobalConfigurationMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets); g_signal_connect(G_OBJECT(widgets->LoadLocalConfigurationMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets); g_signal_connect(G_OBJECT(widgets->LoadExternalConfigurationMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 13109c8..3be8be8 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -437,6 +437,9 @@ typedef struct { GtkWidget *MainWindow; + GtkWidget *LicenseAgreeRadio; + GtkWidget *LicenseDisgreeRadio; + GtkWidget *StartScenarioButton; GtkWidget *SourceButton; GtkWidget *SkipInstallationButton; @@ -1232,4 +1235,5 @@ void *yon_maximize(main_window *widgets); kernel_addon_row *yon_kernel_addon_row_new(); void yon_kernel_addon_row_setup(kernel_addon_row *row, char *name, char *modules,char *package, char *description); void on_kernel_addon_install_enabled(GtkWidget *, kernel_addon_row *row); -void on_kernel_addon_info(GtkLabel *self); \ No newline at end of file +void on_kernel_addon_info(GtkLabel *self); +void yon_license_init(main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 5a3b300..8085f29 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -232,6 +232,8 @@ NULL) #define ROOT_FORCE_CONFIGURATION_MODE_LABEL _("Warning! Application was launched without root. Only configuration mode is allowed.") #define PACKAGE_NOT_FOUND_LABEL _("Package were not found") #define PACKAGE_INFO_LABEL _("Package information") +#define LICENCE_AGREE_LABEL _("Yes, I agree to the License Agreement") +#define LICENCE_DISAGREE_LABEL _("No, i do not agree") // #define _LABEL _("Package:") // #define _LABEL _("Module:") // #define _LABEL _("New section at") diff --git a/ubinstall-gtk-source.glade b/ubinstall-gtk-source.glade index 1a3e61e..ac022cc 100644 --- a/ubinstall-gtk-source.glade +++ b/ubinstall-gtk-source.glade @@ -301,7 +301,7 @@ True False 2 - UBLinux installation + Source -- 2.35.1 From 2775a9e37ff0d50e3a089338e8aaad46510999cd Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 11 Dec 2025 17:47:34 +0000 Subject: [PATCH 6/8] Added language slide; Fixed kernel crash --- gresource.xml | 1 + source/CMakeLists.txt | 2 + source/ubinstall-gtk-components.c | 39 ++-- source/ubinstall-gtk-language.c | 243 +++++++++++++++++++++ source/ubinstall-gtk-page-switch.c | 12 +- source/ubinstall-gtk.c | 13 ++ source/ubinstall-gtk.h | 46 +++- source/ubl-strings.h | 1 + ubinstall-gtk-layouts.glade | 238 +++++++++++++++++++++ ubinstall-gtk.desktop | 0 ubinstall-gtk.glade | 330 ++++++++++++++++++++++++----- 11 files changed, 847 insertions(+), 78 deletions(-) create mode 100644 source/ubinstall-gtk-language.c create mode 100644 ubinstall-gtk-layouts.glade mode change 100644 => 100755 ubinstall-gtk.desktop diff --git a/gresource.xml b/gresource.xml index fc38ddb..ead2b57 100644 --- a/gresource.xml +++ b/gresource.xml @@ -19,6 +19,7 @@ ubinstall-gtk-configuration-mode.glade ubinstall-gtk-source.glade ubinstall-gtk-source-element.glade + ubinstall-gtk-layouts.glade ubinstall-gtk.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index acc10a7..797d534 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -72,6 +72,7 @@ set(DEPENDFILES ../ubinstall-gtk-configuration-mode.glade ../ubinstall-gtk-source.glade ../ubinstall-gtk-source-element.glade + ../ubinstall-gtk-layouts.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv @@ -147,6 +148,7 @@ set(SOURCE_FILES ubinstall-gtk-install-start.c ubinstall-gtk-startup-services.c ubinstall-gtk-kernel.c + ubinstall-gtk-language.c ubinstall-gtk.h ubl-strings.h ) diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 915582c..1af6ded 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -195,24 +195,27 @@ 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){ - 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){ - os_row *row = g_object_get_data(iter->data,"kernel_row"); - int cur_size = 0; - gtk_widget_realize(row->RowBox); - gtk_widget_get_preferred_width(row->RowBox,&cur_size,NULL); - if (sizenext){ - os_row *row = g_object_get_data(iter->data,"kernel_row"); - gtk_widget_set_size_request(row->RowBox,size,-1); - } + for (iter=list;iter;iter=iter->next){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + free(row); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + 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){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + int cur_size = 0; + gtk_widget_realize(row->RowBox); + gtk_widget_get_preferred_width(row->RowBox,&cur_size,NULL); + if (sizenext){ + os_row *row = g_object_get_data(iter->data,"kernel_row"); + gtk_widget_set_size_request(row->RowBox,size,-1); } char *modules = config(modules_parameter); diff --git a/source/ubinstall-gtk-language.c b/source/ubinstall-gtk-language.c new file mode 100644 index 0000000..ff6041b --- /dev/null +++ b/source/ubinstall-gtk-language.c @@ -0,0 +1,243 @@ +#include "ubinstall-gtk.h" + +void yon_language_update(main_window *widgets){ + gtk_list_store_clear(widgets->LanguageList); + { + char *config_locale = config(locale_parameter); + char *config_languages = config(lang_parameter); + if (yon_char_is_empty(config_locale)||yon_config_check_ignore(locale_parameter)){ + gtk_switch_set_active(GTK_SWITCH(widgets->LocaleDefaultSwitch),1); + } else { + gtk_switch_set_active(GTK_SWITCH(widgets->LocaleDefaultSwitch),0); + int parsed_param_size; + config_str parsed_param = yon_char_parse(config_locale,&parsed_param_size,","); + GtkTreeIter iter; + for (int i=0;iLanguageList,&iter); + gtk_list_store_set(widgets->LanguageList,&iter,1,parsed[1],2,parsed[2],3,parsed[0],-1); + if (!yon_char_is_empty(config_languages)){ + if (!strcmp(config_languages,parsed[0])){ + gtk_list_store_set(widgets->LanguageList,&iter,0,1,-1); + } + } else if (yon_char_is_empty(config_languages)&&!i){ + gtk_list_store_set(widgets->LanguageList,&iter,0,1,-1); + } + yon_char_parsed_free(parsed,parsed_size); + } + } + } + } + +} + + +void on_locale_toggle(GtkCellRenderer *, gchar *path,language_window *window){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(window->LanguagesList); + gtk_tree_model_get_iter_from_string(model,&iter,path); + gboolean is_active; + char *target; + gtk_tree_model_get(model,&iter,0,&is_active,1,&target,-1); + gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,!is_active,-1); + + char *locales = (char*)gtk_entry_get_text(GTK_ENTRY(window->ManualEntry)); + if (!is_active){ + if (!yon_char_check_element(locales,target,",")){ + char *temp = yon_char_append_element(locales,target,","); + gtk_entry_set_text(GTK_ENTRY(window->ManualEntry),temp); + free(temp); + } + } else { + char *temp = yon_char_remove_element(locales,target,","); + gtk_entry_set_text(GTK_ENTRY(window->ManualEntry),temp); + if (!yon_char_is_empty(temp)) free(temp); + } +} + +void on_locale_accept(GtkWidget *self, language_window *window){ + main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); + + char *final = (char*)gtk_entry_get_text(GTK_ENTRY(window->ManualEntry)); + if (yon_char_is_empty(final)) { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),yon_char_get_localised_from_lib(NOTHING_CHOSEN_LABEL),5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + char *locale_str = config(locale_parameter); + GtkTreeIter iter,itar; + for_iter (GTK_TREE_MODEL(window->LanguagesList),&iter){ + char *locale,*lang,*territory; + int status; + gtk_tree_model_get(GTK_TREE_MODEL(window->LanguagesList),&iter,0,&status,1,&locale,2,&lang,3,&territory,-1); + if (status){ + gtk_list_store_append(widgets->LanguageList,&itar); + gtk_list_store_set(widgets->LanguageList,&itar,1,lang,2,territory,3,locale,-1); + if (!yon_char_is_empty(locale_str)&&!strcmp(locale_str,locale)){ + gtk_list_store_set(widgets->LanguageList,&itar,0,1,-1); + } + } + } + if (yon_char_is_empty(locale_str)){ + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LanguageList),&iter)){ + gtk_list_store_set(widgets->LanguageList,&iter,0,1,-1); + } + } + on_subwindow_close(self); +} + +gboolean yon_locale_window_set_locales(struct locales_struct *data){ + GtkTreeIter iter; + gtk_list_store_append(GTK_LIST_STORE(data->list),&iter); + gtk_list_store_set(GTK_LIST_STORE(data->list),&iter,1,data->locale,2,data->lang,3,data->territory,0,data->chosen,-1); + if(!yon_char_is_empty(data->lang)) free(data->lang); + if(!yon_char_is_empty(data->locale)) free(data->locale); + if(!yon_char_is_empty(data->territory)) free(data->territory); + if(!yon_char_is_empty(data->lang)) free(data); + return G_SOURCE_REMOVE; +} + +gboolean yon_locale_window_unlock(GtkWidget *spinner){ + gtk_widget_hide(spinner); + return G_SOURCE_REMOVE; +} + +void *yon_locales_load_func(language_window *window){ + char *config_value = config(locale_parameter); + int config_parsed_size; + config_str config_parsed = NULL; + if (config_value){ + gtk_entry_set_text(GTK_ENTRY(window->ManualEntry),config_value); + config_parsed = yon_char_parse(config_value,&config_parsed_size,","); + } + + int size; + config_str languages = yon_config_load(languages_command,&size); + for (int i=0;ilist=window->LanguagesList; + yon_char_remove_last_symbol(languages[i],'\n'); + int parsed_size; + config_str parsed = yon_char_parse(languages[i],&parsed_size,"|"); + data_struct->locale = yon_char_new(parsed[0]); + data_struct->lang = yon_char_new(parsed[1]); + data_struct->territory = yon_char_new(parsed[2]); + + if (config_parsed_size&&yon_char_parsed_check_exist(config_parsed,config_parsed_size,parsed[0])>-1){ + data_struct->chosen=1; + } else { + data_struct->chosen=0; + } + g_idle_add((GSourceFunc)yon_locale_window_set_locales,data_struct); + yon_char_parsed_free(parsed,parsed_size); + } + g_idle_add((GSourceFunc)yon_locale_window_unlock,window->LoadingSpinner); + yon_char_parsed_free(config_parsed,config_parsed_size); + g_thread_exit(NULL); +} + +language_window *yon_language_window_new(){ + language_window *window = malloc(sizeof(language_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_locales_path); + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->LanguagesTree = yon_gtk_builder_get_widget(builder,"LanguagesTree"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->ManualEntry = yon_gtk_builder_get_widget(builder,"ManualEntry"); + window->LoadingOverlay = yon_gtk_builder_get_widget(builder,"LoadingOverlay"); + window->LoadingSpinner = yon_gtk_builder_get_widget(builder,"LoadingSpinner"); + window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell")); + window->LanguagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LanguagesList")); + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_locale_accept),window); + g_signal_connect(G_OBJECT(window->ToggleCell),"toggled",G_CALLBACK(on_locale_toggle),window); + yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(window->LanguagesTree)); + + gtk_overlay_add_overlay(GTK_OVERLAY(window->LoadingOverlay),window->LoadingSpinner); + g_thread_new("locales-thread",(GThreadFunc)yon_locales_load_func,window); + return window; +} + +void on_language_open(GtkWidget *, main_window *widgets){ + language_window *window = yon_language_window_new(); + + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),ADD_LANGUAGE_TITLE_LABEL,icon_path,"LocalesWindow"); + + gtk_widget_show(window->Window); + +} + +void on_language_remove(GtkWidget *, main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LocaleTree)),&model,&iter)){ + gtk_list_store_remove(widgets->LanguageList,&iter); + } +} + + +void on_language_default_toggled(GtkWidget *, int status, main_window *widgets){ + gtk_widget_set_sensitive(widgets->LocaleTree,!status); + gtk_widget_set_sensitive(widgets->LocaleAddButton,!status); + GtkTreeModel *model; + GtkTreeIter iter; + if (!status&>k_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LocaleTree)),&model,&iter)){ + gtk_widget_set_sensitive(widgets->LocaleRemoveButton,1); + } else { + gtk_widget_set_sensitive(widgets->LocaleRemoveButton,0); + } +} + +void on_locale_toggled(GtkCellRenderer *, gchar *path, main_window *widgets){ + GtkTreeIter fiter; + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguageList); + gtk_tree_model_get_iter_from_string(model,&fiter,path); + for_iter(model,&iter){ + gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,0,-1); + + } + char *target; + gtk_tree_model_get(model,&fiter,3,&target,-1); + gtk_list_store_set(GTK_LIST_STORE(model),&fiter,0,1,-1); + // yon_config_register(lang_parameter,lang_parameter_command,target); +} + +int yon_language_save(main_window *widgets){ + int status = gtk_switch_get_active(GTK_SWITCH(widgets->LocaleDefaultSwitch)); + if (!status){ + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguageList); + GtkTreeIter iter; + char *locales = NULL; + for_iter(model,&iter){ + int status; + char *target; + + gtk_tree_model_get(model,&iter,0,&status,3,&target,-1); + char *temp = yon_char_append_element(locales?locales:"",target,","); + if (!yon_char_is_empty(locales)) free(locales); + locales = temp; + if (status){ + yon_config_register(lang_parameter,lang_parameter_command,target); + } + } + if (!yon_char_is_empty(locales)){ + yon_config_register(locale_parameter,locale_parameter_command,locales); + } + } else { + yon_config_remove_by_key(lang_parameter); + yon_config_remove_by_key(locale_parameter); + } + + return 1; +} + +void yon_language_init(main_window *widgets){ + yon_language_update(widgets); +} \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index e71202a..3be4fcd 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -10,11 +10,12 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; case YON_PAGE_OS_COMPONENTS: return YON_PAGE_SOFTWARE; break; case YON_PAGE_SOFTWARE: return main_config.configure_mode? YON_PAGE_REGION : YON_PAGE_INSTALLATION_BEGIN; break; - case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KEYBOARD; break; + case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_REGION; break; case YON_PAGE_KERNEL: return YON_PAGE_PACKAGES_HUB; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACKAGES_HUB; break; case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_PACKAGES_HUB; break; - case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; + case YON_PAGE_REGION: return YON_PAGE_LANGUAGE; break; + case YON_PAGE_LANGUAGE: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; case YON_PAGE_STARTUP: return YON_PAGE_BOOTLOADER; break; @@ -181,6 +182,9 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_REGION: return yon_region_save(widgets); break; + case YON_PAGE_LANGUAGE: + return yon_language_save(widgets); + break; case YON_PAGE_KEYBOARD: return yon_keyboard_save(widgets); break; @@ -260,6 +264,7 @@ void yon_switch_page_render(main_window *widgets){ case YON_PAGE_REGION: page = 3; break; + case YON_PAGE_LANGUAGE: case YON_PAGE_KEYBOARD: page = 4; break; @@ -361,6 +366,9 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_REGION: yon_region_init(widgets); break; + case YON_PAGE_LANGUAGE: + yon_language_init(widgets); + break; case YON_PAGE_KEYBOARD: yon_keyboard_init(widgets); break; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index dc003c3..a268a84 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -973,6 +973,13 @@ void yon_main_window_create(main_window *widgets){ widgets->UserAddBox=yon_gtk_builder_get_widget(builder,"UserAddBox"); widgets->UserAddButton=yon_gtk_builder_get_widget(builder,"UserAddButton"); + widgets->LocaleTree = yon_gtk_builder_get_widget(builder,"LocaleTree"); + widgets->LocaleAddButton = yon_gtk_builder_get_widget(builder,"LocaleAddButton"); + widgets->LocaleRemoveButton = yon_gtk_builder_get_widget(builder,"LocaleRemoveButton"); + widgets->LocaleDefaultSwitch = yon_gtk_builder_get_widget(builder,"LocaleDefaultSwitch"); + widgets->LocaleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"LocaleCell")); + widgets->LanguageList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LanguageList")); + widgets->HotnameEntry=yon_gtk_builder_get_widget(builder,"HotnameEntry"); widgets->mainSettingsButton=yon_gtk_builder_get_widget(builder,"mainSettingsButton"); widgets->RegionImage = yon_gtk_builder_get_widget(builder,"RegionImage"); @@ -1088,6 +1095,12 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->MainWindow),"check-resize",G_CALLBACK(on_region_resized),widgets); g_signal_connect(G_OBJECT(widgets->NextButton),"clicked",G_CALLBACK(on_page_next_clicked),widgets); g_signal_connect(G_OBJECT(widgets->BackButton),"clicked",G_CALLBACK(on_page_prev_clicked),widgets); + + g_signal_connect(G_OBJECT(widgets->LocaleAddButton),"clicked",G_CALLBACK(on_language_open),widgets); + g_signal_connect(G_OBJECT(widgets->LocaleRemoveButton),"clicked",G_CALLBACK(on_language_remove),widgets); + g_signal_connect(G_OBJECT(widgets->LocaleDefaultSwitch),"state-set",G_CALLBACK(on_language_default_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->LocaleCell),"toggled",G_CALLBACK(on_locale_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_cancel_clicked),widgets); g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 3be8be8..be3bc1e 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -38,6 +38,7 @@ #define glade_path_configuration_mode "/com/ublinux/ui/ubinstall-gtk-configuration-mode.glade" #define glade_path_source "/com/ublinux/ui/ubinstall-gtk-source.glade" #define glade_path_source_element "/com/ublinux/ui/ubinstall-gtk-source-element.glade" +#define glade_locales_path "/com/ublinux/ui/ubinstall-gtk-layouts.glade" #define CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -351,6 +352,7 @@ enum YON_PAGES { YON_PAGE_SOFTWARE, YON_PAGE_PACMAN_SOFTWARE, YON_PAGE_REGION, + YON_PAGE_LANGUAGE, YON_PAGE_KEYBOARD, YON_PAGE_USERS, YON_PAGE_STARTUP, @@ -498,6 +500,13 @@ typedef struct { GtkWidget *menu1; GtkWidget *menu2; + GtkWidget *LocaleDefaultSwitch; + GtkWidget *LocaleTree; + GtkWidget *LocaleAddButton; + GtkWidget *LocaleRemoveButton; + GtkCellRenderer *LocaleCell; + GtkListStore *LanguageList; + GtkWidget *RegionImage; GtkWidget *RegionBox; GtkWidget *RegionAspect; @@ -998,6 +1007,28 @@ struct row_data { char *description; }; +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *LanguagesTree; + + GtkWidget *CancelButton; + GtkWidget *AcceptButton; + GtkWidget *ManualEntry; + GtkWidget *LoadingOverlay; + GtkWidget *LoadingSpinner; + GtkCellRenderer *ToggleCell; + + GtkListStore *LanguagesList; +} language_window; + +struct locales_struct { + char *locale; + char *lang; + char *territory; + int chosen; + GtkListStore *list; +}; void config_init(); main_window *yon_main_window_complete(); @@ -1236,4 +1267,17 @@ kernel_addon_row *yon_kernel_addon_row_new(); void yon_kernel_addon_row_setup(kernel_addon_row *row, char *name, char *modules,char *package, char *description); void on_kernel_addon_install_enabled(GtkWidget *, kernel_addon_row *row); void on_kernel_addon_info(GtkLabel *self); -void yon_license_init(main_window *widgets); \ No newline at end of file +void yon_license_init(main_window *widgets); +void on_locale_toggle(GtkCellRenderer *, gchar *path,language_window *window); +void on_locale_accept(GtkWidget *self, language_window *window); +gboolean yon_locale_window_set_locales(struct locales_struct *data); +gboolean yon_locale_window_unlock(GtkWidget *spinner); +void *yon_locales_load_func(language_window *window); +language_window *yon_language_window_new(); +void on_language_open(GtkWidget *, main_window *widgets); +void on_language_remove(GtkWidget *, main_window *widgets); +void on_language_default_toggled(GtkWidget *, int status, main_window *widgets); +void on_locale_toggled(GtkCellRenderer *, gchar *path, main_window *widgets); +void yon_language_update(main_window *widgets); +int yon_language_save(main_window *widgets); +void yon_language_init(main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 8085f29..a9931c5 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -234,6 +234,7 @@ NULL) #define PACKAGE_INFO_LABEL _("Package information") #define LICENCE_AGREE_LABEL _("Yes, I agree to the License Agreement") #define LICENCE_DISAGREE_LABEL _("No, i do not agree") +#define ADD_LANGUAGE_TITLE_LABEL _("Add locales") // #define _LABEL _("Package:") // #define _LABEL _("Module:") // #define _LABEL _("New section at") diff --git a/ubinstall-gtk-layouts.glade b/ubinstall-gtk-layouts.glade new file mode 100644 index 0000000..b359c15 --- /dev/null +++ b/ubinstall-gtk-layouts.glade @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + True + False + True + + + True + False + com.ublinux.libublsettingsui-gtk3.cancel-uncolored-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.accept-symbolic + + + 500 + 550 + False + True + com.ublinux.ubl-settings-system + + + True + False + 5 + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + + + True + True + 5 + 5 + never + in + + + True + True + LanguagesList + 1 + both + True + + + + + + + + + 0 + + + + + + + Locale + + + word + 150 + + + 1 + + + + + + + autosize + 35 + Language + True + + + word + 100 + + + 2 + + + + + + + autosize + Territory + True + + + word + 125 + + + 3 + + + + + + + + + -1 + + + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + + + True + False + Manual input: + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + False + True + 2 + + + + + + + True + False + + + True + False + System configuration + + + + + + + + Cancel + True + True + True + image8 + + + + + + Apply + True + True + True + image9 + + + + end + 1 + + + + + + diff --git a/ubinstall-gtk.desktop b/ubinstall-gtk.desktop old mode 100644 new mode 100755 diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index d847ac4..835983a 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -94,6 +94,18 @@ + + + + + + + + + + + + @@ -126,6 +138,7 @@ LayoutList + True False @@ -321,11 +334,21 @@ False com.ublinux.libublsettingsui-gtk3.flag-finish-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.increase-symbolic + True False com.ublinux.libublsettingsui-gtk3.properties-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + True False @@ -1048,7 +1071,7 @@ agreement True False - This program will ask you few questions and help you install system on your computer + Please read the license agreement before continuing the installation. center True 0 @@ -1238,7 +1261,7 @@ agreement True False - This program will ask you few questions and help you install system on your computer + Please specify what type of installation you want to perform center True 0 @@ -1768,7 +1791,7 @@ agreement True False - Installation completion + Selection of main components True 0 @@ -1788,7 +1811,7 @@ agreement True False - This program will ask you few questions and help you install system on your computer + Specify what type of installation you want to perform center True 0 @@ -1909,12 +1932,8 @@ agreement - - - True - False - Selecting additional software to install from the repository via the Internet - + + @@ -3273,7 +3292,7 @@ agreement True False - Choose system kernel + Location True 0 @@ -3293,7 +3312,7 @@ agreement True False - This program will ask you few questions and help you install system on your computer + Enter your time zone center True 0 @@ -3609,6 +3628,204 @@ agreement False + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Available locales in the system: + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + Default + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + in + 125 + + + True + True + LanguageList + 0 + + + System locale + + + True + + + 0 + + + + + + + 100 + Locale + + + + 3 + + + + + + + Language + True + + + + 1 + + + + + + + Territory + True + + + + 2 + + + + + + + + + True + True + 0 + + + + + True + False + vertical + 5 + + + True + True + True + Add locale + image29 + + + + False + True + 0 + + + + + True + True + True + Remove language + image30 + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + True + 1 + + + + + 10 + + + + + True + False + Language + + + 10 + False + + True @@ -3653,7 +3870,7 @@ agreement True False - Choose system kernel + Keyboard True 0 @@ -3673,7 +3890,7 @@ agreement True False - This program will ask you few questions and help you install system on your computer + Specify your preferred keyboard settings center True 0 @@ -3723,7 +3940,6 @@ agreement True False - Keyboard @@ -3993,7 +4209,7 @@ agreement - 10 + 11 @@ -4003,7 +4219,7 @@ agreement Keyboard - 10 + 11 False @@ -4453,7 +4669,7 @@ agreement - 11 + 12 @@ -4463,7 +4679,7 @@ agreement Users - 11 + 12 False @@ -4751,7 +4967,7 @@ agreement - 12 + 13 @@ -4761,7 +4977,7 @@ agreement Startup configuration - 12 + 13 False @@ -5217,7 +5433,7 @@ agreement - 13 + 14 @@ -5227,7 +5443,7 @@ agreement Bootloader - 13 + 14 False @@ -5713,7 +5929,7 @@ agreement - 14 + 15 @@ -5723,7 +5939,7 @@ agreement Network - 14 + 15 False @@ -6071,7 +6287,7 @@ agreement - 15 + 16 @@ -6081,7 +6297,7 @@ agreement Packages - 15 + 16 False @@ -6225,7 +6441,7 @@ agreement - 16 + 17 @@ -6235,7 +6451,7 @@ agreement Installation process - 16 + 17 False @@ -6416,7 +6632,7 @@ or continue working in the environment, booted from the Live image. - 17 + 18 @@ -6426,7 +6642,7 @@ or continue working in the environment, booted from the Live image. Completion - 17 + 18 False @@ -6605,7 +6821,7 @@ or continue working in the environment, booted from the Live image. - 18 + 19 @@ -6615,7 +6831,7 @@ or continue working in the environment, booted from the Live image. Completed - 18 + 19 False @@ -6794,7 +7010,7 @@ or continue working in the environment, booted from the Live image. - 19 + 20 @@ -6804,7 +7020,7 @@ or continue working in the environment, booted from the Live image. Configuration error - 19 + 20 False @@ -6983,7 +7199,7 @@ or continue working in the environment, booted from the Live image. - 20 + 21 @@ -6993,7 +7209,7 @@ or continue working in the environment, booted from the Live image. Configuration end - 20 + 21 False @@ -7172,7 +7388,7 @@ or continue working in the environment, booted from the Live image. - 21 + 22 @@ -7182,7 +7398,7 @@ or continue working in the environment, booted from the Live image. Configuration saved - 21 + 22 False @@ -7636,7 +7852,7 @@ or continue working in the environment, booted from the Live image. - 22 + 23 @@ -7646,7 +7862,7 @@ or continue working in the environment, booted from the Live image. Common Installation - 22 + 23 False @@ -8310,7 +8526,7 @@ or continue working in the environment, booted from the Live image. - 23 + 24 @@ -8320,7 +8536,7 @@ or continue working in the environment, booted from the Live image. Installation next to system - 23 + 24 False @@ -8939,7 +9155,7 @@ or continue working in the environment, booted from the Live image. - 24 + 25 @@ -8949,7 +9165,7 @@ or continue working in the environment, booted from the Live image. Installation on same partition - 24 + 25 False @@ -9995,7 +10211,7 @@ separately into the selected partition. - 25 + 26 @@ -10005,7 +10221,7 @@ separately into the selected partition. Advanced section - 25 + 26 False @@ -10480,7 +10696,7 @@ separately into the selected partition. - 26 + 27 @@ -10490,7 +10706,7 @@ separately into the selected partition. Recovery section - 26 + 27 False @@ -10882,7 +11098,7 @@ separately into the selected partition. - 27 + 28 @@ -10892,7 +11108,7 @@ separately into the selected partition. GRUB install - 27 + 28 False @@ -11271,7 +11487,7 @@ separately into the selected partition. - 28 + 29 @@ -11281,7 +11497,7 @@ separately into the selected partition. GRUB update - 28 + 29 False @@ -12007,7 +12223,7 @@ separately into the selected partition. - 29 + 30 @@ -12017,7 +12233,7 @@ separately into the selected partition. OS only - 29 + 30 False @@ -12813,7 +13029,7 @@ separately into the selected partition. - 30 + 31 @@ -12823,7 +13039,7 @@ separately into the selected partition. User data only - 30 + 31 False -- 2.35.1 From ada03f1e0c06ca4f36b3693eeb5926b534e48f7f Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Fri, 12 Dec 2025 16:47:17 +0000 Subject: [PATCH 7/8] Keyboard slide remake; Localisation for new windows --- gresource.xml | 1 + locale/ubinstall-gtk.pot | 105 +++- locale/ubinstall-gtk_ru.po | 153 ++++-- source/CMakeLists.txt | 1 + source/ubinstall-gtk-decorations.c | 9 - source/ubinstall-gtk-keyboard.c | 700 +++++++++++++++------------ source/ubinstall-gtk-language.c | 2 +- source/ubinstall-gtk-page-switch.c | 3 +- source/ubinstall-gtk.c | 46 +- source/ubinstall-gtk.h | 73 ++- source/ubl-strings.h | 38 +- ubinstall-gtk-keyboard-layouts.glade | 123 +++++ ubinstall-gtk.glade | 687 +++++++++++++++++++------- 13 files changed, 1379 insertions(+), 562 deletions(-) create mode 100644 ubinstall-gtk-keyboard-layouts.glade diff --git a/gresource.xml b/gresource.xml index ead2b57..cfb8b35 100644 --- a/gresource.xml +++ b/gresource.xml @@ -20,6 +20,7 @@ ubinstall-gtk-source.glade ubinstall-gtk-source-element.glade ubinstall-gtk-layouts.glade + ubinstall-gtk-keyboard-layouts.glade ubinstall-gtk.css diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 73f1292..608a5bb 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -1173,10 +1173,6 @@ msgstr "" msgid "Skip configuration" msgstr "" -#: source/ubl-strings.h:331 -msgid "Are you sure want to exit and\ninterrupt installation process?" -msgstr "" - #: source/ubl-strings.h:331 msgid "Are you sure want to interrupt installation process?" msgstr "" @@ -1206,5 +1202,104 @@ msgid "Yes, I agree to the License Agreement" msgstr "" #: source/ubl-strings.h:331 -msgid "No, i do not agree" +msgid "No, I do not agree" +msgstr "" + +#: source/ubl-strings.h:11 +msgid "Keyboard layouts:" +msgstr "" + + + +#: source/ubl-strings.h:13 +msgid "Move layout up" +msgstr "" + +#: source/ubl-strings.h:14 +msgid "Move layout down" +msgstr "" + +#: source/ubl-strings.h:15 +msgid "Add layout" +msgstr "" + +#: source/ubl-strings.h:24 +msgid "Layouts:" +msgstr "" + +#: source/ubl-strings.h:25 +msgid "Default layout" +msgstr "" + +#: source/ubl-strings.h:26 +msgid "Changing the layout:" +msgstr "" + + +#: source/ubl-strings.h:28 +msgid "Set Compose (Multi_Key) to the right Win key" +msgstr "" + +#: source/ubl-strings.h:29 +msgid "Scroll Lock indication when switching layouts" msgstr "" + +#: source/ubl-strings.h:32 +msgid "NumLock:" +msgstr "" + +#: source/ubl-strings.h:34 +msgid "Key layout and switch:" +msgstr "" + +#: source/ubl-strings.h:37 +msgid "Variant" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current layout?" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Layout deletion" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Manual input:" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Specify your preferred keyboard settings" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Available locales in the system:" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "System locale" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Locale" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Language" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Territory" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Add locales" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Specify your preferred system languages" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Remove locale" +msgstr "" \ No newline at end of file diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 38b3438..c690083 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -101,8 +101,7 @@ msgid "Installation completion" msgstr "Завершение установки" #: source/ubl-strings.h:24 -msgid "" -"Deleting all data on the selected disk and then installing the system" +msgid "Deleting all data on the selected disk and then installing the system" msgstr "" "Удаление всех данных на выбранном диске с последующей установкой системы " "UBLinux" @@ -120,7 +119,8 @@ msgid "Installation on the same partition as another system" msgstr "Установка в раздел другой системы" #: source/ubl-strings.h:28 -msgid "Unpacking the system into an existing system" +#, fuzzy +msgid "Unpacking the file system into an existing system" msgstr "Установить ОС в уже существующий раздел" #: source/ubl-strings.h:29 source/ubl-strings.h:281 @@ -413,10 +413,11 @@ msgid "Format" msgstr "Форматировать" #: source/ubl-strings.h:107 +#, fuzzy msgid "" "You have system installed on your computer.\n" "You can reboot and use your new system\n" -"or continue working in the environment, booted from the Live image." +"or continue working in the system Live environment." msgstr "" "На вашем компьютере установлена система.\n" "Вы можете перезагрузить и использовать свою новую систему\n" @@ -509,8 +510,8 @@ msgstr "Ошибка установки" #: source/ubl-strings.h:135 msgid "" -"Attention! The system will be installed on the selected partition with " -"OS already installed. All user data will be saved." +"Attention! The system will be installed on the selected partition with OS " +"already installed. All user data will be saved." msgstr "" "Внимание! В выбранный раздел будет произведена установка системы. " "Если не менять тип ФС и не форматировать, все данные на разделе будут " @@ -663,10 +664,6 @@ msgstr "" "Вы уверены, что хотите закрыть программу и\n" "прервать процесс установки?" -#: source/ubl-strings.h:331 -msgid "Are you sure want to interrupt installation process?" -msgstr "Вы уверены, что хотите прервать процесс установки?" - #: source/ubl-strings.h:187 msgid "Are you sure want to reboot system?" msgstr "Вы уверены что хотите перезагрузить систему?" @@ -1212,6 +1209,94 @@ msgstr "Источник" msgid "Skip configuration" msgstr "Пропустить настройку" +#: source/ubl-strings.h:331 +msgid "Are you sure want to interrupt installation process?" +msgstr "Вы уверены, что хотите прервать процесс установки?" + +#: source/ubl-strings.h:331 +msgid "Repeating values" +msgstr "Повторяющиеся значения" + +#: source/ubl-strings.h:331 +msgid "Package information" +msgstr "Информация о пакете" + +#: source/ubl-strings.h:331 +msgid "Package:" +msgstr "Пакет:" + +#: source/ubl-strings.h:331 +msgid "Module:" +msgstr "Модуль:" + +#: source/ubl-strings.h:331 +msgid "Yes, I agree to the License Agreement" +msgstr "Да, я согласен с лицензионным соглашением" + +#: source/ubl-strings.h:331 +msgid "No, I do not agree" +msgstr "Нет, я не согласен" + +#: source/ubl-strings.h:11 +msgid "Keyboard layouts:" +msgstr "Раскладки клавиатуры:" + +#: source/ubl-strings.h:13 +msgid "Move layout up" +msgstr "Переместить раскладку выше" + +#: source/ubl-strings.h:14 +msgid "Move layout down" +msgstr "Переместить раскладку ниже" + +#: source/ubl-strings.h:15 +msgid "Add layout" +msgstr "Добавить раскладку" + +#: source/ubl-strings.h:24 +msgid "Layouts:" +msgstr "Раскладки:" + +#: source/ubl-strings.h:25 +msgid "Default layout" +msgstr "Раскладка по умолчанию" + +#: source/ubl-strings.h:26 +msgid "Changing the layout:" +msgstr "Смена раскладки:" + +#: source/ubl-strings.h:28 +msgid "Set Compose (Multi_Key) to the right Win key" +msgstr "Установить Compose (Multi_Key) на клавишу \"правая Win\"" + +#: source/ubl-strings.h:29 +msgid "Scroll Lock indication when switching layouts" +msgstr "Индикация Scroll Lock при переключении раскладки" + +#: source/ubl-strings.h:32 +msgid "NumLock:" +msgstr "NumLock:" + +#: source/ubl-strings.h:34 +msgid "Key layout and switch:" +msgstr "Раскладка клавиш и переключатель:" + +#: source/ubl-strings.h:37 +msgid "Variant" +msgstr "Вариант" + +#: source/ubl-strings.h:20 +msgid "Are you sure you want to remove current layout?" +msgstr "Вы уверены что хотите удалить данную раскладку?" + +#: source/ubl-strings.h:20 +msgid "Layout deletion" +msgstr "Удаление раскладки" + +#: source/ubl-strings.h:20 +msgid "Manual input:" +msgstr "Ручной выбор:" + msgid "" "Attention! The system will be installed in the selected partition. " "If you do not change the FS type or format, all data on the partition " @@ -3025,26 +3110,38 @@ msgstr "Зулу" msgid "Zurich" msgstr "Цюрих" -#: source/ubl-strings.h:331 -msgid "Repeating values" -msgstr "Повторяющиеся значения" +#: source/ubl-strings.h:20 +msgid "Specify your preferred keyboard settings" +msgstr "Укажите предпочитаемые настройки клавиатуры" -#: source/ubl-strings.h:331 -msgid "Package information" -msgstr "Информация о пакете" +#: source/ubl-strings.h:20 +msgid "Available locales in the system:" +msgstr "Доступные языки системы:" -#: source/ubl-strings.h:331 -msgid "Package:" -msgstr "Пакет:" +#: source/ubl-strings.h:20 +msgid "System locale" +msgstr "Язык системы" -#: source/ubl-strings.h:331 -msgid "Module:" -msgstr "Модуль:" +#: source/ubl-strings.h:20 +msgid "Locale" +msgstr "Локаль" -#: source/ubl-strings.h:331 -msgid "Yes, I agree to the License Agreement" -msgstr "Да, я согласен с лицензионным соглашением" +#: source/ubl-strings.h:20 +msgid "Language" +msgstr "Язык" -#: source/ubl-strings.h:331 -msgid "No, i do not agree" -msgstr "Нет, я не согласен" +#: source/ubl-strings.h:20 +msgid "Territory" +msgstr "Территория" + +#: source/ubl-strings.h:20 +msgid "Add locales" +msgstr "Добавить локаль" + +#: source/ubl-strings.h:20 +msgid "Specify your preferred system languages" +msgstr "Укажите предпочитаемый язык системы" + +#: source/ubl-strings.h:20 +msgid "Remove locale" +msgstr "Удалить локаль" \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 797d534..eb5a90b 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -73,6 +73,7 @@ set(DEPENDFILES ../ubinstall-gtk-source.glade ../ubinstall-gtk-source-element.glade ../ubinstall-gtk-layouts.glade + ../ubinstall-gtk-keyboard-layouts.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk-decorations.c b/source/ubinstall-gtk-decorations.c index 9545480..603f6d8 100644 --- a/source/ubinstall-gtk-decorations.c +++ b/source/ubinstall-gtk-decorations.c @@ -4,7 +4,6 @@ void yon_resize_images_update(main_window *widgets){ enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); gtk_widget_hide(widgets->BootloaderImage); gtk_widget_hide(widgets->RegionImage); - gtk_widget_hide(widgets->KeyboardImage); gtk_widget_hide(widgets->UserImage); gtk_widget_hide(widgets->StartupImage); gtk_widget_hide(widgets->NetworkImage); @@ -16,9 +15,6 @@ void yon_resize_images_update(main_window *widgets){ case YON_PAGE_REGION: gtk_widget_show(widgets->RegionImage); break; - case YON_PAGE_KEYBOARD: - gtk_widget_show(widgets->KeyboardImage); - break; case YON_PAGE_USERS: gtk_widget_show(widgets->UserImage); break; @@ -51,11 +47,6 @@ void on_region_resized(GtkWidget *,main_window *widgets){ target = GTK_IMAGE(widgets->RegionImage); pixbuf = widgets->region_original; - break; - case YON_PAGE_KEYBOARD: - target = GTK_IMAGE(widgets->KeyboardImage); - pixbuf = widgets->keyboard_original; - break; case YON_PAGE_USERS: target = GTK_IMAGE(widgets->UserImage); diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index 0c2f096..9ff1a63 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -1,385 +1,467 @@ #include "ubinstall-gtk.h" int yon_keyboard_save(main_window *widgets){ - GtkTreeIter iter,iter_child; - if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutList),&iter)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LAYOUTS_CHOSEN_BUT_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->LayoutTree)); + if (gtk_switch_get_active(GTK_SWITCH(widgets->KeyboardDefaultLayoutsSwitch))){ + yon_config_remove_by_key(xkblayout_parameter); + } else { + GtkTreeIter iter; + if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutsList),&iter)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),yon_char_get_localised_from_lib(EMPTY_IMPORTANT_LABEL),5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->KeyboardLayoutTree); return 0; } - char *layouts_list=""; - GtkTreeModel *layouts_model=GTK_TREE_MODEL(widgets->LayoutList); - char *cur_layout=NULL; - for_iter(layouts_model,&iter){ - int chosen=0; - int primary=0; - gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,4,&primary,-1); - if (chosen) - layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL); - if (primary){ - yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,cur_layout); - } - if (gtk_tree_model_iter_children(layouts_model,&iter_child,&iter)){ - for(int valid2=1;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->LayoutList),&iter_child)){ - gtk_tree_model_get(layouts_model,&iter_child,0,&cur_layout,3,&chosen,4,&primary,-1); - if (chosen) - layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL); - if (primary){ - yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,cur_layout); - } - } - } - } + } + return 1; +} - if (!yon_char_is_empty(layouts_list)) - yon_config_register(xkblayout_parameter,xkblayout_parameter_command,layouts_list); - else - yon_config_remove_by_key(xkblayout_parameter); +void yon_keyboard_init(main_window *widgets){ + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets); + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardLayoutChangingCombo),G_CALLBACK(on_options_save),widgets); + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardNumLockCombo),G_CALLBACK(on_num_lock_changed),widgets); + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardScrollLockSwitch),G_CALLBACK(on_scroll_lock_switch),widgets); + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardComposeSwitch),G_CALLBACK(on_compose_switch),widgets); + g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets); + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo)); + int size; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo),DEFAULT_LABEL); + config_str models = yon_config_load(get_keyboard_models_command,&size); + for (int i=0;iKeyboardModelCombo),parsed[0],_(parsed[1])); + yon_char_parsed_free(parsed,parsed_size); + } + yon_char_parsed_free(models,size); + + // g_signal_handlers_block_by_func(G_OBJECT(widgets->TTYLayoutCombo),G_CALLBACK(on_tty_changed),widgets); - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo))){ - char *model = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)); - if (!yon_char_is_empty(model)) - yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model); - } else{ - yon_config_remove_by_key(xkbmodel_parameter); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),0); + { + char *kbmodel = yon_config_get_by_key(xkbmodel_parameter); + if (kbmodel) { + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); + } } - - if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo))){ - char *options = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo)); - if (options){}; - yon_config_register(xkboptions_parameter,xkboptions_parameter_command,options); - } else { - yon_config_remove_by_key(xkboptions_parameter); + { + gtk_list_store_clear(widgets->LayoutsList); + char *layouts = config(xkblayout_parameter); + + int layouts_parsed_size; + config_str layouts_parsed = yon_char_parse(layouts,&layouts_parsed_size,","); + for(int i=0;iKeyboardDefaultLayoutsSwitch),1); + } else { + gtk_switch_set_active(GTK_SWITCH(widgets->KeyboardDefaultLayoutsSwitch),0); + } + + if (yon_char_is_empty(layouts)){ + char *element = yon_char_parsed_check_exist_begins_with(main_config.layouts_list,main_config.layouts_size,"us|"); + if (element){ + int parsed_size; + config_str parsed = yon_char_parse(element,&parsed_size,"|"); + GtkTreeIter iter; + gtk_list_store_append(widgets->LayoutsList,&iter); + gtk_list_store_set(widgets->LayoutsList,&iter,0,parsed[0],2,_(parsed[1]),-1); + yon_char_parsed_free(parsed,parsed_size); + } + } } - - if (!main_config.configure_mode){ + { + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardLayoutChangingCombo)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->KeyboardLayoutChangingCombo),DEFAULT_LABEL); int size; - config_str parameters = yon_config_get_save_parameters_by_key(&size,xkbvariant_parameter,xkblayout_parameter,xkbmodel_parameter,xkboptions_parameter,NULL); - if (parameters){ - char *command_parameters = yon_char_parsed_to_string(parameters,size," -- "); - char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); - if (!system(yon_debug_output("%s\n",command))){} - free(command); - yon_char_parsed_free(parameters,size); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo),0); + config_str options = yon_config_load(grp_options_command,&size); + + for (int i=0;iKeyboardLayoutChangingCombo),parsed[0],_(parsed[1])); + yon_char_parsed_free(parsed,parsed_size); } + yon_char_parsed_free(options,size); } - return 1; -} - -ubinstall_keyboard_window *yon_ubinstall_keyboard_new(){ -void on_additional_software_toggled(); - ubinstall_keyboard_window *window = malloc(sizeof(ubinstall_keyboard_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_keyboard); - window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); - window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); - window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); - window->LayoutsTree=yon_gtk_builder_get_widget(builder,"LayoutsTree"); - window->ActiveToggle = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ActiveToggle")); + { + char *name = yon_config_get_by_key(num_lock_boot_parameter); + if (name) { + if (!strcmp(name,"yes")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),1); + else if (!strcmp(name,"no")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),2); + } + } + { + char *options = config(xkboptions_parameter); + if (!yon_char_is_empty(options)){ + int size; + config_str parsed = yon_char_parse(options,&size,","); + if (!yon_char_is_empty(parsed[0])){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo),parsed[0]); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo),0); + } + if (yon_char_parsed_check_exist(parsed,size,"compose:rwin")>-1){ + gtk_switch_set_active(GTK_SWITCH(widgets->KeyboardComposeSwitch),1); + } else { + gtk_switch_set_active(GTK_SWITCH(widgets->KeyboardComposeSwitch),0); + } + if (yon_char_parsed_check_exist(parsed,size,"grp_led:scroll")>-1){ + gtk_switch_set_active(GTK_SWITCH(widgets->KeyboardScrollLockSwitch),1); + } else { + gtk_switch_set_active(GTK_SWITCH(widgets->KeyboardScrollLockSwitch),0); + } + } - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + } -return window; + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardNumLockCombo),G_CALLBACK(on_num_lock_changed),widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardLayoutChangingCombo),G_CALLBACK(on_options_save),widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardScrollLockSwitch),G_CALLBACK(on_scroll_lock_switch),widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardComposeSwitch),G_CALLBACK(on_compose_switch),widgets); + g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets); } -void on_keyboard_removed(GtkWidget *, main_window *widgets){ - GtkTreeModel *model; - GtkTreeIter iter, childiter; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LayoutTree)),&model,&iter)){ - gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&childiter,&iter); - gtk_tree_store_set(widgets->LayoutList,&childiter,3,0,-1); +void on_layouts_accept(GtkWidget *self, layouts_window *window){ + main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); + if (!yon_char_is_empty(window->parameters)){ + yon_config_register(xkblayout_parameter,xkblayout_parameter_command,window->parameters); + } else { + yon_config_remove_by_key(xkblayout_parameter); } + on_subwindow_close(self); + yon_keyboard_init(widgets); } -void yon_language_selection_changed(GtkCellRenderer *, char *path, ubinstall_language_window *window){ +void on_layouts_chosen(GtkCellRenderer *, gchar *path, layouts_window *window){ GtkTreeIter iter; - int state; + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path); + int chosen; + char *layout, *variant; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&layout,1,&variant,3,&chosen,-1); + gtk_tree_store_set(GTK_TREE_STORE(window->list),&iter,3,!chosen,-1); - if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->liststore1),&iter,path)){ - gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&state,-1); - gtk_list_store_set(window->liststore1,&iter,0,!state,-1); - } -} -void on_language_window_accept(GtkWidget *,dictionary *dict){ - main_window *widgets= yon_dictionary_get_data(dict->first,main_window*); - ubinstall_language_window *window = yon_dictionary_get_data(dict->first->next,ubinstall_language_window*); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - GtkTreeIter iter; - int size; - config_str lang_parsed = default_langs(&size); - - char *final = ""; - for_iter(widgets->LanguagesList,&iter){ - char *code, *labl; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&code,2,&labl,-1); - if (yon_char_parsed_check_exist(lang_parsed,size,code)!=-1){ - gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); - char *tmp = yon_char_unite(final,!yon_char_is_empty(final)?";":"",labl,NULL); - if (!yon_char_is_empty(final)) free(final); - final = tmp; - } else - gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); - } - if (!yon_char_is_empty(final)){ - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),final); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); + char *full_layout = NULL; + if (!yon_char_is_empty(variant)){ + full_layout = yon_char_unite(layout,"_",variant,NULL); } else { - yon_gtk_list_store_copy_full(widgets->LanguagesList,window->liststore1); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); - config_str parsed = NULL; - int size; - GtkTreeIter iter; - for_iter(GTK_TREE_MODEL(window->liststore1),&iter){ - char *current; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,2,¤t,-1); - if (status) - yon_char_parsed_add_or_create_if_exists(parsed,&size,current); - } - if (parsed){ - char *final = yon_char_parsed_to_string(parsed,size,"; "); - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),!yon_char_is_empty(final)?final:""); - if (yon_char_is_empty(final)) { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguagesCombo),-1); - } - if (final) free(final); - yon_char_parsed_free(parsed,size); - } else - gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); - + full_layout = layout; } - on_subwindow_close(window->MainWindow); - free(window); + if (!chosen){ + char *temp = yon_char_append_element(window->parameters,full_layout,","); + free(window->parameters); + window->parameters = temp; + } else { + char *temp = yon_char_remove_element(window->parameters,full_layout,","); + free(window->parameters); + window->parameters = temp; + } + free(full_layout); } -void yon_focus_set(GtkWidget *,GtkWidget *target){ - gtk_widget_grab_focus(target); - +void on_system_layouts_add(GtkWidget *, main_window *widgets){ + yon_layouts_add(GTK_TREE_VIEW(widgets->KeyboardLayoutTree),widgets->LayoutsList,widgets); } -ubinstall_language_window *yon_ubinstall_language_new(){ - ubinstall_language_window *window = malloc(sizeof(ubinstall_language_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubinstall_language); - window->liststore1=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); - window->MainWindow=yon_gtk_builder_get_widget(builder,"MainWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->DefaultCheck=yon_gtk_builder_get_widget(builder,"DefaultCheck"); - window->LanguagesTree=yon_gtk_builder_get_widget(builder,"LanguagesTree"); - window->headerBar=yon_gtk_builder_get_widget(builder,"headerBar"); - window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); - window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton"); - window->ToggleRenderer=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleRenderer")); - - g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->LanguagesTree); - g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_focus_set),window->LanguagesTree); - g_signal_connect(G_OBJECT(window->ToggleRenderer),"toggled",G_CALLBACK(yon_language_selection_changed),window); +layouts_window *yon_layouts_window_new(){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_layouts_path); + layouts_window *window = malloc(sizeof(layouts_window)); + memset(window,0,sizeof(layouts_window)); + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->ChosenCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ChosenCell")); + window->MainTree = yon_gtk_builder_get_widget(builder,"LayoutsTree"); + window->parameters = yon_char_new(config(xkblayout_parameter)); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); -return window; + g_signal_connect(G_OBJECT(window->ChosenCell),"toggled",G_CALLBACK(on_layouts_chosen),window); + return window; } -void on_language_clicked(GtkWidget *, main_window *widgets){ - ubinstall_language_window *window = yon_ubinstall_language_new(); - g_object_ref(G_OBJECT(window->liststore1)); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),NULL); - yon_gtk_list_store_copy_full(window->liststore1,widgets->LanguagesList); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LanguagesTree),GTK_TREE_MODEL(window->liststore1)); - yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),TITLE_LABEL,icon_path,"language-chooser-window"); - gtk_tree_view_set_search_column(GTK_TREE_VIEW(window->LanguagesTree),2); - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AvailableLanguagesEntry)))){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); - } +void yon_layouts_add(GtkTreeView *, GtkListStore *, main_window *widgets){ + layouts_window *window = yon_layouts_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),TITLE_LABEL,icon_path,"layout_window"); + + window->list = main_config.layouts_store; + + gtk_tree_view_set_model(GTK_TREE_VIEW(window->MainTree), GTK_TREE_MODEL(main_config.layouts_store)); + gtk_tree_view_column_clicked(GTK_TREE_VIEW_COLUMN(gtk_tree_view_get_column(GTK_TREE_VIEW(window->MainTree),0))); + yon_layout_build(window); + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_layouts_accept),window); + char *languages = config(xkblayout_parameter); int size; - int found=0; - int statusfound=0; - config_str langs = default_langs(&size); - GtkTreeIter iter; - for_iter(widgets->LanguagesList,&iter){ - char *cur; - int status; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,0,&status,2,&cur,-1); - if (status){ - statusfound++; - if (yon_char_parsed_check_exist(langs,size,cur)>-1) - found++; + config_str parsed = yon_char_parse(languages,&size,","); + GtkTreeIter iter,itar; + for_iter(window->list,&iter){ + int found = 0; + char *id, *id_var; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&id,-1); + for (int i=0;ilist),&iter,3,1,-1); + found=1; + break; + } + } + if (!found) { + gtk_tree_store_set(GTK_TREE_STORE(window->list),&iter,3,0,-1); + } + if (gtk_tree_model_iter_children(GTK_TREE_MODEL(window->list),&itar,&iter)){ + for (int valid2=1;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){ + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&id,1,&id_var,-1); + for (int i=0;ilist),&itar,3,1,-1); + found=1; + break; + } + } + } } - } - if ((found==size)&&statusfound==size){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); - } - dictionary *dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_language_window_accept),dict); - gtk_tree_view_column_clicked(gtk_tree_view_get_column(GTK_TREE_VIEW(window->LanguagesTree),0)); - gtk_widget_show(window->MainWindow); - + } } - - -void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window){ - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(window->LayoutsTree)); + +void yon_layouts_remove(GtkTreeView *tree, GtkListStore *cur_list, main_window *widgets){ + GtkTreeModel *model = GTK_TREE_MODEL(cur_list); GtkTreeIter iter; - if (gtk_tree_model_get_iter_from_string(model,&iter,path)){ - int status=0; - gtk_tree_model_get(model,&iter,3,&status,-1); - gtk_tree_store_set(GTK_TREE_STORE(model),&iter,3,!status,-1); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree),&model,&iter)){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text = LAYOUT_REMOVE_LABEL; + data->title = LAYOUT_REMOVE_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->MainWindow,data)!=GTK_RESPONSE_ACCEPT) return; + gtk_list_store_remove(widgets->LayoutsList,&iter); } + yon_keyboard_init(widgets); } - -void on_keyboard_accept(GtkWidget *self,main_window *widgets){ - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter)); - on_subwindow_close(self); +void on_system_layouts_remove(GtkWidget *, main_window *widgets){ + yon_layouts_remove(GTK_TREE_VIEW(widgets->KeyboardLayoutTree),widgets->LayoutsList,widgets); } +// standard functions -void on_keyboard_clicked (GtkWidget *, main_window *widgets){ - ubinstall_keyboard_window *window = yon_ubinstall_keyboard_new(); - yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),KEYBOARD_TITLE_LABEL,icon_path,"keyboard-window"); - gtk_tree_view_set_model(GTK_TREE_VIEW(window->LayoutsTree),GTK_TREE_MODEL(widgets->LayoutList)); - gtk_tree_view_column_clicked(gtk_tree_view_get_column(GTK_TREE_VIEW(window->LayoutsTree),1)); - - g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window); - g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets); - gtk_widget_show(window->MainWindow); +config_str yon_layout_get_children(char *layout_id, int *size){ + (*size)=0; + config_str final = NULL; + for (int i=0;iLayoutList,&parent,NULL); - gtk_tree_store_set(widgets->LayoutList,&parent,0,key,1,_((char*)g_hash_table_lookup(value,"")),2,1,3,0,-1); - - GList *list = g_hash_table_get_keys(value); - GList *iterator = NULL; - for (iterator=list;iterator;iterator=iterator->next){ - if (!yon_char_is_empty((char*)iterator->data)){ - gtk_tree_store_append(widgets->LayoutList,&iter,&parent); - gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,4,0,-1); + if (strstr(layout,"_")){ + char *cur_variant = yon_char_new(layout); + char *cur_layout = yon_char_divide_search(cur_variant,"_",-1); + for (int i=0;iLayoutsList,&iter); + gtk_list_store_set(widgets->LayoutsList,&iter,0,parsed[0],1,parsed[1],2,_(parsed[2]),-1); + } + } + + } else { + for (int i=0;iLayoutsList,&iter); + gtk_list_store_set(widgets->LayoutsList,&iter,0,parsed[0],2,_(parsed[1]),-1); + } } } } -void yon_keyboard_init(main_window *widgets){ +void yon_layout_build(layouts_window *window){ + gtk_tree_store_clear(window->list); + GtkTreeIter parent; + GtkTreeIter iter; int size; - config_str parsed = NULL; - parsed = yon_config_load(yon_debug_output("%s\n",get_layouts_command),&size); - GHashTable *table = g_hash_table_new(g_str_hash,g_str_equal); + config_str layouts = yon_config_load(layouts_command,&size); for (int i=0;ilist,&parent,NULL); + gtk_tree_store_set(window->list,&parent,0,parsed[0],2,_(parsed[1]),-1); + int variants_size; + config_str variants = yon_layout_get_children(parsed[0],&variants_size); + yon_char_parsed_free(parsed,parsed_size); + for (int k=0;klist,&iter,&parent); + gtk_tree_store_set(window->list,&iter,0,parsed[0],1,parsed[1],2,_(parsed[2]),-1); + yon_char_parsed_free(parsed,parsed_size); } + yon_char_parsed_free(variants,variants_size); + } + yon_char_parsed_free(layouts,size); + +} - g_hash_table_foreach(table,(GHFunc)yon_layout_build,widgets); - yon_char_parsed_free(parsed,size); - config_str models = yon_config_load(yon_debug_output("%s\n",get_models_command),&size); - for (int i=0;iKeyboardModelCombo),models[i],_(models[i+1])); +void on_layout_move_up(GtkWidget *, main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter,*previter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->KeyboardLayoutTree)),&model,&iter)){ + previter = gtk_tree_iter_copy(&iter); + if (!gtk_tree_model_iter_previous(model,previter)) return; + char *a, *b; + gtk_tree_model_get(model,&iter,0,&a,-1); + gtk_tree_model_get(model,previter,0,&b,-1); + char *layouts = config(xkblayout_parameter); + char *temp = yon_char_swap_element(layouts,a,b,","); + yon_config_register(xkblayout_parameter,xkblayout_parameter_command,temp); + free(temp); + gtk_list_store_swap(widgets->LayoutsList,&iter,previter); + gtk_tree_iter_free(previter); } - if (size) yon_char_parsed_free(models,size); +} - char *keyboard = config(xkbmodel_parameter); - char *option_parameter = config(xkboptions_parameter); - char *layouts = config(xkblayout_parameter); - char *variant = config(xkbvariant_parameter); +void on_layout_move_down(GtkWidget *, main_window *widgets){ + GtkTreeModel *model; + GtkTreeIter iter,*nextiter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->KeyboardLayoutTree)),&model,&iter)){ + nextiter = gtk_tree_iter_copy(&iter); + if (!gtk_tree_model_iter_next(model,nextiter)) return; + char *a, *b; + gtk_tree_model_get(model,&iter,0,&a,-1); + gtk_tree_model_get(model,nextiter,0,&b,-1); + char *layouts = config(xkblayout_parameter); + char *temp = yon_char_swap_element(layouts,a,b,","); + yon_config_register(xkblayout_parameter,xkblayout_parameter_command,temp); + free(temp); + gtk_list_store_swap(widgets->LayoutsList,&iter,nextiter); + gtk_tree_iter_free(nextiter); + } +} - if (!yon_char_is_empty(keyboard)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),keyboard); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); +void on_compose_switch(GtkWidget *,int status,main_window *widgets){ + switch(status){ + case 0:{ + yon_config_remove_element(xkboptions_parameter,"compose:rwin",","); + } break; + case 1:{ + yon_config_append_element(xkboptions_parameter,"compose:rwin",","); + } break; } + yon_keyboard_init(widgets); +} - if (!yon_char_is_empty(option_parameter)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),option_parameter); - } else{ - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); +void on_scroll_lock_switch(GtkWidget *,int status,main_window *widgets){ + switch(status){ + case 0:{ + yon_config_remove_element(xkboptions_parameter,"grp_led:scroll",","); + } break; + case 1:{ + yon_config_append_element(xkboptions_parameter,"grp_led:scroll",","); + } break; } + yon_keyboard_init(widgets); +} - if (!yon_char_is_empty(layouts)){ - int parsed_size; - config_str parsed = yon_char_parse(layouts,&parsed_size,","); +void on_layout_default_sensitive_toggled(GtkWidget *, int status, main_window *widgets){ + gtk_widget_set_sensitive(widgets->KeyboardLayoutTree,!status); + gtk_widget_set_sensitive(widgets->KeyboardLayoutAddButton,!status); + if (status){ + gtk_widget_set_sensitive(widgets->KeyboardLayoutRemoveButton,!status); + gtk_widget_set_sensitive(widgets->KeyboardLayoutMoveUpButton,!status); + gtk_widget_set_sensitive(widgets->KeyboardLayoutMoveDownButton,!status); + }else { + on_layout_selection_changed(GTK_TREE_VIEW(widgets->KeyboardLayoutTree),widgets); - GtkTreeIter iter, chiter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->LayoutList); + } +} + +void on_layout_default_toggled(GtkWidget *, int status, main_window *widgets){ + if (!status){ + GtkTreeModel *model = GTK_TREE_MODEL(widgets->LayoutsList); + GtkTreeIter iter; + char *locales = NULL; for_iter(model,&iter){ - char *target; - gtk_tree_model_get(model,&iter,0,&target,-1); - if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ - gtk_tree_store_set(widgets->LayoutList,&iter,2,1,3,1,-1); - if (!strcmp(variant,target)){ - gtk_tree_store_set(widgets->LayoutList,&iter,4,1,-1); - } else { - gtk_tree_store_set(widgets->LayoutList,&iter,4,0,-1); + char *target, *variant; - } - for (int valid2 = gtk_tree_model_iter_children(model,&chiter,&iter);valid2;valid2 = gtk_tree_model_iter_next(model,&chiter)){ - gtk_tree_model_get(model,&chiter,0,&target,-1); - if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ - gtk_tree_store_set(widgets->LayoutList,&chiter,2,1,3,1,-1); - if (!strcmp(variant,target)){ - gtk_tree_store_set(widgets->LayoutList,&chiter,4,1,-1); - - } - } else { - gtk_tree_store_set(widgets->LayoutList,&chiter,3,0,4,0,-1); - } - } + gtk_tree_model_get(model,&iter,0,&target,1,&variant,-1); + char *key = NULL; + if (!yon_char_is_empty(variant)){ + key = yon_char_unite(target,"_",variant,NULL); } else { - gtk_tree_store_set(widgets->LayoutList,&iter,3,0,4,0,-1); + key = yon_char_new(target); } - + char *temp = yon_char_append_element(locales?locales:"",key,","); + if (!yon_char_is_empty(locales)) free(locales); + locales = temp; + } + if (!yon_char_is_empty(locales)){ + yon_config_register(xkblayout_parameter,xkblayout_parameter_command,locales); } - } else { - } } -void on_keyboard_layout_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){ - GtkTreeIter iter, itar, itor, itur; - gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->LayoutsFilter),&iter,path); - int status; - char *target; - gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&itur,&iter); - gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&itur,4,&status,1,&target,-1); - // g_signal_handlers_block_by_func(self,G_CALLBACK(on_keyboard_layout_chosen),widgets); - for_iter(GTK_TREE_MODEL(widgets->LayoutsFilter),&itar){ - gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&itor,&itar); - // gtk_tree_model_sort_convert_iter_to_child_iter(GTK_TREE_MODEL_SORT(widgets->LayoutList),&itar,&itor); - gtk_tree_store_set(widgets->LayoutList,&itor,4,0,-1); - GtkTreeIter itor_child; - if (gtk_tree_model_iter_children(GTK_TREE_MODEL(widgets->LayoutList),&itor_child,&itor)){ - for(int valid2=1;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->LayoutList),&itor_child)){ - gtk_tree_store_set(widgets->LayoutList,&itor_child,4,0,-1); - } - } +void on_layout_selection_changed(GtkTreeView *self,main_window *widgets){ + int status = gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),NULL,NULL); + gtk_widget_set_sensitive(widgets->KeyboardLayoutMoveDownButton,status); + gtk_widget_set_sensitive(widgets->KeyboardLayoutMoveUpButton,status); + gtk_widget_set_sensitive(widgets->KeyboardLayoutRemoveButton,status); + +} +void on_num_lock_changed(GtkComboBox *self, main_window *){ + switch (gtk_combo_box_get_active(self)){ + case 0: + yon_config_remove_by_key(num_lock_boot_parameter); + break; + case 1: yon_config_register(num_lock_boot_parameter,num_lock_boot_parameter_command,"yes"); + break; + case 2:yon_config_register(num_lock_boot_parameter,num_lock_boot_parameter_command,"no"); + break; } - gtk_tree_store_set(widgets->LayoutList,&itur,4,!status,-1); - // g_signal_handlers_unblock_by_func(self,G_CALLBACK(on_keyboard_layout_chosen),widgets); - if (!status){ - yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,target); +} + +void on_model_changed(GtkComboBoxText *self, main_window *widgets){ + switch (gtk_combo_box_get_active(GTK_COMBO_BOX(self))){ + case 0: + yon_config_remove_by_key(xkbmodel_parameter); + break; + default: + char *id = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)); + yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,id); + break; + } +} + +void on_options_save(GtkWidget *,main_window *widgets){ + char *main_id = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo)); + int parameter_parsed_size; + config_str parameter_parsed = NULL; + yon_char_parsed_add_or_create_if_exists(parameter_parsed,¶meter_parsed_size,!yon_char_is_empty(main_id)?main_id:""); + char *final_parameter = yon_char_parsed_to_string_full(parameter_parsed,parameter_parsed_size,","); + yon_char_parsed_free(parameter_parsed,parameter_parsed_size); + if (!yon_char_is_empty(final_parameter)){ + yon_config_register(xkboptions_parameter,xkboptions_parameter_command,final_parameter); + free(final_parameter); } else { - yon_config_remove_by_key(xkbvariant_parameter); + yon_config_remove_by_key(xkboptions_parameter); } } \ No newline at end of file diff --git a/source/ubinstall-gtk-language.c b/source/ubinstall-gtk-language.c index ff6041b..0c0b0bb 100644 --- a/source/ubinstall-gtk-language.c +++ b/source/ubinstall-gtk-language.c @@ -240,4 +240,4 @@ int yon_language_save(main_window *widgets){ void yon_language_init(main_window *widgets){ yon_language_update(widgets); -} \ No newline at end of file +} diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 3be4fcd..ba60189 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -449,7 +449,8 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ data->title=WARNING_TITLE_LABEL; if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ if (main_config.install_thread){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_LICENCE); + on_page_prev_clicked(NULL,widgets); gtk_widget_hide(gtk_widget_get_parent(widgets->InstallationProgress)); gtk_widget_hide(gtk_widget_get_parent(widgets->PackageInstallationProgress)); pthread_cancel((pthread_t)main_config.install_thread); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index a268a84..5d0f8f5 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -571,6 +571,16 @@ void config_init(){ yon_char_parsed_free(parsed,parsed_size); } yon_char_parsed_free(languages,size); + + main_config.layouts_store = gtk_tree_store_new(4,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN); + main_config.variants_list = yon_config_load(layouts_variant_command,&main_config.variants_size); + main_config.layouts_list = yon_config_load(layouts_command,&main_config.layouts_size); + for (int i=0;iWelcomeToggle=yon_gtk_builder_get_widget(builder,"WelcomeToggle"); widgets->LicenceToggle=yon_gtk_builder_get_widget(builder,"LicenceToggle"); widgets->LocationToggle=yon_gtk_builder_get_widget(builder,"LocationToggle"); - widgets->KeyboardToggle=yon_gtk_builder_get_widget(builder,"KeyboardToggle"); widgets->SectionsToggle=yon_gtk_builder_get_widget(builder,"SectionsToggle"); widgets->UsersToggle=yon_gtk_builder_get_widget(builder,"UsersToggle"); widgets->SummaryToggle=yon_gtk_builder_get_widget(builder,"SummaryToggle"); @@ -944,7 +953,7 @@ void yon_main_window_create(main_window *widgets){ widgets->LanguagesFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LanguagesFilter")); widgets->LayoutsFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LayoutsFilter")); - widgets->LayoutList = GTK_TREE_STORE(gtk_builder_get_object(builder,"LayoutList")); + widgets->LayoutsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LayoutsList")); widgets->LanguagesTree=yon_gtk_builder_get_widget(builder,"LanguagesTree"); widgets->CountryLanguagesTree=yon_gtk_builder_get_widget(builder,"CountryLanguagesTree"); widgets->InstallerCountryList=GTK_LIST_STORE(gtk_builder_get_object(builder,"InstallerCountryList")); @@ -956,7 +965,6 @@ void yon_main_window_create(main_window *widgets){ widgets->AvailableLanguagesEntry=yon_gtk_builder_get_widget(builder,"AvailableLanguagesEntry"); widgets->AvailableLanguagesButton=yon_gtk_builder_get_widget(builder,"AvailableLanguagesButton"); widgets->LanguagesCombo=yon_gtk_builder_get_widget(builder,"LanguagesCombo"); - widgets->KeyboardModelCombo=yon_gtk_builder_get_widget(builder,"KeyboardModelCombo"); widgets->LayoutBindingCombo=yon_gtk_builder_get_widget(builder,"LayoutBindingCombo"); widgets->LayoutTree=yon_gtk_builder_get_widget(builder,"LayoutTree"); widgets->AddButton=yon_gtk_builder_get_widget(builder,"AddButton"); @@ -985,9 +993,18 @@ void yon_main_window_create(main_window *widgets){ widgets->RegionImage = yon_gtk_builder_get_widget(builder,"RegionImage"); widgets->RegionBox = yon_gtk_builder_get_widget(builder,"RegionBox"); widgets->RegionAspect = yon_gtk_builder_get_widget(builder,"RegionAspect"); - widgets->KeyboardImage = yon_gtk_builder_get_widget(builder,"KeyboardImage"); - widgets->KeyboardBox = yon_gtk_builder_get_widget(builder,"KeyboardBox"); - widgets->KeyboardLayoutChosenCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"KeyboardLayoutChosenCell")); + + widgets->KeyboardModelCombo = yon_gtk_builder_get_widget(builder,"KeyboardModelCombo"); + widgets->KeyboardDefaultLayoutsSwitch = yon_gtk_builder_get_widget(builder,"KeyboardDefaultLayoutsSwitch"); + widgets->KeyboardLayoutTree = yon_gtk_builder_get_widget(builder,"KeyboardLayoutTree"); + widgets->KeyboardLayoutMoveUpButton = yon_gtk_builder_get_widget(builder,"KeyboardLayoutMoveUpButton"); + widgets->KeyboardLayoutMoveDownButton = yon_gtk_builder_get_widget(builder,"KeyboardLayoutMoveDownButton"); + widgets->KeyboardLayoutAddButton = yon_gtk_builder_get_widget(builder,"KeyboardLayoutAddButton"); + widgets->KeyboardLayoutRemoveButton = yon_gtk_builder_get_widget(builder,"KeyboardLayoutRemoveButton"); + widgets->KeyboardLayoutChangingCombo = yon_gtk_builder_get_widget(builder,"KeyboardLayoutChangingCombo"); + widgets->KeyboardComposeSwitch = yon_gtk_builder_get_widget(builder,"KeyboardComposeSwitch"); + widgets->KeyboardScrollLockSwitch = yon_gtk_builder_get_widget(builder,"KeyboardScrollLockSwitch"); + widgets->KeyboardNumLockCombo = yon_gtk_builder_get_widget(builder,"KeyboardNumLockCombo"); widgets->AdditionalComponentsList = yon_gtk_builder_get_widget(builder,"AdditionalComponentsList"); @@ -1102,12 +1119,21 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->LocaleCell),"toggled",G_CALLBACK(on_locale_toggled),widgets); g_signal_connect(G_OBJECT(widgets->CancelInstallButton),"clicked",G_CALLBACK(on_page_cancel_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->AvailableLanguagesButton),"clicked",G_CALLBACK(on_language_clicked),widgets); g_signal_connect(G_OBJECT(widgets->RegionCombo),"changed",G_CALLBACK(on_region_changed),widgets); g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionCombo); g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->ZoneCombo); - g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_keyboard_clicked),widgets); - g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_keyboard_removed),widgets); + + g_signal_connect(G_OBJECT(widgets->KeyboardLayoutTree),"cursor-changed",G_CALLBACK(on_layout_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),"state-set",G_CALLBACK(on_layout_default_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),"state-set",G_CALLBACK(on_layout_default_sensitive_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardLayoutMoveUpButton),"clicked",G_CALLBACK(on_layout_move_up),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardLayoutMoveDownButton),"clicked",G_CALLBACK(on_layout_move_down),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardLayoutAddButton),"clicked",G_CALLBACK(on_system_layouts_add),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardLayoutRemoveButton),"clicked",G_CALLBACK(on_system_layouts_remove),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardModelCombo),"changed",G_CALLBACK(on_model_changed),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardNumLockCombo),"changed",G_CALLBACK(on_num_lock_changed),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardComposeSwitch),"state-set",G_CALLBACK(on_compose_switch),widgets); + g_signal_connect(G_OBJECT(widgets->KeyboardScrollLockSwitch),"state-set",G_CALLBACK(on_scroll_lock_switch),widgets); g_signal_connect(G_OBJECT(widgets->GrubInstallDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->GrubUpdateDevicesTree),"cursor-changed",G_CALLBACK(on_device_selection_changed),widgets); @@ -1127,7 +1153,6 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->UserAddButton),"clicked",G_CALLBACK(on_user_add),widgets); g_signal_connect(G_OBJECT(widgets->UserRootPasswordButton),"clicked",G_CALLBACK(yon_password_root_new),widgets); g_signal_connect(G_OBJECT(widgets->BootloadDefaulOSButton),"clicked",G_CALLBACK(yon_menu_window_open),widgets); - gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); g_signal_connect(G_OBJECT(widgets->LanguagesTree),"cursor-changed",G_CALLBACK(on_locale_changed),widgets); g_signal_connect(G_OBJECT(widgets->CountryLanguagesTree),"row-activated",G_CALLBACK(on_installer_language_changed),widgets); @@ -1178,7 +1203,6 @@ 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->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); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index be3bc1e..5d50692 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -39,6 +39,7 @@ #define glade_path_source "/com/ublinux/ui/ubinstall-gtk-source.glade" #define glade_path_source_element "/com/ublinux/ui/ubinstall-gtk-source-element.glade" #define glade_locales_path "/com/ublinux/ui/ubinstall-gtk-layouts.glade" +#define glade_layouts_path "/com/ublinux/ui/ubinstall-gtk-keyboard-layouts.glade" #define CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -108,6 +109,7 @@ NULL #define get_ntp_ru_command "ubconfig --default get [network] NTPSERVERS_RU" #define get_models_command "sed '/<\\/modelList>/q' /usr/share/X11/xkb/rules/base.xml | grep -E '^ {8,8}|^ {8,8}'|sed -e 's/ *//g' -e 's,,,g' -e 's/ *//g' -e 's,,,g'" +#define get_keyboard_models_command "sed -En '/^! model$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst" #define check_is_password_hash(password) system(yon_char_unite("/lib/ublinux/functions is_hash_password '", password,"'",NULL)) @@ -179,6 +181,8 @@ layout && /description:/ {\ #define lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [locale] LANG']" #define locale_parameter "AUTOINSTALL[ubconfig set [locale] LOCALE]" #define locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [locale] LOCALE']" +#define num_lock_boot_parameter "AUTOINSTALL['ubconfig set [keyboard] NUMLOCK']" +#define num_lock_boot_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [keyboard] NUMLOCK']" /*------------------------------------------------------------*/ #define part_size_parameter "AUTOINSTALL[part_size]" @@ -278,6 +282,10 @@ layout && /description:/ {\ #define get_package_info_command(target) yon_char_append("pacman -Si ",target) +#define layouts_command "sed -En '/^! layout$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst" +#define layouts_variant_command "sed -En '/^! variant$/,/^ *$/!d;s/[[:blank:]]+([^ ]+)[[:blank:]]+([^ :]+):[[:blank:]]+(.*)/\\2|\\1|\\3/p' /usr/share/X11/xkb/rules/evdev.lst" +#define grp_options_command "sed -En '/^! option$/,/^ *$/!d;s/[[:blank:]]+(grp:[^ ]+)[[:blank:]]+(.*)/\\1|\\2/p' /usr/share/X11/xkb/rules/evdev.lst" + #define install_common_parameters \ AUTOINSTALL_TYPE_INSTALL,\ AUTOINSTALL_DEVICE,\ @@ -409,6 +417,14 @@ typedef struct { unsigned int cur_slide; gboolean dry_run; + + GtkTreeStore *layouts_store; + + GtkListStore *models_list; + config_str variants_list; + int variants_size; + config_str layouts_list; + int layouts_size; } config; extern config main_config; @@ -425,7 +441,7 @@ typedef struct { GtkBuilder *builder; GtkListStore *DevicesList; GtkListStore *LanguagesList; - GtkTreeStore *LayoutList; + GtkListStore *LayoutsList; GtkListStore *PartitionsList; GtkWidget *LoadGlobalConfigurationMenuItem; @@ -452,7 +468,6 @@ typedef struct { GtkWidget *WelcomeToggle; GtkWidget *LicenceToggle; GtkWidget *LocationToggle; - GtkWidget *KeyboardToggle; GtkWidget *SectionsToggle; GtkWidget *UsersToggle; GtkWidget *SummaryToggle; @@ -469,7 +484,6 @@ typedef struct { GtkWidget *AvailableLanguagesEntry; GtkWidget *AvailableLanguagesButton; GtkWidget *LanguagesCombo; - GtkWidget *KeyboardModelCombo; GtkWidget *LayoutBindingCombo; GtkWidget *LayoutTree; GtkWidget *AddButton; @@ -510,9 +524,18 @@ typedef struct { GtkWidget *RegionImage; GtkWidget *RegionBox; GtkWidget *RegionAspect; - GtkWidget *KeyboardImage; - GtkWidget *KeyboardBox; - GtkCellRenderer *KeyboardLayoutChosenCell; + + GtkWidget *KeyboardModelCombo; + GtkWidget *KeyboardDefaultLayoutsSwitch; + GtkWidget *KeyboardLayoutTree; + GtkWidget *KeyboardLayoutMoveUpButton; + GtkWidget *KeyboardLayoutMoveDownButton; + GtkWidget *KeyboardLayoutAddButton; + GtkWidget *KeyboardLayoutRemoveButton; + GtkWidget *KeyboardLayoutChangingCombo; + GtkWidget *KeyboardComposeSwitch; + GtkWidget *KeyboardScrollLockSwitch; + GtkWidget *KeyboardNumLockCombo; GtkWidget *Notebook; GtkWidget *LicenceLabel; @@ -1030,6 +1053,21 @@ struct locales_struct { GtkListStore *list; }; +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *MainTree; + GtkWidget *CancelButton; + GtkWidget *AcceptButton; + GtkWidget *OptionsFilterCombo; + GtkWidget *OptionsEntry; + GtkCellRenderer *ChosenCell; + GtkTreeStore *list; + GtkListStore *OptionsList; + GtkTreeModel *OptionsFilter; + char *parameters; +} layouts_window; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -1204,7 +1242,6 @@ advanced_partition *yon_advanced_partition_new(); void on_advanced_part_remove(GtkWidget *self, main_window *widgets); int yon_advanced_get_part_size(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); os_row *yon_os_row_new(); void yon_quick_install(GtkWidget *, main_window *widgets); @@ -1280,4 +1317,24 @@ void on_language_default_toggled(GtkWidget *, int status, main_window *widgets); void on_locale_toggled(GtkCellRenderer *, gchar *path, main_window *widgets); void yon_language_update(main_window *widgets); int yon_language_save(main_window *widgets); -void yon_language_init(main_window *widgets); \ No newline at end of file +void yon_language_init(main_window *widgets); +void on_layouts_accept(GtkWidget *self, layouts_window *window); +void on_layouts_chosen(GtkCellRenderer *, gchar *path, layouts_window *window); +void on_system_layouts_add(GtkWidget *, main_window *widgets); +layouts_window *yon_layouts_window_new(); +void yon_layouts_add(GtkTreeView *, GtkListStore *, main_window *widgets); +void yon_layouts_remove(GtkTreeView *tree, GtkListStore *cur_list, main_window *widgets); +void on_system_layouts_remove(GtkWidget *, main_window *widgets); +config_str yon_layout_get_children(char *layout_id, int *size); +void yon_layout_load(char *layout,main_window *widgets); +void yon_layout_build(layouts_window *window); +void on_layout_move_up(GtkWidget *, main_window *widgets); +void on_layout_move_down(GtkWidget *, main_window *widgets); +void on_compose_switch(GtkWidget *,int status,main_window *widgets); +void on_scroll_lock_switch(GtkWidget *,int status,main_window *widgets); +void on_layout_default_sensitive_toggled(GtkWidget *, int status, main_window *widgets); +void on_layout_default_toggled(GtkWidget *, int status, main_window *widgets); +void on_layout_selection_changed(GtkTreeView *self,main_window *widgets); +void on_num_lock_changed(GtkComboBox *self, main_window *); +void on_model_changed(GtkComboBoxText *self, main_window *widgets); +void on_options_save(GtkWidget *,main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index a9931c5..76ad8b1 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -42,7 +42,6 @@ NULL) #define ZONE_LABEL _("Zone:") #define LANGUAGE_LABEL _("Language:") #define KEYBOARD_MODEL_LABEL _("Keyboard model:") -#define LAYOUT_CHANGING_LABEL _("Layout changing:") #define DEFAUL_LAYOUT_LABEL _("Default layout (ru)") #define DEFINE_LABEL _("Define") #define SETTINGS_LABEL _("Settings") @@ -233,8 +232,43 @@ NULL) #define PACKAGE_NOT_FOUND_LABEL _("Package were not found") #define PACKAGE_INFO_LABEL _("Package information") #define LICENCE_AGREE_LABEL _("Yes, I agree to the License Agreement") -#define LICENCE_DISAGREE_LABEL _("No, i do not agree") +#define LICENCE_DISAGREE_LABEL _("No, I do not agree") #define ADD_LANGUAGE_TITLE_LABEL _("Add locales") +#define LAYOUT_REMOVE_LABEL _("Are you sure you want to remove current layout?") +#define LAYOUT_REMOVE_TITLE_LABEL _("Layout deletion") +#define MANUAL_LABEL _("Manual input:") +#define MODEL_LABEL _("Keyboard model:") + +#define KEYBOARD_LAYOUTS_LABEL _("Keyboard layouts:") + +#define MOVE_UP_LABEL _("Move layout up") +#define MOVE_DOWN_LABEL _("Move layout down") +#define ADD_LABEL _("Add layout") +#define REMOVE_LABEL _("Remove layout") + +#define KEYBOARD_MODEL_LABEL _("Keyboard model:") +#define LAYOUTS_LABEL _("Layouts:") +#define DEFAULT_LAYOUT_LABEL _("Default layout") +#define LAYOUT_CHANGING_LABEL _("Changing the layout:") +#define SET_COMPOSE_LABEL _("Set Compose (Multi_Key) to the right Win key") +#define SCROLL_LOCK_LABEL _("Scroll Lock indication when switching layouts") +#define NUMLOCK_LABEL _("NumLock:") +#define KEYBOARD_LAYOUT_LABEL _("Keyboard layout") +#define DESIGNATION_LABEL _("Designation") +#define VARIANT_LABEL _("Variant") +#define NAME_LABEL _("Name") +#define DESCRIPTION_LABEL _("Description") +#define OPTIONS_LABEL _("Options:") +#define MANUAL_LABEL _("Manual input:") +#define KEYBOARD_TITLE_INFO_LABEL _("Specify your preferred keyboard settings") +#define AVAILABLE_LOCALES_LABEL _("Available locales in the system:") +#define SYSTEM_LOCALE_LABEL _("System locale") +#define LOCALE_LABEL _("Locale") +#define LOCALE_LANGUAGE_LABEL _("Language") +#define TERRITORY_LABEL _("Territory") +#define LANGUAGE_TITLE_INFO_LABEL _("Specify your preferred system languages") +#define REMOVE_LOCALE_TOOLTIP_LABEL _("Remove locale") + // #define _LABEL _("Package:") // #define _LABEL _("Module:") // #define _LABEL _("New section at") diff --git a/ubinstall-gtk-keyboard-layouts.glade b/ubinstall-gtk-keyboard-layouts.glade new file mode 100644 index 0000000..7a0cb5a --- /dev/null +++ b/ubinstall-gtk-keyboard-layouts.glade @@ -0,0 +1,123 @@ + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.accept-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.cancel-uncolored-symbolic + + + 450 + 550 + True + False + com.ublinux.ubl-settings-keyboard + + + True + True + in + + + True + True + False + 1 + + + column + + + + 3 + + + + + + + column + 0 + + + + 2 + + + + + + + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 2 + Keyboard + + + + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 32 + com.ublinux.ubl-settings-keyboard + + + + + Cancel + True + True + True + image2 + + + 1 + + + + + Accept + True + True + True + image1 + + + end + 2 + + + + + + + diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 835983a..4ec67a7 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -121,23 +121,16 @@ LanguagesList - + - + + + - - - - - - - - LayoutList - True @@ -252,12 +245,12 @@ True False - com.ublinux.libublsettingsui-gtk3.increase-symbolic + com.ublinux.libublsettingsui-gtk3.pan-up True False - com.ublinux.libublsettingsui-gtk3.trash-symbolic + com.ublinux.libublsettingsui-gtk3.pan-down True @@ -349,6 +342,16 @@ False com.ublinux.libublsettingsui-gtk3.trash-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.increase-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.trash-symbolic + True False @@ -777,6 +780,7 @@ agreement 5 5 left + False True @@ -1169,7 +1173,7 @@ agreement - No, i do not agree + No, I do not agree True True False @@ -3634,6 +3638,110 @@ agreement False vertical 5 + + + True + False + vertical + 5 + + + True + False + 10 + 10 + 10 + 10 + 5 + + + True + False + 48 + com.ublinux.ubinstall-gtk + 0 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Language + True + 0 + + + + + + + + + False + True + 0 + + + + + True + False + Specify your preferred system languages + center + True + 0 + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + False + True + -1 + + + + + True + False + + + False + True + 1 + + + + + False + True + 0 + + True @@ -3678,7 +3786,7 @@ agreement False True - 0 + 1 @@ -3698,6 +3806,9 @@ agreement True LanguageList 0 + + + System locale @@ -3767,7 +3878,7 @@ agreement True True True - Add locale + Add locales image29 + + + False + True + 0 + + + + + True + False + True + True + Move layout down + image14 + + + + False + True + 1 + + + + + True + False + True + True + Add layout + image31 + + + + False + True + 2 + + + + + True + False + True + True + Remove layout + image32 + + + + False + True + 3 + + + + + False + True + 1 + + + True + True + 1 + + + True + True + 1 + True True - 0 + 1 True False - vertical 5 - + True - True - True - Add layouts - image13 - + False + Changing the layout: + 1 False @@ -4177,15 +4341,120 @@ agreement - + True - True - True - Remove layout - image14 - + False + + Default + + + + True + True + 1 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + False + start + 1 + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Set Compose (Multi_Key) to the right Win key + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + + + False + True + 0 + + + + + True + False + Scroll Lock indication when switching layouts + + + False + True + 1 + + + + + False + True + 1 + + False @@ -4197,14 +4466,56 @@ agreement False True - 1 + 4 + + + + + True + False + 5 + + + True + False + NumLock: + 1 + + + False + True + 0 + + + + + True + False + 0 + + Default + On + Off + + + + True + True + 1 + + + + + False + True + 6 False True - 4 + 1 -- 2.35.1 From 85084cd9134980e687fc6ced32e06ec230864d7f Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Fri, 12 Dec 2025 18:36:45 +0000 Subject: [PATCH 8/8] Next to system install mode fixes --- locale/ubinstall-gtk.pot | 8 + locale/ubinstall-gtk_ru.po | 10 +- source/ubinstall-gtk-advanced.c | 2 +- source/ubinstall-gtk-installation.c | 6 +- source/ubinstall-gtk-saving.c | 429 ++-------------------------- source/ubinstall-gtk.h | 2 +- source/ubl-strings.h | 1 + ubinstall-gtk.glade | 8 +- 8 files changed, 50 insertions(+), 416 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 608a5bb..cb0e8ea 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -1302,4 +1302,12 @@ msgstr "" #: source/ubl-strings.h:20 msgid "Remove locale" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "New partition:" +msgstr "" + +#: source/ubl-strings.h:20 +msgid "Attention! The selected partition will be reduced and the next new partition will be created. The data will be saved in the selected partition. The new partition will be formatted." msgstr "" \ No newline at end of file diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index c690083..d7393e2 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -3144,4 +3144,12 @@ msgstr "Укажите предпочитаемый язык системы" #: source/ubl-strings.h:20 msgid "Remove locale" -msgstr "Удалить локаль" \ No newline at end of file +msgstr "Удалить локаль" + +#: source/ubl-strings.h:20 +msgid "New partition:" +msgstr "Новый раздел:" + +#: source/ubl-strings.h:20 +msgid "Attention! The selected partition will be reduced and the next new partition will be created. The data will be saved in the selected partition. The new partition will be formatted." +msgstr "Внимание! Выбранный раздел будет уменьшен и будет создан следующий новый раздел. На выбранном разделе данные будут сохранены. Новый раздел будет отформатирован." \ No newline at end of file diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index 2d87075..b5b4a89 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -119,7 +119,7 @@ void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_ gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1); if (section->size){ 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_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),yon_get_size_get_from_letter(section->size_letter)-1); } if (section->part_label){ gtk_entry_set_text(GTK_ENTRY(part->PartLabelEntry),section->part_label); diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 802b662..ac6c95c 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -535,7 +535,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ gtk_combo_box_set_active(GTK_COMBO_BOX(partition_encryption_combo),0); } char *format = config(part_format_parameter); - if ((!yon_char_is_empty(format)&&!strcmp(format,"yes"))||format_switch==widgets->CommonFormatSwitch){ + if ((!yon_char_is_empty(format)&&!strcmp(format,"yes"))||!gtk_widget_get_sensitive(format_switch)){ gtk_switch_set_active(GTK_SWITCH(format_switch),1); if (device_label){ char *parameter = config(part_label_parameter); @@ -550,7 +550,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ char *parameter = config(part_size_parameter); if (!yon_char_is_empty(parameter)){ gtk_spin_button_set_value(GTK_SPIN_BUTTON(partition_size_spin),atol(parameter)); - gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])); + gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])-1); } else { gtk_spin_button_set_value(GTK_SPIN_BUTTON(partition_size_spin),0); gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),0); @@ -586,7 +586,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ gtk_entry_set_text(GTK_ENTRY(partition_encryption_entry),""); } } - } else { + } else if (gtk_widget_get_sensitive(format_switch)){ gtk_switch_set_active(GTK_SWITCH(format_switch),0); } } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 78c8281..165605a 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -1,52 +1,33 @@ #include "ubinstall-gtk.h" - - -// void _yon_saving_threaded(char *final_command){ -// FILE *file = popen(final_command,"r"); -// int file_save; -// config_str file_return = yon_config_load_file(file,&file_save); -// pclose(file); -// file_return = yon_char_parsed_append(file_return,&file_save,final_command); -// char *result = yon_char_parsed_to_string(file_return,file_save,""); -// yon_debug_output("%s\n",result); -// yon_char_parsed_free(file_return,file_save); -// free(result); -// } - void yon_config_save_proceed(char *path, YON_CONFIG_TYPE type){ yon_debug_output("%s\n",yon_config_save_simple(type,path)); } - -void yon_load_proceed(YON_CONFIG_TYPE type){ + +void yon_load_proceed(YON_CONFIG_TYPE type){ if (type!=YON_CONFIG_CUSTOM){ yon_config_clean(); - yon_config_load_config(YON_CONFIG_DEFAULT,yon_config_get_command(main_config.config_load_path),NULL); } - if (type==YON_CONFIG_GLOBAL){ - yon_config_load_config(type,yon_config_get_command(main_config.config_load_path),NULL); - } else if (type==YON_CONFIG_LOCAL){ - yon_config_load_config(type,yon_config_get_command(main_config.config_load_path),NULL); - } else if (type==YON_CONFIG_CUSTOM){ - textdomain(template_ui_LocaleName); - GtkWidget *dialog = yon_config_save_window_new(); - textdomain(LocaleName); - int response = gtk_dialog_run(GTK_DIALOG(dialog)); - if (response == GTK_RESPONSE_ACCEPT){ - char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - if (!yon_char_is_empty(file)){ - main_config.config_load_path=yon_char_new(file); + if (!yon_char_is_empty(config_get_default_command)) + yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); + switch (type){ + case YON_CONFIG_GLOBAL: + yon_config_load_config(type,config_get_command("global"),NULL); + break; + case YON_CONFIG_LOCAL: + yon_config_load_config(type,config_get_command("system"),NULL); + break; + case YON_CONFIG_CUSTOM: + char *path = NULL; + path=yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_OPEN); + if (!yon_char_is_empty(path)){ yon_config_clean(); - if (!yon_char_is_empty(config_get_default_command)) - yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); - char *command = yon_config_get_command(main_config.config_load_path); - yon_config_load_config(type,command,NULL); - } - gtk_widget_destroy(dialog); - } else { - gtk_widget_destroy(dialog); - } - } + yon_config_load_config(type,config_get_command(path),NULL); + } + break; + default: + break; + } } void on_config_local_load(GtkWidget *,main_window *widgets){ @@ -83,7 +64,7 @@ void on_config_custom_load_last(GtkWidget *,main_window *widgets){ yon_config_clean(); if (!yon_char_is_empty(config_get_default_command)) yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); - char *command = yon_config_get_command(main_config.config_load_path); + char *command = config_get_command(main_config.config_load_path); yon_config_load_config(YON_CONFIG_CUSTOM,command,NULL); yon_page_init(widgets,gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook))); main_config.load_mode=YON_CONFIG_CUSTOM; @@ -106,372 +87,6 @@ void on_config_global_save(GtkWidget *,main_window *widgets){ } -// void on_config_custom_save(GtkWidget *, main_window *widgets){ -// char *path = NULL; -// GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,SAVE_LABEL,GTK_RESPONSE_ACCEPT,NULL); -// textdomain(TITLE_LABEL); -// GtkFileFilter *filter = gtk_file_filter_new(); -// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); -// gtk_file_filter_add_pattern(filter,"*.ini"); -// gtk_file_filter_set_name(filter, "*.ini"); -// gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); -// int response = gtk_dialog_run(GTK_DIALOG(dialog)); -// if (response == GTK_RESPONSE_ACCEPT){ -// char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); -// if (!yon_char_is_empty(file)){ -// if (!strstr(file,".ini")) file = yon_char_append(file,".ini"); -// if (access(file,0)!=F_OK){ -// char *command_creation = ubconfig_file_create(file); -// int a = system(yon_debug_output("%s\n",command_creation)); -// if (access(file,0)!=F_OK||a){ -// yon_ubl_status_box_render(CUSTOM_CONFIG_CREATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); -// return; -// } -// } -// } -// path = yon_char_unite("'",file,"'",NULL); -// free(file); -// gtk_widget_destroy(dialog); -// } else { -// gtk_widget_destroy(dialog); -// return; -// } -// yon_save_proceed(path,YON_CONFIG_CUSTOM); -// if (path) free(path); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// } -// -// void yon_open_browser(GtkWidget *, char *link); -// void yon_open_browser(GtkWidget *, char *link){ -// GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); -// if (window) -// gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); -// } - -// void yon_interface_update(main_window *widgets){ -// if (widgets){}; -// enum YON_PAGES page=YON_PAGE_COMPLETED; -// char *type = config(AUTOINSTALL_TYPE_INSTALL); -// if (!yon_char_is_empty(type)){ -// if (!strcmp(type,"fast")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio),1); -// page = YON_PAGE_INSTALL_COMMON; -// } else if (!strcmp(type,"next")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationNearRadio),1); -// page = YON_PAGE_INSTALL_SEPARATE; -// } else if (!strcmp(type,"part")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationLinuxRadio),1); -// page = YON_PAGE_INSTALL_SAME_PARTITION; -// } else if (!strcmp(type,"grub_install")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubInstallRadio),1); -// page = YON_PAGE_OPTIONS_GRUB_INSTALL; -// } else if (!strcmp(type,"grub_update")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->GrubUpdateRadio),1); -// page = YON_PAGE_OPTIONS_GRUB_UPDATE; -// } else if (!strcmp(type,"system_only")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OSRadio),1); -// page = YON_PAGE_OPTIONS_OS_ONLY; -// } else if (!strcmp(type,"data_only")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserDataOnlyRadio),1); -// page = YON_PAGE_OPTIONS_USRDATA_ONLY; -// } else if (!strcmp(type,"custom")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio),1); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SeparateRadio),1); -// page = YON_PAGE_OPTIONS_SEPARATE; -// } -// } -// char *device = config(AUTOINSTALL_DEVICE); -// char *part = NULL; -// if (page!=YON_PAGE_INSTALL_COMMON) -// part = config(part_parameter); -// char *fs_type = config(part_fs_type_parameter); -// char *device_label = config(device_label_parameter); -// char *format = config(part_format_parameter); -// char *part_size = config(part_size_parameter); -// GtkListStore *device_list = widgets->DevicesList; -// GtkListStore *part_list=widgets->PartitionsList; -// GtkWidget *device_tree=NULL; -// GtkWidget *part_tree=NULL; -// switch (page){ -// case YON_PAGE_INSTALL_COMMON:{ -// device_tree = widgets->CommonInstallationDevicesTree; -// } break; -// -// case YON_PAGE_INSTALL_SEPARATE:{ -// device_tree = widgets->NextInstallationSysDevicesTree; -// part_tree = widgets->NextInstallationSysSectionTree; -// if (!yon_char_is_empty(part_size)){ -// gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),atof(part_size)); -// if (part_size[strlen(part_size)-1]=='M') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),0); -// if (part_size[strlen(part_size)-1]=='G') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),1); -// if (part_size[strlen(part_size)-1]=='T') gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),2); -// } -// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),1); -// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck),main_config.format_default); -// if (!yon_char_is_empty(fs_type)) -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->NextInstallationFilesystemTypeCombo),fs_type); -// if (device_label) -// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),device_label); -// else -// gtk_entry_set_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry),""); -// -// } break; -// -// case YON_PAGE_INSTALL_SAME_PARTITION:{ -// device_tree = widgets->SamePlaceDeviceTree; -// part_tree = widgets->SamePlacePartTree; -// if (!yon_char_is_empty(fs_type)) -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->SameInstallationFilesystemTypeCombo),fs_type); -// if (format&&!strcmp(format,"yes")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),1); -// else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameInstallationFormatCheck),main_config.format_default); -// if (device_label) -// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),device_label); -// else -// gtk_entry_set_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry),""); -// -// } break; -// case YON_PAGE_OPTIONS_GRUB_INSTALL:{ -// device_tree = widgets->GrubInstallDevicesTree; -// } break; -// -// case YON_PAGE_OPTIONS_GRUB_UPDATE:{ -// device_tree = widgets->GrubUpdateDevicesTree; -// } break; -// -// case YON_PAGE_OPTIONS_SEPARATE:{ -// GtkTreeIter iter; -// device_tree = widgets->SeparateDevicesTree; -// part_tree = widgets->SeparateSysSectionTree; -// for_iter(GTK_TREE_MODEL(device_list),&iter){ -// char *cur_device; -// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_device,-1); -// if (!strcmp(cur_device,device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); -// break; -// } -// } -// on_near_installation_device_changed(device_tree,widgets); -// for_iter(GTK_TREE_MODEL(part_list),&iter){ -// char *cur_part; -// gtk_tree_model_get(GTK_TREE_MODEL(device_list),&iter, 0,&cur_part,-1); -// if (!strcmp(cur_part,part)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); -// } -// } -// } break; -// -// case YON_PAGE_OPTIONS_OS_ONLY:{ -// device_tree = widgets->OSDevicesTree; -// part_tree = widgets->OSSysSectionTree; -// } break; -// -// case YON_PAGE_OPTIONS_USRDATA_ONLY:{ -// device_tree = widgets->UserdataDevicesTree; -// part_tree = widgets->UserdataSysSectionTree; -// } break; -// -// default:{}break; -// } -// GtkTreeIter iter; -// char *cur_device=""; -// if (page!=YON_PAGE_OPTIONS_SEPARATE && !yon_char_is_empty(device)){ -// for_iter (widgets->DevicesList,&iter){ -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&cur_device,-1); -// if (!strcmp(device,cur_device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(device_tree)),&iter); -// break; -// } -// } -// on_near_installation_device_changed(device_tree,widgets); -// if (!yon_char_is_empty(part)){ -// for_iter (widgets->PartitionsList,&iter){ -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&part,-1); -// if (!strcmp(device,cur_device)){ -// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(part_tree)),&iter); -// break; -// } -// } -// } -// } -// char *system_locale = config(locale_parameter); -// if (!yon_char_is_empty(system_locale)){ -// char *chosen_langs = ""; -// for_iter(widgets->LanguagesList,&iter){ -// char *cur=NULL, *render = NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,1,&render,2,&cur,-1); -// if (strstr(system_locale,cur)){ -// gtk_list_store_set((widgets->LanguagesList),&iter,0,1,-1); -// chosen_langs = yon_char_unite(chosen_langs,!yon_char_is_empty(chosen_langs)?";":"",render,NULL); -// } else { -// gtk_list_store_set((widgets->LanguagesList),&iter,0,0,-1); -// } -// } -// if (!yon_char_is_empty(chosen_langs)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),chosen_langs); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),1); -// free(chosen_langs); -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); -// } -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0); -// int langsize; -// config_str lang = default_langs(&langsize); -// for_iter(widgets->LanguagesList,&iter){ -// char *cur=NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LanguagesList),&iter,2,&cur,-1); -// if (lang&&yon_char_parsed_check_exist(lang,langsize,cur)>-1){ -// gtk_list_store_set(widgets->LanguagesList,&iter,0,1,-1); -// } else { -// gtk_list_store_set(widgets->LanguagesList,&iter,0,0,-1); -// } -// if (cur) free(cur); -// } -// if (langsize) yon_char_parsed_free(lang,langsize); -// } -// char *zone = config(zone_parameter); -// char *region = NULL; -// -// if (!yon_char_is_empty(zone)) region = yon_char_divide_search(zone,"/",-1); else {gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveSwitch),0);} -// if (!yon_char_is_empty(region)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),region); -// } else { -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->RegionCombo),"Europe"); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveSwitch),0); -// } -// if (!yon_char_is_empty(zone)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),zone); -// } else { -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->ZoneCombo),"Moscow"); -// } -// char *language = config(lang_parameter); -// if (!yon_char_is_empty(language)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LanguageCombo),language); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LanguageCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0); -// } -// char *kbmodel = config (xkbmodel_parameter); -// char *optinos = config(xkboptions_parameter); -// char *layout = config(xkblayout_parameter); -// if (!yon_char_is_empty(kbmodel)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo),kbmodel); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0); -// -// } -// if (!yon_char_is_empty(optinos)){ -// gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo),optinos); -// } else { -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0); -// } -// if (!yon_char_is_empty(layout)){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio),1); -// for_iter(widgets->LayoutList,&iter){ -// char *cur=NULL; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&cur,-1); -// if (strstr(layout,cur)){ -// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); -// } else { -// gtk_tree_store_set(widgets->LayoutList,&iter,3,0,-1); -// } -// } -// } else { -// for_iter(widgets->LayoutList,&iter){ -// char *id; -// gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&iter,0,&id,-1); -// if (!strcmp(id,"ru")||!strcmp(id,"us")){ -// gtk_tree_store_set(widgets->LayoutList,&iter,3,1,-1); -// } else { -// gtk_tree_store_set((widgets->LayoutList),&iter,3,0,-1); -// } -// } -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0); -// } -// char *user_name = config(user_name_parameter); -// char *user_gecos = config(user_gecos_parameter); -// char *user_password = config(user_password_parameter); -// char *root_password = config(root_password_parameter); -// char *autologin = config(autologin_parameter); -// char *hostname = config(hostname_parameter); -// if (!yon_char_is_empty(user_name)){ -// if (!strcmp(user_name,"root")){ -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserRootOnlyCheck),1); -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootLoginEntry),user_name); -// } -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootLoginEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0); -// } -// if (!yon_char_is_empty(user_gecos)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootNameEntry),_(user_gecos)); -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootNameEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0); -// } -// int def_size=0; -// config_str default_password = NULL; -// if (!getuid()){ -// default_password = yon_config_load(yon_debug_output("%s\n",get_default_password_command), &def_size); -// if (def_size>0&&default_password){ -// yon_char_remove_last_symbol(default_password[0],'\n'); -// } -// } -// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0); -// -// } else if (!yon_char_is_empty(user_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),user_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); -// } -// if ((def_size>0&&!strcmp(default_password[0],user_password))||yon_char_is_empty(user_password)){ -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),0); -// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0); -// -// } else if (!yon_char_is_empty(root_password)){ -// gtk_entry_set_text(GTK_ENTRY(widgets->AdminPasswordEntry),root_password); -// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo),1); -// } -// if (!yon_char_is_empty(autologin)){ -// if (!strcmp(autologin,"yes")) -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),1); -// else -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),0); -// } else { -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UserAutologinSwitch),main_config.autologin_default); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0); -// } -// if (!yon_char_is_empty(hostname)){ -// if (strcmp(hostname,"auto")){ -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1); -// } else{ -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); -// } -// } else { -// gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); -// g_signal_handlers_block_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); -// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->AutoHostnameCheck),on_autohostname_check,widgets); -// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0); -// } -// } - gboolean on_install_success(main_window *widgets){ gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 5d50692..71d3ee1 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -267,7 +267,7 @@ layout && /description:/ {\ #define full_log_path "/var/log/ubinstall.log" -#define yon_config_get_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[*]",NULL) +#define config_get_command(target) yon_char_unite("ubconfig --source ",target," --conarg get [autoinstall] AUTOINSTALL[*]",NULL) #define config_get_default_command "ubconfig --source default --conarg get [autoinstall] AUTOINSTALL[*]" diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 76ad8b1..24c2978 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -268,6 +268,7 @@ NULL) #define TERRITORY_LABEL _("Territory") #define LANGUAGE_TITLE_INFO_LABEL _("Specify your preferred system languages") #define REMOVE_LOCALE_TOOLTIP_LABEL _("Remove locale") +#define NEW_PARTITION_LABEL _("New partition:") // #define _LABEL _("Package:") // #define _LABEL _("Module:") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 4ec67a7..5c7c0fc 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -780,7 +780,6 @@ agreement 5 5 left - False True @@ -8307,7 +8306,7 @@ or continue working in the environment, booted from the Live image. True False - <b>Attention!</b> The system will be installed in the selected partition. If you do not change the FS type or format, all data on the partition will be saved. + <b>Attention!</b> The selected partition will be reduced and the next new partition will be created. The data will be saved in the selected partition. The new partition will be formatted. True True 0 @@ -8599,7 +8598,7 @@ or continue working in the environment, booted from the Live image. True False - Partition: + New partition: 0 @@ -8635,7 +8634,9 @@ or continue working in the environment, booted from the Live image. True + False True + True False @@ -8683,6 +8684,7 @@ or continue working in the environment, booted from the Live image. True False + True True -- 2.35.1