diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index 1de3c95..2897eb3 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -7,12 +7,6 @@ int yon_bootloader_save(main_window *widgets){ } else { yon_config_remove_by_key(GRUB_TIMEOUT_parameter); } - // char *OS = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry)); - // if (strcmp(OS,DEFAULT_BOOTLOAD_MENU_ITEM_LABEL)){ - // yon_config_register(GRUB_DEFAULT_parameter,GRUB_DEFAULT_parameter_command,OS); - // } else { - // yon_config_remove_by_key(GRUB_DEFAULT_parameter); - // } if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch))){ GtkTreeIter iter; yon_config_register(AUTOLOGINUSER_parameter,AUTOLOGINUSER_parameter_command,"yes"); @@ -380,6 +374,32 @@ yon_menu_item *yon_menu_item_new(){ return item; } +char *yon_bootloader_get_os_name(char *parameter){ + bind_textdomain_codeset("ublinux-init-grub-functions","UTF-8"); + textdomain("ublinux-init-grub-functions"); + char *final_os_name = NULL; + int size; + config_str menu_entries = yon_config_load(get_menus_entry_command,&size); + for (int i=0;i"); + if (!yon_char_is_empty(name)){ + name++; + final_os_name = yon_char_new(name); + } else { + final_os_name = yon_char_new(_(parsed[1])); + } + } + yon_char_parsed_free(parsed,parsed_size); + } + yon_char_parsed_free(menu_entries,size); + textdomain(LocaleName); + return final_os_name; +} + void yon_bootloader_interface_update(main_window *widgets){ char *timeout = config(GRUB_TIMEOUT_parameter); char *admins = config(GRUB_SUPERUSERS_parameter); @@ -430,7 +450,11 @@ void yon_bootloader_init(main_window *widgets){ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin),0); } if (!yon_char_is_empty(os)){ - gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),os); + char *os_name = yon_bootloader_get_os_name(os); + if (!yon_char_is_empty(os_name)){ + gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),os_name); + free(os_name); + } } else { gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),DEFAULT_BOOTLOAD_MENU_ITEM_LABEL); } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 7a972a3..5f5c28a 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -1472,4 +1472,5 @@ gboolean on_languages_search_func(GtkTreeModel *model, gint col,const char *key, void yon_update_translation(main_window *widgets); void yon_translation_init(GtkBuilder *builder); void yon_licence_load(main_window *widgets); -void on_network_removed(GtkWidget *,network_info *info); \ No newline at end of file +void on_network_removed(GtkWidget *,network_info *info); +char *yon_bootloader_get_os_name(char *parameter); \ No newline at end of file