|
|
|
|
@ -408,44 +408,43 @@ void on_repo_add_new(GtkWidget *self, dictionary *dict){
|
|
|
|
|
name = window->path;
|
|
|
|
|
if (!name||strcmp(name,"")!=0){
|
|
|
|
|
GtkTreeIter *iter = yon_repo_append(widgets, name, YON_REPO_LINE_REPO_TYPE);
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
GtkTreeIter child;
|
|
|
|
|
char *reponame = yon_char_new(name);
|
|
|
|
|
yon_char_divide(reponame,yon_char_find_last(reponame,'/'));
|
|
|
|
|
char *searchpath = yon_char_unite(name,"/",reponame,"/x86_64/",NULL);
|
|
|
|
|
DIR *directory = opendir(searchpath);
|
|
|
|
|
if (directory){
|
|
|
|
|
char *found_packages = NULL;
|
|
|
|
|
while ((de = readdir(directory)))
|
|
|
|
|
{
|
|
|
|
|
if (strstr(de->d_name,"pkg.tar.")&&!strstr(de->d_name,".sig")){
|
|
|
|
|
char *filename = yon_char_unite(searchpath,"/",de->d_name,NULL);
|
|
|
|
|
FILE *file = popen(get_package_info_command(filename),"r");
|
|
|
|
|
char *cur_string=g_malloc0(sizeof(char)*4096);
|
|
|
|
|
char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL;
|
|
|
|
|
while (fgets(cur_string,4096,file)){
|
|
|
|
|
char *stringe = yon_char_divide_search(cur_string,"\n",-1);
|
|
|
|
|
char *p = yon_char_divide_search(stringe,":",-1);
|
|
|
|
|
if (strstr(p,"Name")) packname = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Version")) packver = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Architecture")) packarch = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
|
|
|
|
|
if (iter){
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
GtkTreeIter child;
|
|
|
|
|
char *reponame = yon_char_new(name);
|
|
|
|
|
yon_char_divide(reponame,yon_char_find_last(reponame,'/'));
|
|
|
|
|
char *searchpath = yon_char_unite(name,"/",reponame,"/x86_64/",NULL);
|
|
|
|
|
DIR *directory = opendir(searchpath);
|
|
|
|
|
if (directory){
|
|
|
|
|
char *found_packages = NULL;
|
|
|
|
|
while ((de = readdir(directory)))
|
|
|
|
|
{
|
|
|
|
|
if (strstr(de->d_name,"pkg.tar.")&&!strstr(de->d_name,".sig")){
|
|
|
|
|
char *filename = yon_char_unite(searchpath,"/",de->d_name,NULL);
|
|
|
|
|
FILE *file = popen(get_package_info_command(filename),"r");
|
|
|
|
|
char *cur_string=g_malloc0(sizeof(char)*4096);
|
|
|
|
|
char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL;
|
|
|
|
|
while (fgets(cur_string,4096,file)){
|
|
|
|
|
char *stringe = yon_char_divide_search(cur_string,"\n",-1);
|
|
|
|
|
char *p = yon_char_divide_search(stringe,":",-1);
|
|
|
|
|
if (strstr(p,"Name")) packname = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Version")) packver = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Architecture")) packarch = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&child,iter);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&child,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,filename,3,0,9,packname,10,packver,11,packarch,12,packdepends,-1);
|
|
|
|
|
found_packages = yon_char_unite(found_packages ? yon_char_append(found_packages," ") : "",de->d_name,NULL);
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&child,iter);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&child,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,filename,3,0,9,packname,10,packver,11,packarch,12,packdepends,-1);
|
|
|
|
|
found_packages = yon_char_unite(found_packages ? yon_char_append(found_packages," ") : "",de->d_name,NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_window_config_add_custom_parameter(window->path,"repos",found_packages,YON_TYPE_STRING);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,iter,0,folder_no_edits,2,window->path,3,0,9,reponame,-1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,iter,0,folder_added,2,window->path,3,1,9,reponame,-1);
|
|
|
|
|
yon_window_config_add_custom_parameter(window->path,"repos",found_packages,YON_TYPE_STRING);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,iter,0,folder_no_edits,2,window->path,3,0,9,reponame,-1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,iter,0,folder_added,2,window->path,3,1,9,reponame,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_render(EMPTY_NAME_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -468,7 +467,6 @@ void on_repo_new (GtkWidget *self, main_window *widgets){
|
|
|
|
|
dictionary *dict = yon_dictionary_new_with_data("",widgets);
|
|
|
|
|
dict = yon_dictionary_append_with_data(dict,"",window);
|
|
|
|
|
on_repo_add_new(self,dict);
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_repo_add_file(GtkWidget *self, main_window *widgets){
|
|
|
|
|
@ -600,6 +598,16 @@ GtkTreeIter *yon_repo_append(main_window *widgets, char *name, YON_REPO_LINE_TYP
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store);
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&parentIter)){
|
|
|
|
|
if (type==YON_REPO_LINE_REPO_TYPE){
|
|
|
|
|
GtkTreeIter ater;
|
|
|
|
|
char *repo_path;
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(model,&ater);
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(model,&ater)){
|
|
|
|
|
gtk_tree_model_get(model,&ater,2,&repo_path,-1);
|
|
|
|
|
if (!strcmp(repo_path,name)){
|
|
|
|
|
yon_ubl_status_box_render(REPO_ALREADY_EXISTS_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&iter,NULL);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&iter,0, folder_no_edits, 1, name_short,2,name,3,1,4,fls,-1);
|
|
|
|
|
retIter = gtk_tree_iter_copy(&iter);
|
|
|
|
|
|