|
|
|
@ -53,17 +53,43 @@ void on_add_target_package_selection_changed(GtkWidget *target,repo_add_window *
|
|
|
|
void on_add_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
void on_add_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
repo_add_window *window = yon_dictionary_get_data(dict->first,repo_add_window*);
|
|
|
|
repo_add_window *window = yon_dictionary_get_data(dict->first,repo_add_window*);
|
|
|
|
filechooser_window *dialog = yon_dictionary_get_data(dict->first->next,filechooser_window*);
|
|
|
|
filechooser_window *dialog = yon_dictionary_get_data(dict->first->next,filechooser_window*);
|
|
|
|
char *file = dialog->last_success_selection;
|
|
|
|
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
if (!yon_char_is_empty(file)){
|
|
|
|
config_str packages = yon_char_parse(dialog->last_success_selection,&size,",");
|
|
|
|
config_str package_name = yon_config_load(yon_get_package_name_from_filename(file),&size);
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
if (size){
|
|
|
|
if (yon_file_is_directory(packages[i])){
|
|
|
|
yon_char_remove_last_symbol(package_name[0],'\n');
|
|
|
|
int dir_size;
|
|
|
|
|
|
|
|
config_str files = yon_file_ls(packages[i],&dir_size);
|
|
|
|
|
|
|
|
for (int k=0;k<dir_size;k++){
|
|
|
|
|
|
|
|
if (strstr(files[k],".pkg.tar")&&!strstr(files[k],".sig")){
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
int temp_size;
|
|
|
|
|
|
|
|
char *full_path = yon_char_unite(packages[i],"/",files[k],NULL);
|
|
|
|
|
|
|
|
config_str name = yon_config_load(yon_get_package_name_from_filename(full_path),&temp_size);
|
|
|
|
|
|
|
|
if (name&&!yon_char_is_empty(name[0]))
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(name[0],'\n');
|
|
|
|
|
|
|
|
gtk_list_store_append(window->PackagesList,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->PackagesList,&iter,1,name&&!yon_char_is_empty(name[0])?name[0]:"",2,full_path,-1);
|
|
|
|
|
|
|
|
free(full_path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
int temp_size;
|
|
|
|
|
|
|
|
config_str name = yon_config_load(yon_get_package_name_from_filename(packages[i]),&temp_size);
|
|
|
|
|
|
|
|
if (temp_size<=0){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(dialog->StatusBox),PACKAGE_NAME_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(name[0],'\n');
|
|
|
|
|
|
|
|
if (!yon_gtk_tree_model_check_exist(GTK_TREE_MODEL(window->PackagesList),&iter,name[0],1)){
|
|
|
|
gtk_list_store_append(window->PackagesList,&iter);
|
|
|
|
gtk_list_store_append(window->PackagesList,&iter);
|
|
|
|
gtk_list_store_set(window->PackagesList,&iter,0,package_signature_icon_name,1,package_name[0],2,file,3,1,-1);
|
|
|
|
gtk_list_store_set(window->PackagesList,&iter,1,name[0],2,packages[i],-1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),ALREADY_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(package_name,size);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -82,6 +108,8 @@ void on_add_package(GtkWidget *self, repo_add_window *window){
|
|
|
|
gtk_file_filter_set_name(filter,"*.pkg.tar*");
|
|
|
|
gtk_file_filter_set_name(filter,"*.pkg.tar*");
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show(dialog->ChooseFolderCheck);
|
|
|
|
|
|
|
|
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog->MainFileChooser),1);
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|