diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 7d7af83..7ed1736 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -796,37 +796,15 @@ void on_repo_edit(GtkWidget *,main_window *widgets){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SignDefaultCheck),0); int cur_size; config_str siglevel = yon_char_parse(parsed[1],&cur_size,","); - if (!strcmp(siglevel[0],"Never")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NeverRadio),1); - } else if (!strcmp(siglevel[0],"Optional")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->OptionalRadio),1); - } else if (!strcmp(siglevel[0],"Required")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RequiredRadio),1); - } else if (!strcmp(siglevel[0],"TrustedOnly")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->TrustedOnlyRadio),1); - } else if (!strcmp(siglevel[0],"TrustAll")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->TrustAllRadio),1); - } - if (!strcmp(siglevel[1],"PackageNever")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageNeverRadio),1); - } else if (!strcmp(siglevel[1],"DatabaseNever")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseNeverRadio),1); - } else if (!strcmp(siglevel[1],"PackageOptional")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageOptionalRadio),1); - } else if (!strcmp(siglevel[1],"DatabaseOptional")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseOptionalRadio),1); - } else if (!strcmp(siglevel[1],"PackageRequired")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageRequiredRadio),1); - } else if (!strcmp(siglevel[1],"DatabaseRequired")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseRequiredRadio),1); - } else if (!strcmp(siglevel[1],"PackageTrustedOnly")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageTrustedOnlyRadio),1); - } else if (!strcmp(siglevel[1],"DatabaseTrustedOnly")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustedOnlyRadio),1); - } else if (!strcmp(siglevel[1],"PackageTrustAll")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageTrustAllRadio),1); - } else if (!strcmp(siglevel[1],"DatabaseTrustAll")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustAllRadio),1); + + GtkTreeModel *model = GTK_TREE_MODEL(window->SignList); + GtkTreeIter iter; + for_iter (model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,1,&target,-1); + if (yon_char_parsed_check_exist(siglevel,cur_size,target)>-1){ + gtk_list_store_set(window->SignList,&iter,0,1,-1); + } } } if (size>2&&!yon_char_is_empty(parsed[2])){ @@ -1073,40 +1051,20 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){ return; } - char *sign_level_package = ""; - char *sign_level_condiition = ""; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NeverRadio))){ - sign_level_package="Never"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->OptionalRadio))){ - sign_level_package="Optional"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->RequiredRadio))){ - sign_level_package="Required"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->TrustedOnlyRadio))){ - sign_level_package="TrustedOnly"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->TrustAllRadio))){ - sign_level_package="TrustAll"; - } - - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PackageNeverRadio))){ - sign_level_condiition="PackageNever"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseNeverRadio))){ - sign_level_condiition="DatabaseNever"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PackageOptionalRadio))){ - sign_level_condiition="PackageOptional"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseOptionalRadio))){ - sign_level_condiition="DatabaseOptional"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PackageRequiredRadio))){ - sign_level_condiition="PackageRequired"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseRequiredRadio))){ - sign_level_condiition="DatabaseRequired"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PackageTrustedOnlyRadio))){ - sign_level_condiition="PackageTrustedOnly"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustedOnlyRadio))){ - sign_level_condiition="DatabaseTrustedOnly"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PackageTrustAllRadio))){ - sign_level_condiition="PackageTrustAll"; - } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustAllRadio))){ - sign_level_condiition="DatabaseTrustAll"; + char *sign_level= ""; + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SignDefaultCheck))){ + GtkTreeModel *model = GTK_TREE_MODEL(window->SignList); + GtkTreeIter iter; + for_iter (model,&iter){ + int status; + char *target; + gtk_tree_model_get(model,&iter,0,&status,1,&target,-1); + if (status){ + char *temp = yon_char_unite(sign_level,!yon_char_is_empty(sign_level)?",":"",target,NULL); + if (!yon_char_is_empty(sign_level)) free(sign_level); + sign_level= temp; + } + } } char *usage = ""; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageDefaultCheck))){ @@ -1132,7 +1090,7 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){ } } - char *final = yon_char_unite(sources,";",sign_level_package,",",sign_level_condiition,";",usage,";",enabled?"":"disable",NULL); + char *final = yon_char_unite(sources,";",sign_level,";",usage,";",enabled?"":"disable",NULL); if (!yon_char_is_empty(window->name)&&strcmp(repo_name,window->name)){ yon_config_remove_by_key(REOSITORY_command(window->name)); @@ -1483,23 +1441,19 @@ password_window *yon_password_window_new(){ return window; } +void on_sign_cell_toggled(GtkWidget *, char *path, repo_add_window *window){ + GtkTreeModel *model = GTK_TREE_MODEL(window->SignList); + GtkTreeIter check_iter; + if (gtk_tree_model_get_iter_from_string(model,&check_iter,path)){ + int check_status; + gtk_tree_model_get(model,&check_iter,0,&check_status,-1); + gtk_list_store_set(window->SignList,&check_iter,0,!check_status,-1); + } +} + void on_sign_check_toggled(GtkToggleButton *self, repo_add_window *window){ int status = gtk_toggle_button_get_active(self); - gtk_widget_set_sensitive(window->NeverRadio,!status); - gtk_widget_set_sensitive(window->OptionalRadio,!status); - gtk_widget_set_sensitive(window->RequiredRadio,!status); - gtk_widget_set_sensitive(window->TrustedOnlyRadio,!status); - gtk_widget_set_sensitive(window->TrustAllRadio,!status); - gtk_widget_set_sensitive(window->PackageNeverRadio,!status); - gtk_widget_set_sensitive(window->DatabaseNeverRadio,!status); - gtk_widget_set_sensitive(window->PackageOptionalRadio,!status); - gtk_widget_set_sensitive(window->DatabaseOptionalRadio,!status); - gtk_widget_set_sensitive(window->PackageRequiredRadio,!status); - gtk_widget_set_sensitive(window->DatabaseRequiredRadio,!status); - gtk_widget_set_sensitive(window->PackageTrustedOnlyRadio,!status); - gtk_widget_set_sensitive(window->DatabaseTrustedOnlyRadio,!status); - gtk_widget_set_sensitive(window->PackageTrustAllRadio,!status); - gtk_widget_set_sensitive(window->DatabaseTrustAllRadio,!status); + gtk_widget_set_sensitive(window->SignTree,!status); } repo_add_window *yon_repo_add_window_new(){ @@ -1527,21 +1481,9 @@ repo_add_window *yon_repo_add_window_new(){ window->SourceListBox = yon_gtk_builder_get_widget(builder,"SourceListBox"); window->RepoSourceAddButton = yon_gtk_builder_get_widget(builder,"RepoSourceAddButton"); window->SignDefaultCheck = yon_gtk_builder_get_widget(builder,"SignDefaultCheck"); - window->NeverRadio = yon_gtk_builder_get_widget(builder,"NeverRadio"); - window->OptionalRadio = yon_gtk_builder_get_widget(builder,"OptionalRadio"); - window->RequiredRadio = yon_gtk_builder_get_widget(builder,"RequiredRadio"); - window->TrustedOnlyRadio = yon_gtk_builder_get_widget(builder,"TrustedOnlyRadio"); - window->TrustAllRadio = yon_gtk_builder_get_widget(builder,"TrustAllRadio"); - window->PackageNeverRadio = yon_gtk_builder_get_widget(builder,"PackageNeverRadio"); - window->DatabaseNeverRadio = yon_gtk_builder_get_widget(builder,"DatabaseNeverRadio"); - window->PackageOptionalRadio = yon_gtk_builder_get_widget(builder,"PackageOptionalRadio"); - window->DatabaseOptionalRadio = yon_gtk_builder_get_widget(builder,"DatabaseOptionalRadio"); - window->PackageRequiredRadio = yon_gtk_builder_get_widget(builder,"PackageRequiredRadio"); - window->DatabaseRequiredRadio = yon_gtk_builder_get_widget(builder,"DatabaseRequiredRadio"); - window->PackageTrustedOnlyRadio = yon_gtk_builder_get_widget(builder,"PackageTrustedOnlyRadio"); - window->DatabaseTrustedOnlyRadio = yon_gtk_builder_get_widget(builder,"DatabaseTrustedOnlyRadio"); - window->PackageTrustAllRadio = yon_gtk_builder_get_widget(builder,"PackageTrustAllRadio"); - window->DatabaseTrustAllRadio = yon_gtk_builder_get_widget(builder,"DatabaseTrustAllRadio"); + window->SignTree = yon_gtk_builder_get_widget(builder,"SignTree"); + window->SignCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"SignCell")); + window->SignList = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); window->sections = NULL; window->name=NULL; @@ -1554,9 +1496,9 @@ repo_add_window *yon_repo_add_window_new(){ g_signal_connect(G_OBJECT(window->UsageDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UsageSysupgradeCheck); g_signal_connect(G_OBJECT(window->SignDefaultCheck),"toggled",G_CALLBACK(on_sign_check_toggled),window); + g_signal_connect(G_OBJECT(window->SignCell),"toggled",G_CALLBACK(on_sign_cell_toggled),window); // g_signal_connect(G_OBJECT(window->SourceListBox),"size-allocate",G_CALLBACK(on_scrolled_window_size_allocate),window); gtk_widget_show(window->Window); - gtk_label_set_text(GTK_LABEL(window->SignLevelLabel),SIGN_LEVEL_LABEL); return window; } diff --git a/source/ubl-settings-update.h b/source/ubl-settings-update.h index 6a5cf4d..7602ca5 100644 --- a/source/ubl-settings-update.h +++ b/source/ubl-settings-update.h @@ -172,21 +172,10 @@ typedef struct { GtkWidget *SignLevelLabel; GtkWidget *SignDefaultCheck; - GtkWidget *NeverRadio; - GtkWidget *OptionalRadio; - GtkWidget *RequiredRadio; - GtkWidget *TrustedOnlyRadio; - GtkWidget *TrustAllRadio; - GtkWidget *PackageNeverRadio; - GtkWidget *DatabaseNeverRadio; - GtkWidget *PackageOptionalRadio; - GtkWidget *DatabaseOptionalRadio; - GtkWidget *PackageRequiredRadio; - GtkWidget *DatabaseRequiredRadio; - GtkWidget *PackageTrustedOnlyRadio; - GtkWidget *DatabaseTrustedOnlyRadio; - GtkWidget *PackageTrustAllRadio; - GtkWidget *DatabaseTrustAllRadio; + GtkWidget *SignTree; + GtkCellRenderer *SignCell; + + GtkListStore *SignList; char *name; } repo_add_window; @@ -331,6 +320,8 @@ void on_password_open(GtkWidget *, web_publication_add_window *window); void on_scrolled_window_size_allocate(GtkWidget *, GdkRectangle *allocation, repo_add_window *window); +void on_sign_cell_toggled(GtkWidget *, char *path, repo_add_window *window); + void on_sign_check_toggled(GtkToggleButton *self, repo_add_window *window); password_window *yon_password_window_new(); diff --git a/ubl-settings-update-repo-add.glade b/ubl-settings-update-repo-add.glade index 088f105..80cf079 100644 --- a/ubl-settings-update-repo-add.glade +++ b/ubl-settings-update-repo-add.glade @@ -304,558 +304,78 @@ Configuration - configuration path True False + vertical 5 - + + Default True - False - vertical - 5 + True + False + True + True + + + False + True + 0 + + + + + True + True + in + 200 - - Default + True + False True - False - True - True - - - False - True - 0 - - - - - True - False - 5 - - - Never - True - False - True - False - Signature verification will not be performed - True - True - RequiredRadio - - - False - True - 0 - - - - - PackageNever - True - False - True - False - For packages only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - 5 - - - Optional - True - False - True - False - Signatures will be checked if present, but unsigned databases and packages will also be accepted - True - True - RequiredRadio - - - False - True - 0 - + liststore1 + 0 + both + + - - DatabaseNever - True - False - True - False - For database only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - 5 - - - Required - True - False - True - False - Signatures will be required for all packages and databases - True - True - - - False - True - 0 - - - - - PackageOptional - True - False - True - False - For packages only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - 5 - - - TrustedOnly - True - False - True - False - Signatures will be required for all packages and databases - True - True - RequiredRadio - - - False - True - 0 - - - - - DatabaseOptional - True - False - True - False - For database only - True - True - - - False - True - 1 - - - - - False - True - 4 - - - - - True - False - 5 - - - TrustAll - True - False - True - False - If the signature is verified for packages and the database, it must be in the keyring and be fully trusted - True - True - RequiredRadio - - - False - True - 0 - - - - - PackageRequired - True - False - True - False - For packages only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 5 - - - - - True - False - 5 - - - True - False + - + + + 0 + - - False - True - 0 - - - - - DatabaseRequired - True - False - True - False - For database only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - False - True - 6 - - - - - True - False - 5 - - - True - False - - - - - - False - True - 0 - - - - - PackageTrustedOnly - True - False - True - False - For packages only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 7 - - - - - True - False - 5 - - - True - False - - - - - - False - True - 0 - - - - - DatabaseTrustedOnly - True - False - True - False - For database only - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - - False - True - 8 - - - - - True - False - 5 - - True - False + + Sign level - + + + 1 + - - False - True - 0 - - - - - PackageTrustAll - True - False - True - False - If the signature is verified only for packets - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - - False - True - 9 - - - - - True - False - 5 - - True - False + + Description - + + + 2 + - - False - True - 0 - - - - - DatabaseTrustAll - True - False - True - False - If the signature is verified only for the database - True - True - DatabaseOptionalRadio - - - False - True - 1 - - - False - True - 10 - False True - 0 - - - - - True - False - 0 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - True - never - - - True - False - - - True - False - 5 - 5 - - Never - Signature verification will not be performed. Primary -\t- PackageNever - Packages only. Secondary -\t- DatabaseNever - Database only. Secondary -- Optional - Signatures will be verified if present, but unsigned databases and packages will also be accepted. Primary -\t- PackageOptional - Packages only. Secondary -\t- DatabaseOptional - Database only. -- Required - Signatures will be required for all packages and databases. Primary -\t- PackageRequired - Packages only. Secondary -\t- DatabaseRequired - Database only. Secondary -- TrustedOnly - If signature is verified for packages and database, it must be in the keyring and fully trusted; marginal trust not applicable -\t- PackageTrustedOnly - If signature is verified only for packages -\t- DatabaseTrustedOnly - If signature is verified only for database -- TrustAll - If signature is verified, it must be in keyring, but does not need to have a trust level assigned (e.g. unknown or marginal trust) -\t- PackageTrustAll - If signature is verified only for packages -\t- DatabaseTrustAll - If signature is verified only for database - True - 0 - 0 - - - - - - - - - - - - - - - - - True - True 1 @@ -1095,24 +615,91 @@ Configuration - configuration path - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + False + Never + Signature verification will not be performed + + + False + Optional + Signatures will be verified if present, but unsigned databases and packages will also be accepted + + + True + Required + Signatures will be required for all packages and databases + + + False + TrustedOnly + If signature is verified for packages and database, it must be in the keyring and fully trusted; marginal trust not applicable + + + False + TrustAll + If signature is verified, it must be in keyring, but does not need to have a trust level assigned (e.g. unknown or marginal trust) + + + False + PackageNever + Packages only + + + False + DatabaseNever + Database only + + + False + PackageOptional + Packages only + + + True + DatabaseOptional + Database only + + + False + PackageRequired + Packages only + + + False + DatabaseRequired + Database only + + + False + PackageTrustedOnly + If signature is verified only for packages + + + False + DatabaseTrustedOnly + If signature is verified only for database + + + False + PackageTrustAll + If signature is verified only for packages + + + False + DatabaseTrustAll + If signature is verified only for database + +