|
|
|
|
@ -51,7 +51,7 @@ void on_repo_sign_changed(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->storages_copy),&itar,child_id)){
|
|
|
|
|
if (!yon_char_is_empty(sign)){
|
|
|
|
|
gtk_tree_store_set(window->storages_copy,&itar,6,1,5,sign,-1);
|
|
|
|
|
if (!system(yon_sign_repo(storage_path,target_repo,sign))){
|
|
|
|
|
if (system(yon_sign_repo(storage_path,target_repo,sign))){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX((GtkWidget*)g_list_nth_data(list,2)),0);
|
|
|
|
|
}
|
|
|
|
|
}else
|
|
|
|
|
@ -61,7 +61,7 @@ void on_repo_sign_changed(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_storage_config_update(storage_config_window *window){
|
|
|
|
|
void yon_storage_config_update(storage_config_window *window){
|
|
|
|
|
GList *children = gtk_container_get_children(GTK_CONTAINER(window->ReposBox));
|
|
|
|
|
for (int i=0;i<g_list_length(children);i++){
|
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(children,i));
|
|
|
|
|
@ -1101,6 +1101,32 @@ void on_main_tree_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_package_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InformationLabel),"");
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
GtkTreeModel *model, *model2;
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoFileTree)),&model,&iter)){
|
|
|
|
|
gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->ReposTree)),&model2,&itar);
|
|
|
|
|
switch (gtk_tree_store_iter_depth(widgets->RepoList,&itar)){
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
char *path, *filename;
|
|
|
|
|
gtk_tree_model_get(model,&iter,3,&filename,-1);
|
|
|
|
|
gtk_tree_model_get(model2,&itar,3,&path,-1);
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_config_load(get_package_info_command(yon_char_unite(path,"/",filename,NULL)),&size);
|
|
|
|
|
char *full = yon_char_parsed_to_string(parsed,size,"");
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InformationLabel),full);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
free(full);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_combo_box_text_set_signs(GtkComboBoxText *target){
|
|
|
|
|
g_return_if_fail(GTK_IS_COMBO_BOX_TEXT(target));
|
|
|
|
|
gtk_combo_box_text_remove_all(target);
|
|
|
|
|
@ -1130,6 +1156,30 @@ void on_calendar_open(GtkWidget *self,key_creation_window *window){
|
|
|
|
|
yon_calendar_popover_open(GTK_ENTRY(window->ExpireEntry),self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_key_generate_accept(GtkWidget *self, key_creation_window* window){
|
|
|
|
|
const char *name = gtk_entry_get_text(GTK_ENTRY(window->NameEntry));
|
|
|
|
|
const char *type = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
const char *email = gtk_entry_get_text(GTK_ENTRY(window->EmailEntry));
|
|
|
|
|
char *strength = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->KeyStrengthSpin)));
|
|
|
|
|
const char *comment = gtk_entry_get_text(GTK_ENTRY(window->CommentsEntry));
|
|
|
|
|
char *expire = NULL;
|
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->ExpireCombo))==1){
|
|
|
|
|
expire = yon_char_from_int(yon_calendar_get_last_date());
|
|
|
|
|
}
|
|
|
|
|
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
const char *password_confirm = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
if (yon_char_is_empty(password)&&yon_char_is_empty(password_confirm)){
|
|
|
|
|
system(yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password));
|
|
|
|
|
} else if (!strcmp(password,password_confirm)){
|
|
|
|
|
system(yon_generate_key_command(type,name,email,strength,comment,expire,password));
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_INCORRECT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
yon_sign_list_update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key_creation_window *yon_key_creation_window_new(){
|
|
|
|
|
key_creation_window *window = malloc(sizeof(key_creation_window));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_key);
|
|
|
|
|
@ -1146,18 +1196,22 @@ key_creation_window *yon_key_creation_window_new(){
|
|
|
|
|
window->ExpireButton = yon_gtk_builder_get_widget(builder,"ExpireButton");
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
|
|
|
|
|
window->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry");
|
|
|
|
|
window->PasswordConfirmationEntry = yon_gtk_builder_get_widget(builder,"PasswordConfirmationEntry");
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ExpireButton),"clicked",G_CALLBACK(on_calendar_open),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_key_generate_accept),window);
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
config_str encription_keys = yon_file_open(key_encription_path,&size);
|
|
|
|
|
window->expire_time=0;
|
|
|
|
|
|
|
|
|
|
for (int i=1;i<size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(encription_keys[i],'\n');
|
|
|
|
|
int parsed_size;
|
|
|
|
|
config_str parsed = yon_char_parse(encription_keys[i],&parsed_size,";");
|
|
|
|
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),parsed[0]);
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),parsed[2],parsed[0]);
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
}
|
|
|
|
|
return window;
|
|
|
|
|
@ -1214,6 +1268,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_remove_clicked),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ReposTree),"cursor-changed",G_CALLBACK(on_main_tree_selection_changed),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->CloudButton),"clicked",G_CALLBACK(on_ubl_settings_update_launch),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RepoFileTree),"cursor-changed",G_CALLBACK(on_package_selection_changed),widgets);
|
|
|
|
|
yon_calendar_set_date_orientation(1);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(widgets->Window),TITLE_LABEL);
|
|
|
|
|
|
|
|
|
|
|