|
|
|
@ -57,8 +57,25 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&itar);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&itar);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
|
|
|
char *repos=NULL;
|
|
|
|
|
|
|
|
int repos_size=0;
|
|
|
|
|
|
|
|
yon_window_config_get_parameter("storage_info",path,&repos,YON_TYPE_STRING);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(repos)){
|
|
|
|
|
|
|
|
config_str repos_list = yon_char_parse(repos,&repos_size,",");
|
|
|
|
|
|
|
|
for (int i=0;i<repos_size;i++){
|
|
|
|
|
|
|
|
char *render_name = yon_char_new(repos_list[i]);
|
|
|
|
|
|
|
|
free(yon_char_divide(render_name,yon_char_find_last(render_name,'/')));
|
|
|
|
|
|
|
|
gtk_tree_store_append(window->storages_copy,&itar,&iter);
|
|
|
|
|
|
|
|
gtk_tree_store_set(window->storages_copy,&itar,2,render_name,3,repos_list[i],-1);
|
|
|
|
|
|
|
|
free(render_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(repos_list,repos_size);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_window_config_add_custom_parameter(path,"storage_info","",YON_TYPE_STRING);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -76,8 +93,10 @@ void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&itar);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&itar);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
|
|
|
yon_window_config_add_custom_parameter(path,"storage_info","",YON_TYPE_STRING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -92,6 +111,7 @@ void on_storage_disable(GtkWidget *self, storage_config_window *window){
|
|
|
|
char *storage;
|
|
|
|
char *storage;
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,0,&storage,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,0,&storage,-1);
|
|
|
|
|
|
|
|
yon_window_config_erase_custom_parameter(storage,"storage_info");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -106,7 +126,18 @@ void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
char *storage;
|
|
|
|
char *storage;
|
|
|
|
gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter);
|
|
|
|
gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,0,&storage,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,3,&storage,-1);
|
|
|
|
|
|
|
|
char *repos;
|
|
|
|
|
|
|
|
yon_window_config_get_parameter("storage_info",storage,&repos,YON_TYPE_STRING);
|
|
|
|
|
|
|
|
int repo_size;
|
|
|
|
|
|
|
|
config_str repo_list = yon_char_parse(repos,&repo_size,",");
|
|
|
|
|
|
|
|
for (int i=0;i<repo_size;i++){
|
|
|
|
|
|
|
|
yon_window_config_erase_custom_parameter(repo_list[i],"repo_info");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (repo_size)
|
|
|
|
|
|
|
|
yon_char_parsed_free(repo_list,repo_size);
|
|
|
|
|
|
|
|
yon_window_config_erase_custom_parameter(storage,"storage_info");
|
|
|
|
|
|
|
|
rmdir(storage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -122,9 +153,48 @@ void on_repo_add(GtkWidget *self, storage_config_window *window){
|
|
|
|
GtkTreeIter iter,itar, childiter;
|
|
|
|
GtkTreeIter iter,itar, childiter;
|
|
|
|
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter)){
|
|
|
|
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter)){
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,3,&path,-1);
|
|
|
|
|
|
|
|
char *child_path = yon_char_unite(path,"/",new_repo,NULL);
|
|
|
|
gtk_tree_store_append(window->storages_copy,&childiter,&itar);
|
|
|
|
gtk_tree_store_append(window->storages_copy,&childiter,&itar);
|
|
|
|
gtk_tree_store_set(window->storages_copy,&childiter,2,new_repo,-1);
|
|
|
|
gtk_tree_store_set(window->storages_copy,&childiter,2,new_repo,3,child_path,-1);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
|
|
|
|
char *old;
|
|
|
|
|
|
|
|
yon_window_config_get_parameter("storage_info",path,&old,YON_TYPE_STRING);
|
|
|
|
|
|
|
|
int old_repos_size;
|
|
|
|
|
|
|
|
config_str old_repos_parsed = yon_char_parse(old,&old_repos_size,",");
|
|
|
|
|
|
|
|
if (yon_char_parsed_check_exist(old_repos_parsed,old_repos_size,child_path)==-1){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(old_repos_parsed,&old_repos_size,child_path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_window_config_add_custom_parameter(path,"storage_info",yon_char_parsed_to_string(old_repos_parsed,old_repos_size,","),YON_TYPE_STRING);
|
|
|
|
|
|
|
|
yon_char_parsed_free(old_repos_parsed,old_repos_size);
|
|
|
|
|
|
|
|
yon_launch(create_storage_command(path, new_repo));
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str dirs = yon_file_list_dirs(child_path,&size);
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
|
|
|
char *arch_path = yon_char_unite(child_path,"/",dirs[i],NULL);
|
|
|
|
|
|
|
|
gtk_tree_store_append(window->storages_copy,&iter,&childiter);
|
|
|
|
|
|
|
|
gtk_tree_store_set(window->storages_copy,&iter,2,dirs[i],3,arch_path,-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(arch_path)&&!access(arch_path,F_OK)){
|
|
|
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
|
|
|
int final_size=0;
|
|
|
|
|
|
|
|
DIR *current_dir = opendir(arch_path);
|
|
|
|
|
|
|
|
struct dirent* cur_dir;
|
|
|
|
|
|
|
|
while ((cur_dir=readdir(current_dir))){
|
|
|
|
|
|
|
|
if (strlen(cur_dir->d_name)>8){
|
|
|
|
|
|
|
|
char *extension = yon_char_new(cur_dir->d_name);
|
|
|
|
|
|
|
|
free(yon_char_divide(extension,yon_char_find_last(extension,'.')-4));
|
|
|
|
|
|
|
|
if ((strcmp(cur_dir->d_name, ".") && strcmp(cur_dir->d_name, ".."))&&strstr(extension,"tar.")){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,&final_size,cur_dir->d_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(current_dir);
|
|
|
|
|
|
|
|
yon_window_config_add_custom_parameter(arch_path,"package_info",yon_char_parsed_to_string(final,size,","),YON_TYPE_STRING);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(dirs,size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(new_repo);
|
|
|
|
free(new_repo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -204,48 +274,76 @@ gboolean yon_storage_filter_func(GtkTreeModel *model,
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_repo_filter_func(GtkTreeModel *model,
|
|
|
|
config_str yon_tree_store_get_all_at_level(GtkTreeStore *target,GtkTreeIter *parent, int *size, int column, int level){
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
config_str final = NULL;
|
|
|
|
gpointer data){
|
|
|
|
GtkTreePath *path=NULL, *parent_path=NULL;
|
|
|
|
GtkTreeIter parent;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
if (parent){
|
|
|
|
char *name;
|
|
|
|
parent_path = gtk_tree_model_get_path(GTK_TREE_MODEL(target),parent);
|
|
|
|
gtk_tree_model_get(model,iter,2,&name,-1);
|
|
|
|
|
|
|
|
printf("%s\n",name);
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model,iter,&parent))
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
int valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(target),&iter,parent);
|
|
|
|
}
|
|
|
|
for(;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(target),&iter)){
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path(GTK_TREE_MODEL(target),&iter);
|
|
|
|
gboolean yon_arch_filter_func(GtkTreeModel *model,
|
|
|
|
if (path && gtk_tree_path_get_depth(path)==level&&(!parent_path||gtk_tree_path_is_descendant(path,parent_path))){
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
char *append=NULL;
|
|
|
|
gpointer data){
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(target),&iter,column,&append,-1);
|
|
|
|
GtkTreeIter parent;
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,size,append);
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
free(append);
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model,&parent,iter))
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return final;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_package_filter_func(GtkTreeModel *model,
|
|
|
|
void on_add_target_repo_selection_changed(GtkWidget *target,repo_add_window *window){
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->RepositoryCombo));
|
|
|
|
gpointer data){
|
|
|
|
char *path_str = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StorageCombo));
|
|
|
|
GtkTreeIter parent;
|
|
|
|
if (!yon_char_is_empty(path_str)){
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
|
|
|
|
if (gtk_tree_model_iter_parent(model,&parent,iter)){
|
|
|
|
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(window->tree_copy),&iter,path)){
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
int valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(window->tree_copy),&itar,&iter);
|
|
|
|
|
|
|
|
for(;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->tree_copy),&itar)){
|
|
|
|
|
|
|
|
char *current;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->tree_copy),&itar,2,¤t,-1);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(current)){
|
|
|
|
|
|
|
|
char *path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(window->tree_copy),&itar);
|
|
|
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->RepositoryCombo),path_str,current);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_add_target_arch_selection_changed(GtkWidget *target,repo_add_window *window){
|
|
|
|
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->ArchitectureCombo));
|
|
|
|
|
|
|
|
char *path_str = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepositoryCombo));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(path_str)){
|
|
|
|
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
|
|
|
|
GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(window->tree_copy),&iter,path)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(window->tree_copy),&itar,&iter);
|
|
|
|
|
|
|
|
for(;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->tree_copy),&itar)){
|
|
|
|
|
|
|
|
char *current;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->tree_copy),&itar,2,¤t,-1);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(current)){
|
|
|
|
|
|
|
|
char *path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(window->tree_copy),&itar);
|
|
|
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->ArchitectureCombo),path_str,current);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_add_selection_changed(GtkWidget *self, repo_add_window *window){
|
|
|
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(window->storage_filter));
|
|
|
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(window->repo_filter));
|
|
|
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(window->arch_filter));
|
|
|
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(window->package_filter));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repo_add_window *yon_repo_add_window_new(){
|
|
|
|
repo_add_window *yon_repo_add_window_new(){
|
|
|
|
repo_add_window *window = malloc(sizeof(repo_add_window));
|
|
|
|
repo_add_window *window = malloc(sizeof(repo_add_window));
|
|
|
|
@ -272,32 +370,38 @@ repo_add_window *yon_repo_add_window_new(){
|
|
|
|
window->InfoLabel = yon_gtk_builder_get_widget(builder,"InfoLabel");
|
|
|
|
window->InfoLabel = yon_gtk_builder_get_widget(builder,"InfoLabel");
|
|
|
|
window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
|
|
|
|
window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
|
|
|
window->TestTree = yon_gtk_builder_get_widget(builder,"TestTree");
|
|
|
|
window->PackagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PackagesList"));
|
|
|
|
window->PackagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PackagesList"));
|
|
|
|
|
|
|
|
window->tree_copy = gtk_tree_store_new(6,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
window->storage_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
yon_gtk_tree_store_copy_full(main_config.tree_store,window->tree_copy);
|
|
|
|
window->repo_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
window->storage_filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(window->tree_copy),NULL);
|
|
|
|
window->arch_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
window->repo_filter=gtk_tree_model_filter_new(GTK_TREE_MODEL(window->tree_copy),NULL);
|
|
|
|
window->package_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
window->arch_filter=gtk_tree_model_filter_new(GTK_TREE_MODEL(window->tree_copy),NULL);
|
|
|
|
|
|
|
|
window->package_filter=gtk_tree_model_filter_new(GTK_TREE_MODEL(window->tree_copy),NULL);
|
|
|
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->TestTree),GTK_TREE_MODEL(window->tree_copy));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->StorageCombo),"changed",G_CALLBACK(on_add_target_repo_selection_changed),window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepositoryCombo),"changed",G_CALLBACK(on_add_target_arch_selection_changed),window);
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->ArchitectureCombo),"changed",G_CALLBACK(on_add_target_selection_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// main window
|
|
|
|
void on_add_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_add_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
repo_add_window *window = yon_repo_add_window_new();
|
|
|
|
repo_add_window *window = yon_repo_add_window_new();
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"add-repo-window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"add-repo-window");
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->storage_filter,yon_storage_filter_func,NULL,NULL);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->repo_filter,yon_repo_filter_func,NULL,NULL);
|
|
|
|
for_iter (window->tree_copy,&iter){
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->arch_filter,yon_arch_filter_func,NULL,NULL);
|
|
|
|
char *current;
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->package_filter,yon_package_filter_func,NULL,NULL);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->tree_copy),&iter,3,¤t,-1);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(current)){
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->StorageCombo),GTK_TREE_MODEL(window->storage_filter));
|
|
|
|
char *path = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(window->tree_copy),&iter);
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->RepositoryCombo),GTK_TREE_MODEL(window->repo_filter));
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StorageCombo),path,current);
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->ArchitectureCombo),GTK_TREE_MODEL(window->arch_filter));
|
|
|
|
}
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->PackagesTree),GTK_TREE_MODEL(window->package_filter));
|
|
|
|
}
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -331,6 +435,60 @@ void config_init(){
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_config_load_update(main_window *widgets){
|
|
|
|
|
|
|
|
gsize size=0;
|
|
|
|
|
|
|
|
config_str storages = yon_window_config_get_section("storage_info",&size);
|
|
|
|
|
|
|
|
GtkTreeIter iter,itar,childiter;
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
|
|
|
char *name = yon_char_new(storages[i]);
|
|
|
|
|
|
|
|
free(yon_char_divide(name,yon_char_find_last(name,'/')));
|
|
|
|
|
|
|
|
gtk_tree_store_append(widgets->RepoList,&iter,NULL);
|
|
|
|
|
|
|
|
gtk_tree_store_set(widgets->RepoList,&iter,2,name,3,storages[i],-1);
|
|
|
|
|
|
|
|
free(name);
|
|
|
|
|
|
|
|
yon_window_config_get_parameter("storage_info",storages[i],&name,YON_TYPE_STRING);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(name)){
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str name_parsed = yon_char_parse(name,&parsed_size,",");
|
|
|
|
|
|
|
|
for (int j=0;j<parsed_size;j++){
|
|
|
|
|
|
|
|
char *nm = yon_char_new(name_parsed[j]);
|
|
|
|
|
|
|
|
free(yon_char_divide(nm,yon_char_find_last(nm,'/')));
|
|
|
|
|
|
|
|
gtk_tree_store_append(widgets->RepoList,&itar,&iter);
|
|
|
|
|
|
|
|
gtk_tree_store_set(widgets->RepoList,&itar,3,name_parsed[j],2,nm,-1);
|
|
|
|
|
|
|
|
free(nm);
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str dirs = yon_file_list_dirs(name_parsed[j],&size);
|
|
|
|
|
|
|
|
for (int k=0;k<size;k++){
|
|
|
|
|
|
|
|
char *arch_path = yon_char_unite(name_parsed[j],"/",dirs[k],NULL);
|
|
|
|
|
|
|
|
gtk_tree_store_append(widgets->RepoList,&iter,&itar);
|
|
|
|
|
|
|
|
gtk_tree_store_set(widgets->RepoList,&iter,2,dirs[k],3,arch_path,-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(arch_path)&&!access(arch_path,F_OK)){
|
|
|
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
|
|
|
int final_size=0;
|
|
|
|
|
|
|
|
DIR *current_dir = opendir(arch_path);
|
|
|
|
|
|
|
|
struct dirent* cur_dir;
|
|
|
|
|
|
|
|
while ((cur_dir=readdir(current_dir))){
|
|
|
|
|
|
|
|
if (strlen(cur_dir->d_name)>8){
|
|
|
|
|
|
|
|
char *extension = yon_char_new(cur_dir->d_name);
|
|
|
|
|
|
|
|
free(yon_char_divide(extension,yon_char_find_last(extension,'.')-4));
|
|
|
|
|
|
|
|
if ((strcmp(cur_dir->d_name, ".") && strcmp(cur_dir->d_name, ".."))&&strstr(extension,"tar.")){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,&final_size,cur_dir->d_name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(current_dir);
|
|
|
|
|
|
|
|
yon_window_config_add_custom_parameter(arch_path,"package_info",yon_char_parsed_to_string(final,size,","),YON_TYPE_STRING);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(name_parsed,parsed_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size)
|
|
|
|
|
|
|
|
yon_char_parsed_free(storages,size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
@ -364,6 +522,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */
|
|
|
|
/* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */
|
|
|
|
/* Localisation | Локализация */
|
|
|
|
/* Localisation | Локализация */
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
gtk_widget_show(widgets->Window);
|
|
|
|
@ -388,6 +547,7 @@ int main(int argc, char *argv[]){
|
|
|
|
widgets = (template_main_window*)yon_main_window_complete((main_window*)widgets);
|
|
|
|
widgets = (template_main_window*)yon_main_window_complete((main_window*)widgets);
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
yon_window_config_load(path);
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
|
|
|
yon_config_load_update((main_window*)widgets);
|
|
|
|
if (getuid()!=0){
|
|
|
|
if (getuid()!=0){
|
|
|
|
yon_ubl_status_box_render("",BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
yon_ubl_status_box_render("",BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|