From 20eee2ebbe64ebe403ac8ba7fa3bbfd0f4e603ca Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 10 May 2023 17:41:04 +0600 Subject: [PATCH] Added command for saving local and global config --- source/ubl-settings-video.c | 34 ++++++++++++++++++++++++---------- source/ubl-settings-video.h | 3 +++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/source/ubl-settings-video.c b/source/ubl-settings-video.c index b18ea2c..9b223b3 100644 --- a/source/ubl-settings-video.c +++ b/source/ubl-settings-video.c @@ -372,10 +372,10 @@ void on_configuration_save_local(GtkWidget *self, widgets_dict *widgets) char *str=NULL; char *delstr=NULL; str=yon_configuration_get_save_command(save_drivers_local_command); - delstr=yon_configuration_get_remove_command(remove_drivers_local_command); - if (delstr){ - yon_config_save(delstr); - } + // delstr=yon_configuration_get_remove_command(remove_drivers_local_command); + // if (delstr){ + // yon_config_save(delstr); + // } if (str){ yon_config_save(str); @@ -389,23 +389,37 @@ void on_configuration_save_local(GtkWidget *self, widgets_dict *widgets) void on_configuration_save_local_global(GtkWidget *self, widgets_dict *widgets) { - on_configuration_save_global(self, widgets); - on_configuration_save_local(self, widgets); + on_configuration_save_global_local(self, widgets); videoconfig.status_render.text_to_render=GLOBAL_LOCAL_SAVE_SUCCESS; videoconfig.status_render.type=BACKGROUND_IMAGE_SUCCESS_TYPE; yon_ubl_status_box_render(&videoconfig.status_render); } +void on_configuration_save_global_local(GtkWidget *self, widgets_dict *widgets) +{ + yon_update_config(widgets); + char *str=NULL; + char *delstr=NULL; + str=yon_configuration_get_save_command(save_drivers_global_local_command); + if (str){ + yon_config_save(str); + + videoconfig.status_render.text_to_render=LOCAL_SAVE_SUCCESS; + videoconfig.status_render.type=BACKGROUND_IMAGE_SUCCESS_TYPE; + yon_ubl_status_box_render(&videoconfig.status_render); + } +} + void on_configuration_save_global(GtkWidget *self, widgets_dict *widgets) { yon_update_config(widgets); char *str=NULL; char *delstr=NULL; str=yon_configuration_get_save_command(save_drivers_global_command); - delstr=yon_configuration_get_remove_command(remove_drivers_global_command); - if (delstr){ - yon_config_save(delstr); - } + // delstr=yon_configuration_get_remove_command(remove_drivers_global_command); + // if (delstr){ + // yon_config_save(delstr); + // } if (str){ yon_config_save(str); diff --git a/source/ubl-settings-video.h b/source/ubl-settings-video.h index 463aca9..20cef22 100644 --- a/source/ubl-settings-video.h +++ b/source/ubl-settings-video.h @@ -47,6 +47,8 @@ #define save_drivers_global_command "pkexec /usr/bin/ubconfig --target global --noexecute set video " +#define save_drivers_global_local_command "pkexec /usr/bin/ubconfig --noexecute set video " + #define load_drivers_local_command "/usr/bin/ubconfig --default --source system get video FAILSAFENVIDIA FAILSAFEATI OPTIRUN PRIMUSRUN VGADRV_AUTO " #define save_drivers_local_command "pkexec /usr/bin/ubconfig --target system --noexecute set video " @@ -344,6 +346,7 @@ void yon_monitor_set_resolutions(); monitor_config yon_monitor_config_new(char *port); void yon_monitor_config_update(monitorconfig* monitor, char *port, char *config_string); void yon_monitor_view_new(monitor_config monitor); +void on_configuration_save_global_local(GtkWidget *self, widgets_dict *widgets); // void on_confugure_monitor_settings(GtkWidget *self, MonitorSettings *settings); void yon_monitor_view_draw_all(GtkWidget *cnt); void on_monitor_configure(GtkWidget *self,monitor_window *window);