From 0d54ff7e53762f8d60c34a0cece1a8ca8585383b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 17 Dec 2024 15:16:34 +0600 Subject: [PATCH] Fixed tables saving --- source/ubl-settings-update.c | 24 ++++++++++++++++++------ source/ubl-settings-update.h | 2 +- ubl-settings-update-repo-add.glade | 6 ++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 23ea47f..2fda8b5 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -75,7 +75,7 @@ void on_toggle_button_toggled(GtkWidget *self, main_window *widgets){ } - } else if (self == widgets->UpdateRepoListCheck){ + } else if (self == widgets->UpdateRepoListCheck||self == widgets->UpdateRepoTree){ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UpdateRepoListCheck))){ yon_config_remove_by_key(AUTOUPDATE_repos); } else { @@ -105,7 +105,7 @@ void on_toggle_button_toggled(GtkWidget *self, main_window *widgets){ yon_config_register(REPOSITORY_parameter,REPOSITORY_parameter_command,"disable"); } - } else if (self == widgets->PublicationConnectPublicCheck||self == widgets->RecieveDBFromNetCheck){ + } else if (self == widgets->PublicationConnectPublicCheck||self == widgets->RecieveDBFromNetCheck||self == widgets->PublicationCheck||self == widgets->PublicationTree){ char *repo_net = ""; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PublicationConnectPublicCheck))){ repo_net = NULL; @@ -154,7 +154,7 @@ void on_toggle_button_toggled(GtkWidget *self, main_window *widgets){ } - } + } } void yon_load_proceed(YON_CONFIG_TYPE type){ @@ -507,12 +507,24 @@ void on_config_custom_load(GtkWidget *,main_window *widgets){ yon_interface_update(widgets); } -void on_toggle_cell_toggled(GtkWidget *,char *path, GtkListStore *target){ +void on_toggle_cell_toggled(GtkCellRenderer *self,char *path, main_window *widgets){ + GtkListStore *target = NULL; + GtkWidget *table = NULL; + if (self == widgets->UpdateToggleCell){ + target = widgets->UpdateRepoList; + table = widgets->UpdateRepoTree; + } else if (self == widgets->PublicationToggleCell){ + target = widgets->PublicationList; + table = widgets->PublicationTree; + + } GtkTreeIter iter; int status; gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(target),&iter,path); gtk_tree_model_get(GTK_TREE_MODEL(target),&iter,0,&status,-1); gtk_list_store_set(GTK_LIST_STORE(target),&iter,0,!status,-1); + + on_toggle_button_toggled(table,widgets); } /**config_init() @@ -1688,8 +1700,8 @@ void yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets); g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); - g_signal_connect(G_OBJECT(widgets->UpdateToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets->UpdateRepoList); - g_signal_connect(G_OBJECT(widgets->PublicationToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets->PublicationList); + g_signal_connect(G_OBJECT(widgets->UpdateToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets); + g_signal_connect(G_OBJECT(widgets->PublicationToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets); g_signal_connect(G_OBJECT(widgets->UpdateRepoListCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->UpdateRepoTree); g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationTree); diff --git a/source/ubl-settings-update.h b/source/ubl-settings-update.h index ee5cc72..38e95d7 100644 --- a/source/ubl-settings-update.h +++ b/source/ubl-settings-update.h @@ -304,7 +304,7 @@ void on_config_local_load(GtkWidget *, main_window *widgets); void on_config_global_load(GtkWidget *, main_window *widgets); void on_config_custom_load(GtkWidget *,main_window *widgets); -void on_toggle_cell_toggled(GtkWidget *,char *path, GtkListStore *target); +void on_toggle_cell_toggled(GtkCellRenderer *,char *path, main_window *widgets); char *on_save_repos(main_window *widgets); diff --git a/ubl-settings-update-repo-add.glade b/ubl-settings-update-repo-add.glade index 34d9cfc..492a475 100644 --- a/ubl-settings-update-repo-add.glade +++ b/ubl-settings-update-repo-add.glade @@ -922,6 +922,9 @@ Configuration - configuration path True + False @@ -941,6 +944,9 @@ Configuration - configuration path False Allow this repository to be a valid source of packages when running --sysupgrade True +