From 0bd1e1dbd0291b06be14991766f78503237d6fe9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 1 Nov 2024 18:07:07 +0600 Subject: [PATCH] Table WIP --- kernel-list-addon.csv | 20 +-- kernel-list.csv | 8 +- source/ubl-settings-kernel.c | 103 ++++++----- source/ubl-settings-kernel.h | 17 +- source/ubl-strings.h | 8 +- ubl-settings-kernel-table-row.glade | 257 +++++++++++++++------------- ubl-settings-kernel.css | 5 + ubl-settings-kernel.glade | 224 ++---------------------- 8 files changed, 251 insertions(+), 391 deletions(-) diff --git a/kernel-list-addon.csv b/kernel-list-addon.csv index dd584a5..a4b3bf7 100644 --- a/kernel-list-addon.csv +++ b/kernel-list-addon.csv @@ -1,10 +1,10 @@ -PAСKAGE_UBM;PAСKAGE;NAME;DESCRIPTION -ubm-002-linux515-headers;linux515-headers;Linux 5.15 headers;The Linux kernel headers v5.15 -ubm-003-linux515-docs;linux515-docs;Linux 5.15 Docs;The Linux kernel docs v5.15 -ubm-linux515-dkms;linux515-dkms;Linux 5.15 DKMS modules;The Linux kernel DKMS modules v5.15 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu -ubm-002-linux61-headers;linux61-headers;Linux 6.1 headers;The Linux kernel headers v6.1 -ubm-003-linux61-docs;linux61-docs;Linux 6.1 Docs;The Linux kernel docs v6.1 -ubm-linux61-dkms;linux61-dkms;Linux 6.1 DKMS modules;The Linux kernel DKMS modules v6.1 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu -ubm-002-linux66-headers;linux66-headers;Linux 6.6 headers;The Linux kernel headers v6.6 -ubm-003-linux66-docs;linux66-docs;Linux 6.6 Docs;The Linux kernel docs v6.6 -ubm-linux66-dkms;linux66-dkms;Linux 6.6 DKMS modules;The Linux kernel DKMS modules v6.6 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu \ No newline at end of file +NAME;PAСKAGE_UBM;PAСKAGE;DESCRIPTION +Linux 5.15 headers;ubm-002-linux515-headers;linux515-headers;The Linux kernel headers v5.15 +Linux 5.15 Docs;ubm-003-linux515-docs;linux515-docs;The Linux kernel docs v5.15 +Linux 5.15 DKMS modules;ubm-linux515-dkms;linux515-dkms;The Linux kernel DKMS modules v5.15 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu +Linux 6.1 headers;ubm-002-linux61-headers;linux61-headers;The Linux kernel headers v6.1 +Linux 6.1 Docs;ubm-003-linux61-docs;linux61-docs;The Linux kernel docs v6.1 +Linux 6.1 DKMS modules;ubm-linux61-dkms;linux61-dkms;The Linux kernel DKMS modules v6.1 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu +Linux 6.6 headers;ubm-002-linux66-headers;linux66-headers;The Linux kernel headers v6.6 +Linux 6.6 Docs;ubm-003-linux66-docs;linux66-docs;The Linux kernel docs v6.6 +Linux 6.6 DKMS modules;ubm-linux66-dkms;linux66-dkms;The Linux kernel DKMS modules v6.6 : v4l2loopback, r8168-8136, rtl88x2bu, r8125, rtl8192eu \ No newline at end of file diff --git a/kernel-list.csv b/kernel-list.csv index 1bfce8d..06d5c91 100644 --- a/kernel-list.csv +++ b/kernel-list.csv @@ -1,4 +1,4 @@ -PAСKAGE_UBM;PAСKAGE;NAME;TAG;DESCRIPTION -ubm-001-linux515,ubm-001-linux515-headers;linux515,linux515-headers;Linux 5.15;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v5.15 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs -ubm-001-linux61,ubm-001-linux61-headers;linux61,linux61-headers;Linux 6.1;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v6.1 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs -ubm-001-linux66,ubm-001-linux66-headers;linux66,linux66-headers;Linux 6.6;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v6.6 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs \ No newline at end of file +NAME;PAСKAGE_UBM;PAСKAGE;PAСKAGE_UBM_REQUIRED;PAСKAGE_REQUIRED;TAG;DESCRIPTION +Linux 5.15;ubm-001-linux515;linux515;ubm-001-linux515-headers;linux515-headers;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v5.15 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.1;ubm-001-linux61;linux61;ubm-001-linux61-headers;linux61-headers;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v6.1 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs +Linux 6.6;ubm-001-linux66;linux66;ubm-001-linux66-headers;linux66-headers;LTS, Stable, RealTime, Hardened, Recomended;The Linux kernel v6.6 and modules, headers. Manual 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/ubl-settings-kernel.c b/source/ubl-settings-kernel.c index 5545402..19cc9de 100644 --- a/source/ubl-settings-kernel.c +++ b/source/ubl-settings-kernel.c @@ -71,56 +71,91 @@ install_window *yon_install_window_new(){ return window; } +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); + 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_all(box); + gtk_box_pack_start(target,box,0,0,0); + return 1; + } + return 0; +} + GtkWidget *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_table_row_path); GtkWidget *main_box = yon_gtk_builder_get_widget(builder,"TableRowLabel"); - GtkWidget *icon_box = yon_gtk_builder_get_widget(builder,"IconPackBox"); + GtkWidget *icon_box = yon_gtk_builder_get_widget(builder,"IconBox"); GtkWidget *name_label = yon_gtk_builder_get_widget(builder,"NameLabel"); + GtkWidget *install_tags_box = yon_gtk_builder_get_widget(builder,"InstallTagsBox"); + GtkWidget *run_tags_box = yon_gtk_builder_get_widget(builder,"RunBox"); GtkWidget *tags_box = yon_gtk_builder_get_widget(builder,"TagsBox"); - GtkWidget *module_check = yon_gtk_builder_get_widget(builder,"ModuleCheck"); - GtkWidget *package_check = yon_gtk_builder_get_widget(builder,"PackageCheck"); - GtkWidget *loaded_radio = yon_gtk_builder_get_widget(builder,"LoadedRadio"); GtkWidget *description_label = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + GtkWidget *remove_module_button = yon_gtk_builder_get_widget(builder,"RemoveModuleButton"); + GtkWidget *remove_package_button = yon_gtk_builder_get_widget(builder,"RemovePackageButton"); + GtkWidget *install_module_button = yon_gtk_builder_get_widget(builder,"InstallModuleButton"); + GtkWidget *install_package_button = yon_gtk_builder_get_widget(builder,"InstallPackageButton"); gtk_list_box_insert(target,main_box,-1); int size; config_str parsed = yon_char_parse(target_string,&size,";"); if (size){ - char *name = yon_char_unite("",parsed[2],"\n",parsed[0],"\n",parsed[1],"",NULL); + char *name = yon_char_unite("",parsed[2],"\n",MODULE_LABEL," ",parsed[0],"\n",PACKAGE_LABEL," ",parsed[1],"",NULL); int types_size; - config_str types_parsed = yon_char_parse(parsed[3],&types_size,", "); + config_str types_parsed = yon_char_parse(parsed[5],&types_size,", "); for (int k=0;kStatusSizeGroup,icon_box); - gtk_size_group_add_widget(widgets->KernelSizeGroup,name_label); - gtk_size_group_add_widget(widgets->TagsSizeGroup,tags_box); - gtk_size_group_add_widget(widgets->ModuleSizeGroup,module_check); - gtk_size_group_add_widget(widgets->PackageSizeGroup,package_check); - gtk_size_group_add_widget(widgets->LoaderSizeGroup,loaded_radio); - gtk_size_group_add_widget(widgets->DescriptionSizeGroup,description_label); - + gtk_label_set_text(GTK_LABEL(description_label),parsed[6]); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->StatusSizeGroup),icon_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->KernelSizeGroup),name_label); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->TagsSizeGroup),tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->InstallSizeGroup),install_tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->RunSizeGroup),run_tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->DescriptionSizeGroup),description_label); } return main_box; } @@ -274,33 +309,23 @@ void yon_main_window_complete(main_window *widgets){ widgets->StatusSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"StatusSizeGroup")); widgets->KernelSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"KernelSizeGroup")); widgets->TagsSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"TagsSizeGroup")); - widgets->ModuleSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"ModuleSizeGroup")); - widgets->PackageSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"PackageSizeGroup")); - widgets->LoaderSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"LoaderSizeGroup")); + widgets->InstallSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"InstallSizeGroup")); + widgets->RunSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"RunSizeGroup")); widgets->DescriptionSizeGroup = GTK_SIZE_GROUP(gtk_builder_get_object(builder,"DescriptionSizeGroup")); g_signal_connect(G_OBJECT(widgets->UpdateButton),"clicked",G_CALLBACK(on_update_clicked),widgets); g_signal_connect(G_OBJECT(widgets->InfoButton),"clicked",G_CALLBACK(on_info_clicked),widgets); g_signal_connect(G_OBJECT(widgets->LogButton),"clicked",G_CALLBACK(on_changelog_clicked),widgets); g_signal_connect(G_OBJECT(widgets->BuildingButton),"clicked",G_CALLBACK(on_building_clicked),widgets); - // g_signal_connect(G_OBJECT(widgets->BuildingButton),"clicked",G_CALLBACK(on_install_module_toggled),widgets); - // g_signal_connect(G_OBJECT(widgets->BuildingButton),"clicked",G_CALLBACK(on_install_package_toggled),widgets); - // g_signal_connect(G_OBJECT(widgets->BuildingButton),"clicked",G_CALLBACK(on_boot_toggled),widgets); - GtkWidget *radio_group=NULL; int kernels_size; config_str kernels = yon_resource_open_file(kernels_path, &kernels_size); for (int i=1;iKernelsPackageBox),kernels[i],widgets); - GList *list = gtk_container_get_children(GTK_CONTAINER(current)); - GList *list2 = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,5))); - GtkWidget *radio = GTK_WIDGET(g_list_nth_data(list2,0)); - if (radio_group) gtk_radio_button_join_group(GTK_RADIO_BUTTON(radio),GTK_RADIO_BUTTON(radio_group)); - radio_group = radio; - g_list_free(list); - g_list_free(list2); + GtkWidget * current = yon_tab_row_new(GTK_LIST_BOX(widgets->KernelsPackageBox),kernels[i],widgets); + gtk_widget_set_can_focus(gtk_widget_get_parent(current),0); } } + yon_load_proceed(YON_CONFIG_LOCAL); } int main(int argc, char *argv[]){ diff --git a/source/ubl-settings-kernel.h b/source/ubl-settings-kernel.h index c7125ad..4acaecd 100644 --- a/source/ubl-settings-kernel.h +++ b/source/ubl-settings-kernel.h @@ -29,6 +29,8 @@ #define kernels_path "resource:///com/ublinux/csv/kernel-list.csv" #define kernels_addon_path "resource:///com/ublinux/csv/kernel-list-addon.csv" +#define module_icon_path "com.ublinux.libublsettingsui-gtk3.cubes-symbolic" +#define package_icon_path "com.ublinux.libublsettingsui-gtk3.dropbox-symbolic" #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-kernel" @@ -37,11 +39,12 @@ #define get_kernel_changelog_command(target) yon_char_unite("find /usr/lib/modules/ -maxdepth 2 -type f -iname \"pkgbase\" -exec grep -il \"",target,"\" {} + | xargs dirname | xargs -I {} cat \"{}/changelog\"", NULL) #define get_package_info_command(target) yon_char_append("pacman -Q --info ",target) +#define get_package_is_installed_command(target) yon_char_append("pacman -Qqs ",target) -#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," get system PARAMETERS",NULL) -#define config_get_local_command "ubconfig --source system get system PARAMETERS" -#define config_get_global_command "ubconfig --source global get system PARAMETERS" -#define config_get_default_command "" +#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," get boot KERNEL_BOOT",NULL) +#define config_get_local_command "ubconfig --source system get boot KERNEL_BOOT" +#define config_get_global_command "ubconfig --source global get boot KERNEL_BOOT" +#define config_get_default_command "ubconfig --source default get boot KERNEL_BOOT" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" @@ -76,9 +79,8 @@ typedef struct { GtkSizeGroup *StatusSizeGroup; GtkSizeGroup *KernelSizeGroup; GtkSizeGroup *TagsSizeGroup; - GtkSizeGroup *ModuleSizeGroup; - GtkSizeGroup *PackageSizeGroup; - GtkSizeGroup *LoaderSizeGroup; + GtkSizeGroup *InstallSizeGroup; + GtkSizeGroup *RunSizeGroup; GtkSizeGroup *DescriptionSizeGroup; } main_window; @@ -108,6 +110,7 @@ void config_init(); void yon_main_window_complete(main_window *widgets); +int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name); GtkWidget *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets); void on_update_clicked(GtkWidget *, main_window *widgets); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index a54523f..713434a 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -4,5 +4,11 @@ #define INFO_TITLE_LABEL _("Information") +#define MODULE_LABEL _("Module:") +#define PACKAGE_LABEL _("Package:") + #define PACKAGE_NOT_FOUND_LABEL _("Packages were not found") -#define CHANGELOG_NOT_FOUND_LABEL _("Changelog was not found") \ No newline at end of file +#define CHANGELOG_NOT_FOUND_LABEL _("Changelog was not found") + +#define PACKAGE_INSTALLED_LABEL _("Package installed") +#define MODULE_INSTALLED_LABEL _("Module installed") \ No newline at end of file diff --git a/ubl-settings-kernel-table-row.glade b/ubl-settings-kernel-table-row.glade index cf6621e..6f09588 100644 --- a/ubl-settings-kernel-table-row.glade +++ b/ubl-settings-kernel-table-row.glade @@ -6,173 +6,198 @@ True False - vertical - 5 + 15 + + + True + False + center + vertical + 5 + + + + + + + + + False + True + 0 + + True False - 15 - + True False - - - True - False - - - True - False - - - True - True - 0 - - + <b>Linux 5.15</b> +Modules: ubm-001-linux515 +Packages: linux515 + True + False + 0 - False + True True - 1 + 0 + + + False + True + 1 + + + + + True + False + vertical + + + + + + False + True + 2 + + + + + True + False + vertical + + + + + + False + True + 3 + + + + + True + False + vertical - + + + + + False + True + 4 + + + + + True + False + center + vertical + 5 + + + Install module True - False - vertical - - - + True + True False True - 2 + 0 - + + Install package True - False - vertical - - - + True + True False True - 3 + 1 - - True - False - center - vertical - 5 - - - True - True - False - True - - - True - False - Install - - - - - False - True - 0 - - - - - True - False - True - - - True - False - Remove - - - - - False - True - 1 - - - - - Changelog - True - True - True - - - False - True - 2 - - + + Remove module + True + True False True - end - 6 + 2 - - - False - True - 0 - - - - - True - False - 5 - - Expand - True + + Remove package True True False True - 0 + 3 - - - - + + Changelog + True + True + True + + + + False + True + 4 + False True - 1 + end + 4 + + + + + True + False + The Linux kernel v5.15 and modules, headers. Manual modules: acpi_call, bbswitch, broadcom-wl, r8168, rtl8723bu, tp_smapi, vhba-module, virtualbox-host-modules, zfs + True + 0 + + + True + True + end + 6 + diff --git a/ubl-settings-kernel.css b/ubl-settings-kernel.css index 44349a4..cec77c8 100644 --- a/ubl-settings-kernel.css +++ b/ubl-settings-kernel.css @@ -144,6 +144,11 @@ background:transparent; background-color: #f3f0ac; } +.listfix row:selected * .buttonlistfx:active * { + color: @theme_fg_color; +} + + .tag_red{ border-radius: 2px; border-width: 0.5px; diff --git a/ubl-settings-kernel.glade b/ubl-settings-kernel.glade index 5451c58..abc4b95 100644 --- a/ubl-settings-kernel.glade +++ b/ubl-settings-kernel.glade @@ -17,6 +17,9 @@ + + + @@ -39,6 +42,9 @@ + + + True False @@ -164,187 +170,11 @@ 5 5 vertical - - - False - - - True - False - Status - 0 - - - - False - True - 0 - - - - - True - False - Kernel - 0 - - - - False - True - 1 - - - - - True - False - Tags - 0 - - - - False - True - 2 - - - - - True - False - vertical - - - True - False - Installed - 0 - - - - False - True - 0 - - - - - True - False - - - True - False - Module - 0 - - - - True - True - 0 - - - - - True - False - Package - 0 - - - - True - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - Loader - 0 - - - - False - True - 4 - - - - - True - False - Description - 0 - - - - True - True - 5 - - - - - False - True - 0 - - True True never - in True @@ -354,6 +184,10 @@ True False + none + @@ -365,9 +199,6 @@ 1 - @@ -433,39 +264,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -