From b9ea1beef6955f0aa38595b6319a4ba33dfa64a4 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 5 Feb 2026 18:44:58 +0600 Subject: [PATCH] Region changes --- locale/ubinstall-gtk.pot | 6 +-- locale/ubinstall-gtk_ru.po | 12 ++--- source/ubinstall-gtk-decorations.c | 74 +++++++++++++++++++++++++++++ source/ubinstall-gtk-installation.c | 18 ++++++- source/ubinstall-gtk-region.c | 68 ++++++++++++++++---------- source/ubinstall-gtk-ui-lang.c | 9 +--- source/ubinstall-gtk.c | 3 ++ source/ubinstall-gtk.h | 6 +-- source/ubl-strings.h | 10 ++-- ubinstall-gtk.glade | 10 ++-- 10 files changed, 159 insertions(+), 57 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index c244c5a..7ba8133 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -360,7 +360,7 @@ msgid "GRUB install" msgstr "" #: source/ubl-strings.h:81 -msgid "Install the GRUB bootloader" +msgid "Installing the GRUB bootloader into the MBR or EFI partition" msgstr "" #: source/ubl-strings.h:82 @@ -380,11 +380,11 @@ msgid "Installing OS components and user data on different disk partitions" msgstr "" #: source/ubl-strings.h:86 -msgid "OS only" +msgid "System restore" msgstr "" #: source/ubl-strings.h:87 -msgid "Installing only OS components without user data" +msgid "Restore missing or corrupted system files. Users data is not affected" msgstr "" #: source/ubl-strings.h:88 diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index 67445d7..d2bb0f5 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -372,8 +372,8 @@ msgid "GRUB install" msgstr "Установка GRUB" #: source/ubl-strings.h:81 -msgid "Install the GRUB bootloader" -msgstr "Установить загрузчик GRUB" +msgid "Installing the GRUB bootloader into the MBR or EFI partition" +msgstr "Установка загрузчика GRUB в MBR или EFI-партицию" #: source/ubl-strings.h:82 msgid "GRUB update" @@ -393,12 +393,12 @@ msgstr "" "Установка компонентов ОС и пользовательских данных на разные разделы диска" #: source/ubl-strings.h:86 -msgid "OS only" -msgstr "Только ОС" +msgid "System restore" +msgstr "Восстановление системы" #: source/ubl-strings.h:87 -msgid "Installing only OS components without user data" -msgstr "Установка только компоненов ОС без пользовательских данных" +msgid "Restore missing or corrupted system files. Users data is not affected" +msgstr "Восстановление отсутствующих или поврежденных системных файлов. Данные пользователей не затрагиваются" #: source/ubl-strings.h:88 msgid "User data only" diff --git a/source/ubinstall-gtk-decorations.c b/source/ubinstall-gtk-decorations.c index e83c4ec..4fd5410 100644 --- a/source/ubinstall-gtk-decorations.c +++ b/source/ubinstall-gtk-decorations.c @@ -153,3 +153,77 @@ gboolean on_install_slider_slide(main_window *widgets){ } return G_SOURCE_REMOVE; } + +// 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); + +// switch(page){ +// case YON_PAGE_BOOTLOADER: +// gtk_widget_show(widgets->BootloaderImage); +// break; +// 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; +// case YON_PAGE_STARTUP: +// gtk_widget_show(widgets->StartupImage); +// break; +// case YON_PAGE_NETWORK: +// gtk_widget_show(widgets->NetworkImage); +// break; +// case YON_PAGE_INSTALLATION: +// gtk_widget_show(widgets->SlidesImage); +// g_timeout_add(7000,on_image_slide,widgets); + +// break; +// default: +// break; +// } +// } + +// void on_region_resized(GtkWidget *,main_window *widgets){ +// enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); +// GtkImage *target = NULL; +// GdkPixbuf *pixbuf = NULL; +// target = GTK_IMAGE(widgets->RegionImage); +// pixbuf = widgets->region_original; +// if (target){ +// yon_image_resize_from_container(target,pixbuf); +// } +// } + +// int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled){ +// int width = gtk_widget_get_allocated_width((gtk_widget_get_parent(GTK_WIDGET(target)))); +// int height = gtk_widget_get_allocated_height((gtk_widget_get_parent(GTK_WIDGET(target)))); + +// int newImgWidthDef = (width <= 217) ? width : width - 30; +// int newImgHeightDef = (height <= 120) ? height : height - 80; + +// int originalWidth = gdk_pixbuf_get_width(pixbuf_unscaled); +// int originalHeight = gdk_pixbuf_get_height(pixbuf_unscaled); +// int newImgHeight = (int)(originalHeight / ((double) originalWidth / newImgWidthDef)); + +// if (newImgHeight > newImgHeightDef) { +// newImgHeight = newImgHeightDef; +// newImgWidthDef = (int)(originalWidth / ((double) originalHeight / newImgHeight)); +// } +// int newImageWidth = (int)(originalWidth / ((double) originalHeight / newImgHeight)); + +// GdkPixbuf *scaledPixBuf = gdk_pixbuf_scale_simple(pixbuf_unscaled, newImageWidth, newImgHeight, GDK_INTERP_BILINEAR); +// gtk_image_set_from_pixbuf(target, scaledPixBuf); + +// g_object_unref(scaledPixBuf); + +// return 1; +// } \ No newline at end of file diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index cf7b069..1a2db87 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -256,6 +256,22 @@ void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_but } } } +// char *parameter = config(part_size_parameter); +// if (!yon_char_is_empty(parameter)){ +// GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->OSFormatSizeSpin)); +// gtk_adjustment_set_value(adj,atol(parameter)); +// g_signal_handlers_block_by_func(G_OBJECT(widgets->NextInstallationSizeTypeSpin),G_CALLBACK(on_partition_changed),widgets); +// g_signal_handlers_block_by_func(G_OBJECT(widgets->OSFormatSizeCombo),G_CALLBACK(on_partition_changed),widgets); +// g_signal_handlers_block_by_func(G_OBJECT(widgets->UserdataFormatSizeCombo),G_CALLBACK(on_partition_changed),widgets); + +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->OSFormatSizeCombo),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])-1); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserdataFormatSizeCombo),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])-1); +// gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin),yon_get_size_get_from_letter(parameter[strlen(parameter)-1])-1); + +// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->NextInstallationSizeTypeSpin),G_CALLBACK(on_partition_changed),widgets); +// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->OSFormatSizeCombo),G_CALLBACK(on_partition_changed),widgets); +// g_signal_handlers_unblock_by_func(G_OBJECT(widgets->UserdataFormatSizeCombo),G_CALLBACK(on_partition_changed),widgets); +// } void on_partition_changed(GtkWidget *self, main_window *widgets){ if (self==widgets->NextInstallationSysSectionTree||self == widgets->NextInstallationSizeTypeSpin){ @@ -319,7 +335,7 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){ } } // gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),0.0); - // gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); + gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin)),0.0); } } diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index 7a5e19c..eded13f 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -40,18 +40,37 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){ } #ifdef TIMEZONEMAP_INCLUDE + +gboolean on_map_box_ckicked_skip(){ + return 0; +} + void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_window *); void yon_map_status_hide(main_window *widgets){ gtk_widget_hide(widgets->TimeZoneMapOverlayBox); } -void yon_map_status_hide_timeout(main_window *widgets){ - g_idle_add_once((GSourceOnceFunc)yon_map_status_hide,widgets); +GMutex map_source_mutex; +guint map_status_source = -1; +gboolean yon_map_status_hide_timeout(main_window *widgets){ + printf("hide\n"); + g_mutex_lock(&map_source_mutex); + map_status_source=-1; + g_mutex_unlock(&map_source_mutex); + g_idle_add_once((GSourceOnceFunc)yon_map_status_hide,widgets); + return G_SOURCE_REMOVE; } void yon_map_status_show(main_window *widgets, char *icon_name, char *title, char *title_info){ + g_mutex_lock(&map_source_mutex); + if (map_status_source!=(guint)-1){ + g_source_remove(map_status_source); + printf("remove\n"); + map_status_source=(guint)-1; + } + g_mutex_unlock(&map_source_mutex); gtk_widget_show(widgets->TimeZoneMapOverlayBox); gtk_label_set_text(GTK_LABEL(widgets->TimeZoneMapOverlayTitleLabel),title); gtk_label_set_text(GTK_LABEL(widgets->TimeZoneMapOverlayInfoLabel),title_info); @@ -62,7 +81,10 @@ void yon_map_status_show(main_window *widgets, char *icon_name, char *title, cha } else { gtk_widget_hide(widgets->TimeZoneMapOverlayImage); } - g_timeout_add_seconds_once(5,(GSourceOnceFunc)yon_map_status_hide_timeout,widgets); + g_mutex_lock(&map_source_mutex); + map_status_source = g_timeout_add_seconds(3,(GSourceFunc)yon_map_status_hide_timeout,widgets); + printf("%d\n",map_status_source); + g_mutex_unlock(&map_source_mutex); } void on_zone_changed(GtkWidget *, main_window *widgets){ @@ -96,11 +118,12 @@ void on_map_selection_changed(GtkWidget *,CcTimezoneLocation *location,main_wind gtk_tree_model_get(GTK_TREE_MODEL(widgets->RegionTimezoneCompletionList),&iter,0,&render,1,&tz,-1); if (!strcmp(timezone,tz)){ gtk_entry_set_text(GTK_ENTRY(widgets->RegionEntry),render); + char *utc = yon_timezone_get_utc(tz); + yon_map_status_show(widgets,NULL,MAP_TITLE_LABEL(utc),render); } } - yon_map_status_show(widgets,NULL,MAP_TITLE_LABEL,MAP_INFO_LABEL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(on_zone_changed),widgets); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionEntry),G_CALLBACK(on_region_entry_changed),widgets); } @@ -128,9 +151,11 @@ void on_region_entry_changed(GtkWidget *, main_window *widgets){ } void yon_region_init(main_window *widgets){ + yon_timezone_init(); + gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->RegionCombo)); gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardNumLockCombo)); - #ifdef TIMEZONEMAP_INCLUDE + #ifdef TIMEZONEMAP_INCLUDE // insert timezonemap's interactive map GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->RegionMapBox)); if (list){ GList *iter; @@ -147,28 +172,19 @@ void yon_region_init(main_window *widgets){ if (!yon_char_is_empty(config_param)){ cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),config_param); } + #else // if timezonemap does not installed, static image inserts + #endif - int size; - config_str parsed = NULL; - parsed = yon_dir_get_contents(zone_path,&size); - for (int i=0;iRegionCombo),parsed[i],_(parsed[i])); - char *active = yon_char_append("/usr/share/zoneinfo/",parsed[i]); - int zone_size; - config_str zone_parsed = yon_file_ls(active,&zone_size); - GtkTreeIter iter; - for (int j=0;jRegionTimezoneCompletionList,&iter); - gtk_list_store_set(widgets->RegionTimezoneCompletionList,&iter,0,zone_name,1,zone_string,-1); - } - } - free(path); - } + size_t size; + GtkTreeIter iter; + config_str parsed = yon_timezone_get_all(&size); + for (size_t i=0;iRegionTimezoneCompletionList,&iter); + gtk_list_store_set(widgets->RegionTimezoneCompletionList,&iter,0,zone_name,1,parsed[i],-1); + // gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets)) } while(gtk_events_pending()) gtk_main_iteration(); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->RegionCombo),0); diff --git a/source/ubinstall-gtk-ui-lang.c b/source/ubinstall-gtk-ui-lang.c index 6ae89c3..9ae5ced 100644 --- a/source/ubinstall-gtk-ui-lang.c +++ b/source/ubinstall-gtk-ui-lang.c @@ -123,13 +123,6 @@ typedef struct{ char *code_full; } locale_struct; -int yon_char_parsed_compare(const void *a, const void *b){ - const config_str str_a = (const config_str)a; - const config_str str_b = (const config_str)b; - - return strcmp(*str_a,*str_b); -} - gboolean on_languages_search_func(GtkTreeModel *model, gint ,const char *key, GtkTreeIter *iter, main_window *){ char *target; char *loc_target; @@ -152,7 +145,7 @@ void yon_set_locales_list(main_window *widgets){ char *config_code = yon_char_new(config(installer_locale_parameter)); int size; config_str locales = yon_locale_get_all_codes(&size); - qsort(locales,size,sizeof(char*),yon_char_parsed_compare); + qsort(locales,size,sizeof(char*),(__compar_fn_t)yon_char_parsed_compare); GtkTreeIter iter,itar; GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); textdomain(LOCALES_DOMAIN_NAME); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 1f480d8..a7d4d63 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -786,6 +786,7 @@ void yon_main_window_create(main_window *widgets){ 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->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionMapBox); g_signal_connect(G_OBJECT(widgets->RegionSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->RegionEntry); + g_signal_connect(G_OBJECT(widgets->RegionMapBox),"button-press-event",G_CALLBACK(on_map_box_ckicked_skip),NULL); 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); @@ -806,6 +807,8 @@ void yon_main_window_create(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->NextInstallationSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->NextInstallationSizeTypeSpin),"changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->OSFormatSizeCombo),"changed",G_CALLBACK(on_partition_changed),widgets); + g_signal_connect(G_OBJECT(widgets->UserdataFormatSizeCombo),"changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->UserRootPasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),widgets->UserRootPasswordEntry); g_signal_connect(G_OBJECT(widgets->UserRootPasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),widgets->UserRootPasswordButton); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index cb5dcfb..c24250c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1365,7 +1365,6 @@ void yon_main_window_create(main_window *widgets); void yon_set_locales_list(main_window *widgets); void on_installer_language_changed(GtkWidget *self, GtkTreePath *, GtkTreeViewColumn *, main_window *widgets); gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *widgets); -int yon_char_parsed_compare(const void *a, const void *b); gboolean yon_os_component_insert(struct row_data *row_input); void *yon_os_components_setup(main_window *widgets); gboolean yon_spinner_switch_off(GtkSpinner *target); @@ -1490,5 +1489,6 @@ gboolean on_region_refilter(GtkTreeModel* model, GtkTreeIter* iter, main_window void on_region_entry_changed(GtkWidget *, main_window *widgets); char *yon_size_get_name_from_letter(char letter); void yon_map_status_hide(main_window *widgets); -void yon_map_status_hide_timeout(main_window *widgets); -void yon_map_status_show(main_window *widgets, char *icon_name, char *title, char *title_info); \ No newline at end of file +gboolean yon_map_status_hide_timeout(main_window *widgets); +void yon_map_status_show(main_window *widgets, char *icon_name, char *title, char *title_info); +gboolean on_map_box_ckicked_skip(); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index ebb84f5..2a9e060 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -75,13 +75,13 @@ NULL) #define ADVANCED_INSTALLATION_LABEL _("Installing OS files, user data on different partitions, creating RAID, etc.") #define ADVANCED_INSTALLATION_ATTENTION_LABEL _("Attention! The selected system components will be installed\nseparately into the selected partition.") #define GRUB_INSTALL_HEAD_LABEL _("GRUB install") -#define GRUB_INSTALL_LABEL _("Install the GRUB bootloader") +#define GRUB_INSTALL_LABEL _("Installing the GRUB bootloader into the MBR or EFI partition") #define GRUB_UPDATE_HEAD_LABEL _("GRUB update") #define GRUN_UPDATE_LABEL _("Update (reinstall) the GRUB bootloader") #define SEPARATE_INSTALL_HEAD_LABEL _("Separate installation") #define SEPARATE_INSTALL_LABEL _("Installing OS components and user data on different disk partitions") -#define OS_ONLY_HEAD_LABEL _("OS only") -#define OS_ONLY_LABEL _("Installing only OS components without user data") +#define OS_ONLY_HEAD_LABEL _("System restore") +#define OS_ONLY_LABEL _("Restore missing or corrupted system files. Users data is not affected") #define USER_DATA_HEAD_LABEL _("User data only") #define USER_DATA_LABEL _("Installing only user data without OS components") @@ -290,8 +290,8 @@ NULL) #define REBOOT_LABEL _("Reboot") #define SHUTDOWN_LABEL _("Shudown") #define FINISH_ACTION_LABEL _("After successful installation:") -#define MAP_TITLE_LABEL _("Feasf") -#define MAP_INFO_LABEL _("Geasfa") +#define MAP_TITLE_LABEL(utc) yon_char_unite(_("UTC"),utc,NULL) +#define MAP_INFO_LABEL(tz_location) yon_char_unite(_("Geasfa"),tz_location,NULL) // #define _LABEL _("Select your language:") // #define _LABEL _("Selecting additional system kernel components") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 9edae9f..4e5e2d3 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -277,7 +277,7 @@ - + @@ -10568,7 +10568,7 @@ separately into the selected partition. True False - Install the GRUB bootloader + Installing the GRUB bootloader into the MBR or EFI partition 0 @@ -10707,7 +10707,7 @@ separately into the selected partition. True False - OS only + System restore 0 @@ -10724,7 +10724,7 @@ separately into the selected partition. True False - Installing only OS components without user data + Restore missing or corrupted system files. Users data is not affected 0 @@ -10785,7 +10785,7 @@ separately into the selected partition. True False - User data only + User data restore 0