diff --git a/gresource.xml b/gresource.xml index 73c5f37..3873c32 100644 --- a/gresource.xml +++ b/gresource.xml @@ -11,6 +11,7 @@ ubinstall-gtk-user.glade ubinstall-gtk-menu.glade ubinstall-gtk-menu-item.glade + ubinstall-gtk-kernel-row.glade ubinstall-gtk.css @@ -40,5 +41,6 @@ modules.csv + kernel-list.csv \ No newline at end of file diff --git a/kernel-list.csv b/kernel-list.csv new file mode 100644 index 0000000..e97af1f --- /dev/null +++ b/kernel-list.csv @@ -0,0 +1,5 @@ +NAME;PAСKAGE_UBM;PAСKAGE;PAСKAGE_UBM_REQUIRED;PAСKAGE_REQUIRED;TAG;DESCRIPTION +Linux 5.15;ubm-001-linux515-test;linux515-test;ubm-002-linux515-test-headers;linux515-test-headers;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v5.15 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 5.15;ubm-001-linux515;linux515;ubm-002-linux515-headers;linux515-headers;LTS, Stable;The Linux kernel v5.15 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.1;ubm-001-linux61;linux61;ubm-002-linux61-headers;linux61-headers;LTS, Stable, Recomended;The Linux kernel v6.1 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.6;ubm-001-linux66;linux66;ubm-002-linux66-headers;linux66-headers;LTS, Stable;The Linux kernel v6.6 and modules, headers. Additional kernel modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 701dc7f..15bc804 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -68,9 +68,11 @@ set(DEPENDFILES ../ubinstall-gtk-user.glade ../ubinstall-gtk-menu.glade ../ubinstall-gtk-menu-item.glade + ../ubinstall-gtk-kernel-row.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv + ../kernel-list.csv ) file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -125,6 +127,7 @@ set(SOURCE_FILES ubinstall-gtk-saving.c ubinstall-gtk-standard.c ubinstall-gtk-install-start.c + ubinstall-gtk-kernel.c ubinstall-gtk.h ubl-strings.h ) diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index c412aad..0d19168 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -196,8 +196,6 @@ void on_children_clean(GtkWidget*, yon_menu_window *window){ } void on_menu_window_size_reallocated(GtkWidget *self,GtkAllocation *,yon_menu_window *window){ - - int x,y,width; gtk_window_get_size(GTK_WINDOW(window->MenuWindow),&width,NULL); gtk_window_get_position(GTK_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(window->MenuWindow))),&x,&y); diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 67ca9bc..24fe7ee 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -1,18 +1,23 @@ #include "ubinstall-gtk.h" int yon_kernel_save(main_window *widgets){ - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->KernelsList); - int size = 0; - config_str kernels = NULL; - for_iter(model,&iter){ - char *target; - int status,loaded; - gtk_tree_model_get(model,&iter,0,&status,1,&loaded,2,&target,-1); - if (status){ - yon_char_parsed_add_or_create_if_exists(kernels,&size,target); + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + char *install_modules = ""; + char *enabled_module = NULL; + for(GList *iter = list;iter;iter = iter->next){ + kernel_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_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); + if (!yon_char_is_empty(install_modules)) free(install_modules); + install_modules = temp; + } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ + enabled_module = row->package; } + } + + yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module); return 1; } diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c new file mode 100644 index 0000000..dd1ed55 --- /dev/null +++ b/source/ubinstall-gtk-kernel.c @@ -0,0 +1,180 @@ +#include "ubinstall-gtk.h" + + +kernel_row *yon_kernel_row_new(){ + kernel_row *row = new(kernel_row); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_kernel_row); + + row->RowBox = yon_gtk_builder_get_widget(builder,"TableRow"); + row->InstallCheck = yon_gtk_builder_get_widget(builder,"InstallCheck"); + row->EnableRadio = yon_gtk_builder_get_widget(builder,"EnableRadio"); + row->NameLabel = yon_gtk_builder_get_widget(builder,"NameLabel"); + row->TagsBox = yon_gtk_builder_get_widget(builder,"TagsBox"); + row->ModulesLabel = yon_gtk_builder_get_widget(builder,"ModulesLabel"); + row->DescriptionLabel = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + row->name=NULL; + row->modules=NULL; + row->package=NULL; + + row->row = gtk_list_box_row_new(); + gtk_container_add(GTK_CONTAINER(row->row),row->RowBox); + gtk_widget_show(row->row); + + g_object_set_data(G_OBJECT(row->InstallCheck),"kernel_row",row); + g_object_set_data(G_OBJECT(row->EnableRadio),"kernel_row",row); + g_object_set_data(G_OBJECT(row->row),"kernel_row",row); + + return row; +} + +int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name){ + if (GTK_IS_BOX(target)&&!yon_char_is_empty(tag_label)&&!yon_char_is_empty(tag_style)){ + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); + GtkWidget *label = gtk_label_new(tag_label); + PangoAttrList *attr = pango_attr_list_new(); + PangoAttribute *scale_attr = pango_attr_size_new_absolute(12 * PANGO_SCALE); + gtk_label_set_attributes(GTK_LABEL(label),attr); + + g_object_set_data(G_OBJECT(box),"label",label); + + pango_attr_list_insert(attr,scale_attr); + gtk_widget_set_hexpand(box, TRUE); + gtk_widget_set_halign(box, GTK_ALIGN_FILL); + + gtk_style_context_add_class(gtk_widget_get_style_context(label),tag_style); + GtkWidget *icon = NULL; + if (icon_name){ + icon = gtk_image_new_from_icon_name(icon_name,GTK_ICON_SIZE_BUTTON); + gtk_box_pack_start(GTK_BOX(box),icon,0,0,0); + } + gtk_box_pack_start(GTK_BOX(box),label,1,1,0); + gtk_widget_show(label); + gtk_widget_show(box); + gtk_box_pack_start(target,box,0,0,0); + return 1; + } + return 0; +} + +void yon_kernel_row_setup_tags(kernel_row *row, char *tags){ + int size; + config_str parsed = yon_char_parse(tags,&size,", "); + for (int i=0;iTagsBox),tag_name,tag_type,NULL); + } +} + +void yon_kernel_row_setup(kernel_row *row, char *name, char *modules,char *package, char *tags, char *description){ + row->name = yon_char_new(name); + row->modules = yon_char_new(modules); + row->package = yon_char_new(package); + + guint size; + config_str description_wrapped = yon_char_wrap_to_lines(description,3,&size); + char *description_full = yon_char_parsed_to_string(description_wrapped,size,"\n"); + gtk_label_set_label(GTK_LABEL(row->NameLabel),name); + gtk_label_set_label(GTK_LABEL(row->ModulesLabel),modules); + gtk_label_set_label(GTK_LABEL(row->DescriptionLabel),description_full); + + yon_kernel_row_setup_tags(row,tags); + yon_char_parsed_free(description_wrapped,size); + free(description_full); +} + +void yon_kernel_resize(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + GList *iter = list; + + int name_size=0; + int tags_size=0; + int modules_size=0; + for (;iter;iter=iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + int cur_name_size; + int cur_tags_size; + int cur_modules_size; + gtk_widget_realize(row->NameLabel); + gtk_widget_realize(row->TagsBox); + gtk_widget_realize(row->ModulesLabel); + while (g_main_context_iteration(NULL, FALSE)); + gtk_widget_get_preferred_width(row->NameLabel,&cur_name_size,NULL); + gtk_widget_get_preferred_width(row->TagsBox,NULL,&cur_tags_size); + gtk_widget_get_preferred_width(row->ModulesLabel,&cur_modules_size,NULL); + if (name_sizenext){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + gtk_widget_set_size_request(row->NameLabel,name_size,-1); + // gtk_widget_set_size_request(row->TagsBox,tags_size,-1); + GList *list = gtk_container_get_children(GTK_CONTAINER(row->TagsBox)); + for (GList *iter = list;iter;iter=iter->next){ + gtk_widget_set_size_request(GTK_WIDGET(g_object_get_data(G_OBJECT(iter->data),"label")),tags_size,-1); + + } + gtk_widget_set_size_request(row->ModulesLabel,modules_size,-1); + } +} + +void yon_kernel_setup(main_window *widgets){ + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelListBox)); + GList *iter; + for (iter = list; iter; iter = iter->next){ + kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); + if (row){ + if (row->name) free(row->name); + if (!yon_char_is_empty(row->modules)) free(row->modules); + free(row); + gtk_widget_destroy(GTK_WIDGET(iter->data)); + } + } + g_list_free(list); + + int size; + config_str kernels = yon_resource_open_file(kernel_list_path,&size); + + GtkWidget *radio_group = NULL; + for (int i=1;iKernelListBox),row->row,-1); + + if (!radio_group) { + radio_group = row->EnableRadio; + } + gtk_radio_button_join_group(GTK_RADIO_BUTTON(row->EnableRadio),GTK_RADIO_BUTTON(radio_group)); + + yon_kernel_row_setup(row,name,modules,package,tags,description); + yon_char_parsed_free(parsed,parsed_size); + } + yon_kernel_resize(widgets); + + yon_char_parsed_free(kernels,size); + + +} \ No newline at end of file diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index ed6bf10..6e4ac95 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -428,8 +428,7 @@ main_window *yon_main_window_complete(){ widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); - widgets->KernelsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"KernelsList")); - widgets->KernelsTree = yon_gtk_builder_get_widget(builder,"KernelsTree"); + widgets->KernelListBox = yon_gtk_builder_get_widget(builder,"KernelListBox"); widgets->OSSoftwareTree = yon_gtk_builder_get_widget(builder,"OSSoftwareTree"); widgets->OSSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"OSSoftwareList")); @@ -708,6 +707,7 @@ main_window *yon_main_window_complete(){ gtk_builder_connect_signals(builder,NULL); // yon_load_proceed(YON_CONFIG_DEFAULT); // yon_interface_update(widgets); + yon_kernel_setup(widgets); } return widgets; } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index e133abb..9681dfa 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -29,6 +29,7 @@ #define glade_path_user "/com/ublinux/ui/ubinstall-gtk-user.glade" #define glade_path_menu_window "/com/ublinux/ui/ubinstall-gtk-menu.glade" #define glade_path_menu_item "/com/ublinux/ui/ubinstall-gtk-menu-item.glade" +#define glade_path_kernel_row "/com/ublinux/ui/ubinstall-gtk-kernel-row.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) @@ -51,6 +52,7 @@ #define zone_path "/usr/share/zoneinfo/" #define additional_software_path "resource:///com/ublinux/csv/modules.csv" +#define kernel_list_path "resource:///com/ublinux/csv/kernel-list.csv" #define slide_0_path "/com/ublinux/images/slide-0.png" @@ -154,6 +156,8 @@ NULL #define USERADD_parameter_all "AUTOINSTALL['ubconfig set [users] USERADD[*]']" #define USERADD_parameter(target) yon_char_unite("AUTOINSTALL['ubconfig set [users] USERADD[",target,"]']",NULL) #define USERADD_parameter_command(target) yon_char_unite("ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [users] USERADD[",target,"]']",NULL) +#define KERNEL_BOOT_parameter "AUTOINSTALL['ubconfig set [boot] KERNEL_BOOT']" +#define KERNEL_BOOT_parameter_command "ubconfig --source global geet autoinstall AUTOINSTALL[ubconfig set [boot] KERNEL_BOOT]" #define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL) @@ -489,8 +493,8 @@ typedef struct { GtkWidget *AutologinSensitiveCheck; GtkWidget *HostnameSensitiveCheck; - GtkWidget *KernelsTree; - GtkListStore *KernelsList; + GtkWidget *KernelListBox; + GtkWidget *OSSoftwareTree; GtkListStore *OSSoftwareList; GtkWidget *StartupServicesTree; @@ -676,6 +680,21 @@ typedef struct { } yon_menu_item; +typedef struct { + GtkWidget *row; + GtkWidget *RowBox; + GtkWidget *InstallCheck; + GtkWidget *EnableRadio; + GtkWidget *TagsBox; + GtkWidget *NameLabel; + GtkWidget *DescriptionLabel; + GtkWidget *ModulesLabel; + + char *name; + char *modules; + char *package; +} kernel_row; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); @@ -797,4 +816,10 @@ gboolean yon_on_revealer_switched (yon_menu_window *window); gboolean on_menu_clicked(GtkWidget *, GdkEventButton *event, yon_menu_window *window); yon_menu_window *yon_menu_window_open(GtkWidget *, main_window *widgets); void on_submenu_open(GtkWidget *,yon_menu_item *item); -void on_menu_chosen(GtkWidget *, yon_menu_item *item); \ No newline at end of file +void on_menu_chosen(GtkWidget *, yon_menu_item *item); +void yon_kernel_setup(main_window *widgets); +void yon_kernel_row_setup(kernel_row *row, char *name, char *modules,char *package, char *tags, char *description); +void yon_kernel_row_setup_tags(kernel_row *row, char *tags); +int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name); +kernel_row *yon_kernel_row_new(); +void yon_kernel_resize(main_window *widgets); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 03e63b6..f44e209 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -187,4 +187,12 @@ #define DEFAULT_BOOTLOAD_MENU_ITEM_LABEL _("Default (Use last succeeded)") #define ENCRYPT_ERROR_LABEL _("Password encryption error") -#define DEFAULT_MENU_ITEM_LABEL _("Default (Use last succeeded)") \ No newline at end of file +#define DEFAULT_MENU_ITEM_LABEL _("Default (Use last succeeded)") + +#define LAUNCH_LABEL _("Launch") +#define LTS_TAG _("LTS") +#define REACTIVE_TAG _("Reactive") +#define RECOMENDED_TAG _("Recomended") +#define HARDENED_TAG _("Hardened") +#define REALTIME_TAG _("RealTime") +#define STABLE_TAG _("Stable") \ No newline at end of file diff --git a/ubinstall-gtk-kernel-row.glade b/ubinstall-gtk-kernel-row.glade new file mode 100644 index 0000000..74540e0 --- /dev/null +++ b/ubinstall-gtk-kernel-row.glade @@ -0,0 +1,145 @@ + + + + + + + True + False + 1 + vertical + + + True + False + 5 + 15 + + + True + True + False + 5 + True + + + + + + False + True + 0 + + + + + True + True + False + 5 + True + True + + + + + + False + True + 1 + + + + + True + False + center + 5 + 5 + vertical + 1 + + + True + False + Name + True + False + 0 + + + False + True + 0 + + + + + False + True + 2 + + + + + True + False + start + 5 + 5 + vertical + 2 + True + + + + + + False + True + 3 + + + + + True + False + 5 + label + 0 + + + False + True + 4 + + + + + True + False + 5 + 0 + + + True + True + end + 6 + + + + + + False + True + 0 + + + + + diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 0dba73b..1e2e569 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -232,4 +232,74 @@ treeview row:nth-child(even) { background-color: #ffffff; } border-style:solid; border-width:0.3px; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); +} + +.tag_red{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#660000; + border-color: #cf2a27; + + background-color:#ea9999 +} +.tag_blue{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #2b78e4; + + background-color:#9fc5f8 +} +.tag_purple{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#073763; + border-color: #9900ff; + + background-color:#b4a7d6 +} +.tag_orange{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#783f04; + border-color: #ff9900; + + background-color:#f9cb9c +} +.tag_yellow{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#7f6000; + border-color: #bf9000; + + background-color:#ffe599 +} +.tag_green{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + border-color: #009e0f; + background-color:#b6d7a8; + color:#274e13; +} +.tag_grey{ + border-radius: 2px; + border-width: 0.5px; + border-style: solid; + padding:2px 5px; + color:#5f5f5f; + border-color: #777777; + + background-color:#999999 } \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 5320c08..e2c0aec 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -1520,68 +1520,18 @@ and help you install UBLinux on your computer True in - + True - True - KernelsList - 0 - - - - - - - - - 0 - - - - - - - Load - - - True - - - 1 - - - - - - - Kernel - - - - 2 - - - - - - - Modules - - - - 3 - - - - + False - - Description - - - - 4 - - + + True + False + 5 + 5 + 5 + 5 + none