From f0e94e2a3595f908b5bf1062c57844bb062561ea Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 15 Jul 2025 16:06:18 +0600 Subject: [PATCH] Startup optimization fixes --- source/ubl-settings-video-monitor.c | 4 +- source/ubl-settings-video.c | 26 +- source/ubl-settings-video.h | 3 + ubl-settings-video.glade | 1991 ++++++++++++++------------- 4 files changed, 1025 insertions(+), 999 deletions(-) diff --git a/source/ubl-settings-video-monitor.c b/source/ubl-settings-video-monitor.c index ee330af..1a3d4a8 100644 --- a/source/ubl-settings-video-monitor.c +++ b/source/ubl-settings-video-monitor.c @@ -426,7 +426,9 @@ void yon_monitor_view_update(){ gtk_widget_destroy(GTK_WIDGET(g_list_nth_data(list,i))); } g_list_free(list); + yon_monitor_new(main_config.widgets,1); + int size; config_str parameters = yon_config_get_all_by_key(XORG_PARAMETER,&size); for (int i=0;i-1){ monitor_data *window = yon_monitor_new(main_config.widgets,0); free(yon_char_divide(current,strlen(XORG_PARAMETER))); - current[strlen(current)-1]='\0'; + yon_char_remove_last_symbol(current,']'); gtk_label_set_text(GTK_LABEL(window->NameLabel),current); int parsed_size; config_str parsed = yon_char_parse(parameters[i],&parsed_size,","); diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index c347b0e..15dfc08 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -338,7 +338,7 @@ void yon_proprietary_local_get(main_window *widgets){ for (int i=1;iInterfaceBox),widgets->MainBox,1,1,0); // Custom widgets configuration { + widgets->MainOverlay = yon_gtk_builder_get_widget(builder,"MainOverlay"); + widgets->MainSpinner = yon_gtk_builder_get_widget(builder,"MainSpinner"); + widgets->AutoDriverCombo = yon_gtk_builder_get_widget(builder,"AutoDriverCombo"); widgets->FreeDriverCombo = yon_gtk_builder_get_widget(builder,"FreeDriverCombo"); widgets->FailsafeNvidiaCombo = yon_gtk_builder_get_widget(builder,"FailsafeNvidiaCombo"); @@ -828,6 +831,9 @@ template_main_window *yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->MoreButton),"clicked",G_CALLBACK(on_terminal_revealer_open),widgets); g_signal_connect(G_OBJECT(widgets->TerminalCancelButton),"clicked",G_CALLBACK(on_command_cancel),widgets); g_signal_connect(G_OBJECT(widgets->UnlockPacmanButton),"clicked",G_CALLBACK(on_pacman_db_unlock),NULL); + char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL); + yon_window_config_load(path); + gtk_overlay_add_overlay(GTK_OVERLAY(widgets->MainOverlay),widgets->MainSpinner); g_object_set_data(G_OBJECT(widgets->InstallTerminal),"widgets",widgets); { @@ -876,6 +882,7 @@ template_main_window *yon_main_window_complete(main_window *widgets){ on_config_local_load(NULL,widgets); yon_proprietary_get_thread(NULL,(main_window*)widgets); + gtk_spinner_stop(GTK_SPINNER(widgets->MainSpinner)); return (template_main_window*)widgets; } @@ -899,7 +906,6 @@ void config_init(){ main_config.progress_active=0; main_config.ports_table = g_hash_table_new_full(g_str_hash,g_str_equal,free,free); main_config.resolutions = g_hash_table_new_full(g_str_hash,g_str_equal,free,free); - yon_packages_init(); yon_monitor_set_resolutions(); yon_all_resolutions_update(); @@ -918,17 +924,15 @@ int main(int argc, char *argv[]){ gtk_init(&argc, &argv); template_main_window *widgets = yon_ubl_window_setup(); widgets = yon_main_window_complete((main_window*)widgets); - char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL); - yon_window_config_load(path); yon_root_button_setup(widgets,argv,argc); - // if (system(yon_check_database_command)){ - // dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); - // data->action_text=DATABASE_UNACCESSIBLE_LABEL; - // data->function = on_database_update; - // data->data = widgets; - // yon_confirmation_dialog_call(widgets->HeadOverlay,data); - // } + if (system(yon_check_database_command)){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text=DATABASE_UNACCESSIBLE_LABEL; + data->function = on_database_update; + data->data = widgets; + yon_confirmation_dialog_call(widgets->HeadOverlay,data); + } gtk_main(); yon_packages_finish(); return 0; diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index bde5ea7..9bfa0e8 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -161,6 +161,9 @@ typedef struct { template_window_fields GtkWidget *MainBox; + GtkWidget *MainOverlay; + GtkWidget *MainSpinner; + GtkWidget *AutoDriverCombo; GtkWidget *FreeDriverCombo; GtkWidget *FailsafeNvidiaCombo; diff --git a/ubl-settings-video.glade b/ubl-settings-video.glade index 3ef4295..f0740bb 100644 --- a/ubl-settings-video.glade +++ b/ubl-settings-video.glade @@ -22,6 +22,14 @@ start 64 + + True + False + True + + True False @@ -133,67 +141,99 @@ False com.ublinux.libublsettingsui-gtk3.lookup-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.changes-allow-symbolic + True False vertical - + True - True + False - - 165 + True True - 5 - 5 - 5 - never - + + 165 True - False + True + 5 + 5 + 5 + never - + True False - vertical - + True False - 0.019999999552965164 - in + vertical - + True False - 5 - 5 - 5 - 5 + 0.019999999552965164 + in - + True False - 5 + 5 + 5 + 5 + 5 True False - vertical 5 True False + vertical 5 - + True False - Choose driver automatically: + 5 + + + True + False + Choose driver automatically: + + + False + True + 0 + + + + + True + False + 0 + + Off + On + + + + True + True + 1 + + False @@ -202,24 +242,48 @@ - + True False - 0 - - Off - On - + 5 + + + True + False + Failsafe Nvidia driver: + + + False + True + 0 + + + + + True + False + 0 + + Off + fbdev + + + + True + True + 1 + + - True + False True 1 - False + True True 0 @@ -228,12 +292,43 @@ True False + vertical 5 - + True False - Failsafe Nvidia driver: + 5 + + + True + False + Free drivers: + + + False + True + 0 + + + + + True + False + 0 + + Switch nouveau and radeon off + Switch nouveau off + Switch radeon off + Switch free drvers on + + + + True + True + 1 + + False @@ -242,76 +337,97 @@ - + True False - 0 - - Off - fbdev - + 5 + + + True + False + Failsafe AMD/ATI driver: + + + False + True + 0 + + + + + True + False + 0 + + Off + fbdev + + + + True + True + 1 + + - True + False True 1 - False + True True 1 - - True - True - 0 - + + + + + True + False + Driver + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 0.019999999552965164 + in True False + 5 + 5 + 5 + 5 vertical - 5 - + True False - 5 - - - True - False - Free drivers: - - - False - True - 0 - - - - - True - False - 0 - - Switch nouveau and radeon off - Switch nouveau off - Switch radeon off - Switch free drvers on - - - - True - True - 1 - - + 150 + none + False False @@ -328,7 +444,7 @@ True False - Failsafe AMD/ATI driver: + Do not switch off display(-s) (DPMS global configuration): False @@ -337,17 +453,17 @@ - + True False 0 Off - fbdev + On - True + False True 1 @@ -356,39 +472,33 @@ False True + end 1 - - True - True - 1 - + + + + True + False + Monitor configuration + + + True + True + 0 + + + True + True + 1 + - - - True - False - Driver - - - - - False - True - 0 - - - - - True - False - vertical True @@ -396,28 +506,66 @@ 0.019999999552965164 in - + True False - 5 - 5 - 5 - 5 - vertical + 5 + 5 + 5 - + True False - 150 - none - False + vertical + + + True + False + 0 + + Automatic DPI + 96 DPI - 100% + 144 DPI - 150% (for 2K) + 192 DPI - 200% (for 4K) + + + + False + True + 0 + + - - False - True - 0 - + + + + + True + False + Display DPI + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 True @@ -427,7 +575,7 @@ True False - Do not switch off display(-s) (DPMS global configuration): + discrete video only (AMD/ATI): False @@ -436,7 +584,7 @@ - + True False 0 @@ -452,113 +600,334 @@ - - False - True - end - 1 - - + True False - Monitor configuration + 0 + Hybrid graphics - True + False True - 0 + 3 - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - in - + True False - 5 - 5 - 5 + 5 + 0.019999999552965164 + in - + True False - vertical + 5 + 5 + 5 - + True False - 0 - - Automatic DPI - 96 DPI - 100% - 144 DPI - 150% (for 2K) - 192 DPI - 200% (for 4K) - + vertical + 5 + + + True + False + 5 + + + True + False + Launch programs through optirun (Nvidia): + 0 + + + False + True + 0 + + + + + True + False + 0 + + Off + On + + + + False + True + 1 + + + + + True + False + True + + + True + True + 2 + + + + + True + False + True + True + image1 + + + False + True + 3 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Launch programs through primusrun (Nvidia): + 0 + + + False + True + 0 + + + + + True + False + 0 + + Off + On + + + + False + True + 1 + + + + + True + False + True + + + True + True + 2 + + + + + True + False + True + True + image2 + + + False + True + 3 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Fix frame gap (Nvidia): + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + Off + 1st variant. May cause perfomance drops in video games + 2nd variant. May not work on specific video cards + + + + True + True + 1 + + + + + False + True + 2 + + - - False - True - 0 - + + + True + False + Extra + + - - - - True - False - Display DPI - + + False + True + 4 + - - False - True - 2 - + + + + + + + True + False + Main settings + + + False + + + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + False - + True False - 0.019999999552965164 - in + vertical + 5 + + + True + False + 5 + + + True + False + Kernel: + + + False + True + 0 + + + + + True + False + 0 + + Default (All installed) + + + + True + True + 1 + + + + + False + True + 0 + + - + True False - 5 - 5 - 5 + 5 True False + vertical 5 - + True - False - discrete video only (AMD/ATI): + True + True + Update + image3 + False @@ -567,14 +936,9 @@ - + True False - 0 - - Off - On - False @@ -582,335 +946,88 @@ 1 - - - - - - - True - False - 0 - Hybrid graphics - - - - - False - True - 3 - - - - - True - False - 5 - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - - - True - False - vertical - 5 - + True - False - 5 - - - True - False - Launch programs through optirun (Nvidia): - 0 - - - False - True - 0 - - - - - True - False - 0 - - Off - On - - - - False - True - 1 - - - - - True - False - True - - - True - True - 2 - - - - - True - False - True - True - image1 - - - False - True - 3 - - + False + True + True + Supported Devices + image4 + False True - 0 + 2 - + True - False - 5 - - - True - False - Launch programs through primusrun (Nvidia): - 0 - - - False - True - 0 - - - - - True - False - 0 - - Off - On - - - - False - True - 1 - - - - - True - False - True - - - True - True - 2 - - - - - True - False - True - True - image2 - - - False - True - 3 - - + False + True + True + Module information + image10 + False True - 1 + 3 - + + True + False + True + True + Package information + image5 + + + + False + True + 4 + + + + True False - 5 - - - True - False - Fix frame gap (Nvidia): - 0 - - - False - True - 0 - - - - - True - False - 0 - - Default - Off - 1st variant. May cause perfomance drops in video games - 2nd variant. May not work on specific video cards - - - - True - True - 1 - - False True - 2 + 5 + + + + + True + True + True + Unlock the pacman package manager database + image6 + + + + False + True + 6 - - - - - - - True - False - Extra - - - - - False - True - 4 - - - - - - - - - - - True - False - Main settings - - - False - - - - - True - False - 5 - 5 - 5 - 5 - vertical - - - True - False - - - True - False - vertical - 5 - - - True - False - 5 - - - True - False - Kernel: - - - False - True - 0 - - - - - True - False - 0 - - Default (All installed) - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - False - vertical - 5 - - - True - True - True - Update - image3 - False @@ -919,157 +1036,39 @@ - + True False - - - False - True - 1 - - - - - True - False - True - True - Supported Devices - image4 - - - - False - True - 2 - - - - - True - False - True - True - Module information - image10 - - - - False - True - 3 - - - - - True - False - True - True - Package information - image5 - - - - False - True - 4 - - - - - True - False - - - False - True - 5 - - - - - True - True - True - Unlock the pacman package manager database - image6 - - - - False - True - 6 - - - - - False - True - 0 - - - - - True - False - - - True - False - vertical - 5 - + True False vertical + 5 - + True False - 3 - 3 - 5 + vertical True False - vertical - - - True - False - Installed - 0 - 0 - - - False - True - 0 - - + 3 + 3 + 5 - + True False - 5 + vertical - + True False - Module + Installed 0 + 0 False @@ -1078,9 +1077,48 @@ - + True False + 5 + + + True + False + Module + 0 + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + Package + 0 + 0 + + + False + True + 2 + + False @@ -1088,20 +1126,17 @@ 1 - - - True - False - Package - 0 - 0 - - - False - True - 2 - - + + + False + True + 0 + + + + + True + False False @@ -1109,224 +1144,227 @@ 1 + + + True + False + Kernel + 0 + 1 + + + False + True + 2 + + + + + True + False + + + False + True + 3 + + + + + True + False + Driver + 0 + 1 + + + False + True + 4 + + + + + True + False + + + False + True + 5 + + + + + True + False + Description + 0 + 1 + + + False + True + 6 + + + + + True + False + + + False + True + 7 + + + + + True + False + Supported devices + 0 + 1 + + + True + True + 8 + + False True - 0 - - - - - True - False - - - False - True - 1 - - - - - True - False - Kernel - 0 - 1 - - - False - True - 2 - - - - - True - False - - - False - True - 3 - - - - - True - False - Driver - 0 - 1 - - - False - True - 4 - - - - - True - False - - - False - True - 5 - - - - - True - False - Description - 0 - 1 - - - False - True - 6 - - - - - True - False - - - False - True - 7 + 0 - + True - False - Supported devices - 0 - 1 + True + in + + + True + False + + + True + False + + + + + True True - 8 + 1 - False + True True 0 - - True + True - in + vertical + 250 + True + True - - True - False - - - True - False - - - - + + + + True True - 1 + 2 - - - True - True - 0 - - - - - True - vertical - 250 - True - True - - - - - - - - - True - True - 2 - - - - - True - True - False - True - + True + True False - 0 - in + True - + True False + 0 + in - + True False - vertical True False - 5 - 5 - 5 - 5 - 5 - 5 + vertical - + True - True False - center - - - True - True - 0 - - - - - Cancel - True - True - True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + True + False + center + + + True + True + 0 + + + + + Cancel + True + True + True + + + False + True + 1 + + + + + More + True + True + True + True + + + False + True + 2 + + False @@ -1334,58 +1372,44 @@ 1 - - - More - True - True - True - True - - - False - True - 2 - - - - False - True - 1 - - - - - - True - False + + + True + False + + + + + False + True + end + 3 + - - False - True - end - 3 + -1 - -1 + True + True + 1 @@ -1395,90 +1419,107 @@ 1 + - True - True - 1 + -1 - - -1 + True + True + 0 - True - True - 0 + 1 + + + + + True + False + Drivers + + + 1 + False - - - 1 - - - - - True - False - Drivers - - - 1 - False - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 0.009999999776482582 - in - + True False - 12 + 5 + 5 + 5 + 5 + 5 + 5 + 0.009999999776482582 + in - + True False - vertical - 20 + 12 True False + vertical + 20 - - 177 - 159 + True False - start - start - + + 177 + 159 True False start - end - 128 - com.ublinux.ubl-settings-video.video-card + start + + + True + False + start + end + 128 + com.ublinux.ubl-settings-video.video-card + + + -1 + + + + + False + True + 0 + + + + + True + False + start + 30 + <span size='15pt'><span color='#1a5fb4'></span> </span> + True + 0 + 0 - -1 + False + True + 1 @@ -1489,70 +1530,53 @@ - - True - False - start - 30 - <span size='15pt'><span color='#1a5fb4'></span> </span> - True - 0 - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - - - 177 - 159 + True False - start - start - + + 177 + 159 True False start - end - 128 - com.ublinux.ubl-settings-video.video-card + start + + + True + False + start + end + 128 + com.ublinux.ubl-settings-video.video-card + + + -1 + + - -1 + False + True + 0 + + + + + True + False + start + 30 + True + 0 + 0 + + + False + True + 1 - - - False - True - 0 - - - - - True - False - start - 30 - True - 0 - 0 False @@ -1561,39 +1585,37 @@ - - False - True - 1 - + + + True + False + 5 + 5 + Devices and Drivers + + + + 2 + - - + + True False - 5 - 5 - Devices and Drivers + Information + + 2 + False + - 2 - - - - - True - False - Information - - - 2 - False + -1 @@ -1611,11 +1633,6 @@ - - True - False - com.ublinux.libublsettingsui-gtk3.changes-allow-symbolic -