From 01ddf4b4d04fbfa6c888c0fbe1038f85578949ca Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Tue, 3 Feb 2026 11:10:35 +0600 Subject: [PATCH] WIP format switch replaced with combo box for advanced installation; Localisation fixes --- locale/ubinstall-gtk.pot | 12 ++++++++++ locale/ubinstall-gtk_ru.po | 12 ++++++++++ source/ubinstall-gtk-advanced.c | 36 +++++++++++++++++++++-------- source/ubinstall-gtk-installation.c | 11 +++++++-- source/ubinstall-gtk.h | 4 ++-- source/ubl-strings.h | 3 +++ ubinstall-gtk-advanced-box.glade | 21 +++++++++-------- 7 files changed, 77 insertions(+), 22 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index aee69ee..086cf87 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -262,6 +262,10 @@ msgstr "" msgid "Mb" msgstr "" +#: source/ubl-strings.h:68 +msgid "Kb" +msgstr "" + #: source/ubl-strings.h:69 msgid "Available languages in the system:" msgstr "" @@ -1816,6 +1820,14 @@ msgstr "" msgid "Shudown" msgstr "" +#: source/ubl-strings.h:543 +msgid "Do not format" +msgstr "" + +#: source/ubl-strings.h:543 +msgid "Format automatically" +msgstr "" + #: source/ubl-strings.h:543 msgid "After successful installation:" msgstr "" diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 0fabaf8..8c34c66 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -273,6 +273,10 @@ msgstr "Гб" msgid "Mb" msgstr "Мб" +#: source/ubl-strings.h:68 +msgid "Kb" +msgstr "Кб" + #: source/ubl-strings.h:69 msgid "Available languages in the system:" msgstr "Доступные языки в системе:" @@ -1821,6 +1825,14 @@ msgstr "Перезагрузить" msgid "Shudown" msgstr "Выключить" +#: source/ubl-strings.h:543 +msgid "Do not format" +msgstr "Не форматировать" + +#: source/ubl-strings.h:543 +msgid "Format automatically" +msgstr "Форматировать автоматически" + #: source/ubl-strings.h:543 msgid "After successful installation:" msgstr "После успешной установки:" diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index b5b4a89..da26162 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -116,7 +116,7 @@ void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_ if (!yon_char_is_empty(part->part)) part->part_type = ADVANCED_PART_NEW; else part->part_type = ADVANCED_PART_EXISTING; if (section->format){ - gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1); + gtk_switch_set_active(GTK_SWITCH(part->FormatCombo),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)-1); @@ -692,8 +692,11 @@ void yon_advanced_part_parameter_changed(GtkWidget *self, advanced_partition *pa } else if (self == part->EncryptionCombo||self == part->EncryptionEntry){ section->encryption = yon_char_new(gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->EncryptionCombo))); section->encryption_password = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->EncryptionEntry))); - } else if (self == part->FormatSwitch){ - if (gtk_switch_get_active(GTK_SWITCH(part->FormatSwitch))){ + } else if (self == part->FormatCombo){ + int format_active = gtk_combo_box_get_active(GTK_COMBO_BOX(part->FormatCombo)); + if (format_active == 2){ + section->format=2; + } else if (format_active == 1){ section->format=1; } else { section->format=0; @@ -701,9 +704,15 @@ void yon_advanced_part_parameter_changed(GtkWidget *self, advanced_partition *pa } } -gboolean on_format_changed(GtkWidget *self, gboolean , advanced_partition *part){ +void on_format_changed(GtkWidget *self, advanced_partition *part){ + int active = gtk_combo_box_get_active(GTK_COMBO_BOX(self)); + switch (active){ + case 0: + case 1: gtk_revealer_set_reveal_child(GTK_REVEALER(part->FormatRevealer),0); + break; + case 2: gtk_revealer_set_reveal_child(GTK_REVEALER(part->FormatRevealer),1); + } yon_advanced_part_parameter_changed(self, part); - return 0; } advanced_partition *yon_advanced_partition_new(){ @@ -714,7 +723,7 @@ advanced_partition *yon_advanced_partition_new(){ part->SystemSectionToggle = yon_gtk_builder_get_widget(builder,"SystemSectionToggle"); part->UserDataSectionToggle = yon_gtk_builder_get_widget(builder,"UserDataSectionToggle"); part->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); - part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch"); + part->FormatCombo = yon_gtk_builder_get_widget(builder,"FormatCombo"); part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin"); part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo"); part->PartLabelEntry = yon_gtk_builder_get_widget(builder,"PartLabelEntry"); @@ -728,12 +737,22 @@ advanced_partition *yon_advanced_partition_new(){ part->part = NULL; part->device = NULL; - yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(part->SizeCombo),"K",_("Kb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(part->SizeCombo),"M",_("Mb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(part->SizeCombo),"G",_("Gb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(part->SizeCombo),"T",_("Tb")); + gtk_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),0); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(part->FormatCombo),DO_NOT_FORMAT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(part->FormatCombo),AUTOMATIC_FORMAT_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(part->FormatCombo),FORMAT_LABEL); + gtk_combo_box_set_active(GTK_COMBO_BOX(part->FormatCombo),0); + g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionButton); g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionEntry); g_signal_connect(G_OBJECT(part->EncryptionEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); - g_signal_connect(G_OBJECT(part->FormatSwitch),"state-set",G_CALLBACK(on_format_changed),part); + g_signal_connect(G_OBJECT(part->FormatCombo),"changed",G_CALLBACK(on_format_changed),part); g_signal_connect(G_OBJECT(part->SizeCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); g_signal_connect(G_OBJECT(part->SizeSpin),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); g_signal_connect(G_OBJECT(part->PartLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); @@ -741,7 +760,6 @@ advanced_partition *yon_advanced_partition_new(){ g_signal_connect(G_OBJECT(part->FileSystemLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part); - yon_fs_type_setup(GTK_COMBO_BOX_TEXT(part->FileSystemTypeCombo)); g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 4c3e8c9..3eb2b5e 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -184,8 +184,8 @@ int yon_advanced_sections_save(dictionary *dict){ char *part = yon_char_unite(part_first,last_section?",":NULL,part_last,NULL); yon_config_register(part_parameter,part_parameter_command,part); - char * format_first = gtk_switch_get_active(GTK_SWITCH(first_section->FormatSwitch))?"yes":"no"; - char * format_last = last_section?gtk_switch_get_active(GTK_SWITCH(last_section->FormatSwitch))?"yes":"no":NULL; + char * format_first = gtk_switch_get_active(GTK_SWITCH(first_section->FormatCombo))?"yes":"no"; + char * format_last = last_section?gtk_switch_get_active(GTK_SWITCH(last_section->FormatCombo))?"yes":"no":NULL; char *format = yon_char_unite(format_first,part_last?",":NULL,format_last,NULL); yon_config_register(part_format_parameter,part_format_parameter_command,format); @@ -512,6 +512,13 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){ } if (partition_size_spin&&partition_size_combo){ + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(partition_size_combo)); + + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(partition_size_combo),"K",_("Kb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(partition_size_combo),"M",_("Mb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(partition_size_combo),"G",_("Gb")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(partition_size_combo),"T",_("Tb")); + gtk_combo_box_set_active(GTK_COMBO_BOX(partition_size_combo),0); 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)); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 37aa815..3810a6c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -790,7 +790,7 @@ typedef struct GtkWidget *SystemSectionToggle; GtkWidget *UserDataSectionToggle; GtkWidget *RemoveButton; - GtkWidget *FormatSwitch; + GtkWidget *FormatCombo; GtkWidget *FormatRevealer; GtkWidget *SizeSpin; GtkWidget *SizeCombo; @@ -1385,7 +1385,7 @@ int yon_advanced_section_get_by_part(advanced_partition *part); void yon_advanced_section_remove_by_name(char *part); void on_advanced_virtual_device_changed(GtkWidget *, main_window *widgets); int yon_advanced_section_append(advanced_section *section); -gboolean on_format_changed(GtkWidget *self, gboolean state, advanced_partition *part); +void on_format_changed(GtkWidget *self, advanced_partition *part); int yon_layouts_get(); void on_link(GtkWidget *self, char *uri, gpointer); void on_source_changed(GtkComboBox *self); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index d7a6507..ef9fe21 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -62,6 +62,7 @@ NULL) #define TB_LABEL _("Tb") #define GB_LABEL _("Gb") #define MB_LABEL _("Mb") +#define KB_LABEL _("Kb") #define AVALIABLE_LANGUAGES_LABEL _("Available languages in the system:") #define AVALIABLE_LANGUAGES_TITLE_LABEL _("Available languages in the system") @@ -99,6 +100,8 @@ NULL) #define RESTART_LABEL _("Restart PC") #define CHOOSE_LABEL _("Choose file system type for the section:") #define SECTION_NAME_LABEL _("Section name:") +#define DO_NOT_FORMAT_LABEL _("Do not format") +#define AUTOMATIC_FORMAT_LABEL _("Format automatically") #define FORMAT_LABEL _("Format") #define INSTALL_SUCCESS_LABEL _("You have system installed on your computer.\nYou can reboot and use your new system\nor continue working in the system Live environment.") diff --git a/ubinstall-gtk-advanced-box.glade b/ubinstall-gtk-advanced-box.glade index 3ab7989..2969f01 100644 --- a/ubinstall-gtk-advanced-box.glade +++ b/ubinstall-gtk-advanced-box.glade @@ -138,7 +138,6 @@ 5 - True True @@ -148,10 +147,9 @@ - + True False - Format False @@ -159,6 +157,17 @@ 1 + + + False + Format + + + False + True + 2 + + False @@ -227,12 +236,6 @@ True False 0 - - Kb - Mb - Gb - Tb - False