|
|
|
|
@ -1,208 +1,119 @@
|
|
|
|
|
// #include "ubl-settings-repomanager.h"
|
|
|
|
|
#include "ubl-settings-repomanager.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // storage-configure window section
|
|
|
|
|
|
|
|
|
|
// void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// GtkWidget *dialog = gtk_file_chooser_dialog_new(CHOSE_FOLDER_TITLE_LABEL,GTK_WINDOW(window->MainWindow),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CLOSE_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
// yon_gtk_window_setup(GTK_WINDOW(dialog),GTK_WINDOW(window->MainWindow),CHOSE_FOLDER_TITLE_LABEL,icon_path,"file_chooser");
|
|
|
|
|
// int responce = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
// if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
// char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
|
// if (!yon_char_is_empty(path)){
|
|
|
|
|
// int size;
|
|
|
|
|
// config_str files = yon_file_list_dirs(path,&size);
|
|
|
|
|
// if (!files){
|
|
|
|
|
// yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_FOLDER_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
// gtk_widget_destroy(dialog);
|
|
|
|
|
// return;
|
|
|
|
|
// } else {
|
|
|
|
|
// yon_char_parsed_free(files,size);
|
|
|
|
|
// GtkTreeIter iter, itar;
|
|
|
|
|
// gtk_tree_store_append(window->storages_copy,&iter,NULL);
|
|
|
|
|
// char *name = yon_char_new(path);
|
|
|
|
|
// free(yon_char_divide(name,yon_char_find_last(name,'/')));
|
|
|
|
|
// gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
// char *iterpath = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(window->storages_copy),&iter);
|
|
|
|
|
// gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),iterpath,path);
|
|
|
|
|
// char *repos=NULL;
|
|
|
|
|
// int repos_size=0;
|
|
|
|
|
// g_signal_handlers_block_by_func(G_OBJECT(window->StoragePathCombo),on_storage_changed,window);
|
|
|
|
|
// yon_gtk_combo_box_text_find(window->StoragePathCombo,path);
|
|
|
|
|
// g_signal_handlers_unblock_by_func(G_OBJECT(window->StoragePathCombo),on_storage_changed,window);
|
|
|
|
|
// yon_window_config_add_instant_parameter(path,"storage_info","",YON_TYPE_STRING);
|
|
|
|
|
// config_str repos_list = yon_file_list_dirs(path,&repos_size);
|
|
|
|
|
// for (int i=0;i<repos_size;i++){
|
|
|
|
|
// if (strcmp(repos_list[i],"pool")){
|
|
|
|
|
// char *render_name = yon_char_new(repos_list[i]);
|
|
|
|
|
// free(yon_char_divide(render_name,yon_char_find_last(render_name,'/')));
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->AddEntry),render_name);
|
|
|
|
|
// on_repo_add(self,window);
|
|
|
|
|
// free(render_name);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_char_parsed_free(repos_list,repos_size);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_storage_config_update(window);
|
|
|
|
|
// gtk_widget_destroy(dialog);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// GtkWidget *dialog = gtk_file_chooser_dialog_new(CHOSE_FOLDER_TITLE_LABEL,GTK_WINDOW(window->MainWindow),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CLOSE_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
// yon_gtk_window_setup(GTK_WINDOW(dialog),GTK_WINDOW(window->MainWindow),CHOSE_FOLDER_TITLE_LABEL,icon_path,"file_chooser");
|
|
|
|
|
// int responce = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
// if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
// char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
|
// if (!yon_char_is_empty(path)){
|
|
|
|
|
// int size;
|
|
|
|
|
// config_str files = yon_file_list_dirs(path,&size);
|
|
|
|
|
// if (files){
|
|
|
|
|
// yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),FILES_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
// gtk_widget_destroy(dialog);
|
|
|
|
|
// return;
|
|
|
|
|
// } else {
|
|
|
|
|
// yon_char_parsed_free(files,size);
|
|
|
|
|
// GtkTreeIter iter;
|
|
|
|
|
// gtk_tree_store_append(window->storages_copy,&iter,NULL);
|
|
|
|
|
// char *name = yon_char_new(path);
|
|
|
|
|
// free(yon_char_divide(name,yon_char_find_last(name,'/')));
|
|
|
|
|
// gtk_tree_store_set(window->storages_copy,&iter,2,name,3,path,-1);
|
|
|
|
|
// char *iterpath = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(window->storages_copy),&iter);
|
|
|
|
|
// gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),iterpath,path);
|
|
|
|
|
// g_signal_handlers_block_by_func(G_OBJECT(window->StoragePathCombo),on_storage_changed,window);
|
|
|
|
|
// yon_gtk_combo_box_text_find(window->StoragePathCombo,path);
|
|
|
|
|
// g_signal_handlers_unblock_by_func(G_OBJECT(window->StoragePathCombo),on_storage_changed,window);
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
// yon_window_config_add_instant_parameter(path,"storage_info","",YON_TYPE_STRING);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_storage_config_update(window);
|
|
|
|
|
// gtk_widget_destroy(dialog);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_storage_disable(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
|
// data->action_text=DISABLE_CONFIRMATION_LABEL;
|
|
|
|
|
// GtkTreeIter iter,itar;
|
|
|
|
|
// if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter)){
|
|
|
|
|
// if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
|
// char *storage;
|
|
|
|
|
// const char *id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
// if (id){
|
|
|
|
|
// gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->storages_copy),&itar,id);
|
|
|
|
|
// 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_instant_parameter(repo_list[i],"repo_info");
|
|
|
|
|
// }
|
|
|
|
|
// if (repo_size)
|
|
|
|
|
// yon_char_parsed_free(repo_list,repo_size);
|
|
|
|
|
// yon_window_config_erase_instant_parameter(storage,"storage_info");
|
|
|
|
|
// gtk_tree_store_remove(window->storages_copy,&itar);
|
|
|
|
|
// gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),gtk_combo_box_get_active(GTK_COMBO_BOX(window->StoragePathCombo)));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_storage_config_update(window);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
|
|
|
|
|
// data->action_text=REMOVE_CONFIRMATION_LABEL;
|
|
|
|
|
// if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
|
// GtkTreeIter itar;
|
|
|
|
|
// char *storage;
|
|
|
|
|
// const char *id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
// if (id){
|
|
|
|
|
// gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->storages_copy),&itar,id);
|
|
|
|
|
// 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_instant_parameter(repo_list[i],"repo_info");
|
|
|
|
|
// }
|
|
|
|
|
// if (repo_size)
|
|
|
|
|
// yon_char_parsed_free(repo_list,repo_size);
|
|
|
|
|
// yon_window_config_erase_instant_parameter(storage,"storage_info");
|
|
|
|
|
// yon_dir_remove(storage);
|
|
|
|
|
// gtk_tree_store_remove(window->storages_copy,&itar);
|
|
|
|
|
// gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),gtk_combo_box_get_active(GTK_COMBO_BOX(window->StoragePathCombo)));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_storage_config_update(window);
|
|
|
|
|
// }
|
|
|
|
|
void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
|
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->MainFileChooser));
|
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
|
free(yon_char_divide(storage->name,yon_char_find_last(storage->name,'/')));
|
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
|
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_APPLY){
|
|
|
|
|
storage_struct *storage = yon_storage_struct_new();
|
|
|
|
|
storage->path=dialog->last_success_selection;
|
|
|
|
|
storage->name = yon_char_new(storage->path);
|
|
|
|
|
free(yon_char_divide(storage->name,yon_char_find_last(storage->name,'/')));
|
|
|
|
|
g_hash_table_insert(window->storages_copy,storage->path,storage);
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_disable(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
const char *storage_target = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_target);
|
|
|
|
|
if (storage){
|
|
|
|
|
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),gtk_combo_box_get_active(GTK_COMBO_BOX(window->StoragePathCombo)));
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->StoragePathCombo),0);
|
|
|
|
|
g_hash_table_remove(window->storages_copy,storage_target);
|
|
|
|
|
yon_storage_sturct_free_full(storage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
const char *storage_target = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_target);
|
|
|
|
|
if (storage){
|
|
|
|
|
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),gtk_combo_box_get_active(GTK_COMBO_BOX(window->StoragePathCombo)));
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->StoragePathCombo),0);
|
|
|
|
|
g_hash_table_remove(window->storages_copy,storage_target);
|
|
|
|
|
yon_storage_sturct_free_full(storage);
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(window->delete_storages,&window->delete_storages_size,(char*)storage_target);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_repo_add(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
const char *repo_name = gtk_entry_get_text(GTK_ENTRY(window->AddEntry));
|
|
|
|
|
if (yon_char_is_empty(repo_name)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const char *storage_target = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_target);
|
|
|
|
|
if (g_hash_table_lookup(storage->repos,repo_name)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),ALREADY_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *new_repo = yon_char_new(repo_name);
|
|
|
|
|
repo_struct *repo = yon_repo_struct_new();
|
|
|
|
|
storage_repo_block *block = yon_storage_repo_block_new();
|
|
|
|
|
g_object_set_data(G_OBJECT(block->SignatureCombo),"repo_storage",repo);
|
|
|
|
|
g_object_set_data(G_OBJECT(block->SignatureCombo),"window",window);
|
|
|
|
|
g_object_set_data(G_OBJECT(block->RepoRemoveButton),"window",window);
|
|
|
|
|
repo->name=new_repo;
|
|
|
|
|
block->repo_name=new_repo;
|
|
|
|
|
repo->path = yon_char_unite(storage_target,"/",new_repo,NULL);
|
|
|
|
|
repo->storage_path = yon_char_new(storage_target);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(block->RepoNameEntry),new_repo);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->ReposBox),block->MainBox,0,0,0);
|
|
|
|
|
g_hash_table_insert(storage->repos,repo->name,repo);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_storage_config_update(storage_config_window *window){
|
|
|
|
|
GList *children = gtk_container_get_children(GTK_CONTAINER(window->ReposBox));
|
|
|
|
|
if (children){
|
|
|
|
|
GList *iter;
|
|
|
|
|
for(iter=children;iter;iter=iter->next){
|
|
|
|
|
gtk_widget_destroy(GTK_WIDGET(iter->data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const char *active = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
if (active){
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,active);
|
|
|
|
|
GList *repos = g_hash_table_get_values(storage->repos);
|
|
|
|
|
if (repos){
|
|
|
|
|
GList *iter;
|
|
|
|
|
for (iter = repos;iter;iter=iter->next){
|
|
|
|
|
repo_struct *cur_repo = (repo_struct*)iter->data;
|
|
|
|
|
storage_repo_block *cur_block = NULL;
|
|
|
|
|
cur_block = yon_storage_repo_block_new();
|
|
|
|
|
g_object_set_data(G_OBJECT(cur_block->SignatureCombo),"repo_storage",cur_repo);
|
|
|
|
|
g_object_set_data(G_OBJECT(cur_block->SignatureCombo),"window",window);
|
|
|
|
|
g_object_set_data(G_OBJECT(cur_block->RepoRemoveButton),"window",window);
|
|
|
|
|
cur_block->repo_name=yon_char_new(cur_repo->name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(cur_block->RepoNameEntry),cur_repo->name);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->ReposBox),cur_block->MainBox,0,0,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
// void on_repo_add(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// char *new_repo = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->AddEntry)));
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
|
// if (yon_char_is_empty(new_repo)){
|
|
|
|
|
// yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
|
// yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_NAME_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// GtkTreeIter iter,itar, childiter;
|
|
|
|
|
// const char *id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
// if (id){
|
|
|
|
|
// gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->storages_copy),&itar,id);
|
|
|
|
|
// 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_set(window->storages_copy,&childiter,2,new_repo,3,child_path,-1);
|
|
|
|
|
// 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_instant_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_debug_output("%s\n",create_storage_command(path, new_repo));
|
|
|
|
|
// 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);
|
|
|
|
|
// if (size)
|
|
|
|
|
// yon_window_config_add_instant_parameter(arch_path,"package_info",yon_char_parsed_to_string(final,final_size,","),YON_TYPE_STRING);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// yon_char_parsed_free(dirs,size);
|
|
|
|
|
// }
|
|
|
|
|
// free(new_repo);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
// main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
// storage_config_window *window = yon_dictionary_get_data(dict->first->next,storage_config_window*);
|
|
|
|
|
// gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->ReposTree),NULL);
|
|
|
|
|
@ -221,59 +132,59 @@
|
|
|
|
|
// on_subwindow_close(self);
|
|
|
|
|
// yon_config_load_update(widgets);
|
|
|
|
|
// yon_ubl_status_box_render(STORAGES_SAVED_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// void on_storage_changed(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
// yon_storage_config_update(window);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// storage_config_window *yon_storage_config_window_new(){
|
|
|
|
|
// storage_config_window *window = malloc(sizeof(storage_config_window));
|
|
|
|
|
// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_storage_config);
|
|
|
|
|
// window->MainWindow = yon_gtk_builder_get_widget(builder,"MainWindow");
|
|
|
|
|
// window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
|
|
|
|
|
// window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
// window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
// window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
// window->StoragePathCombo = yon_gtk_builder_get_widget(builder,"StoragePathCombo");
|
|
|
|
|
// window->OpenExistingButton = yon_gtk_builder_get_widget(builder,"OpenExistingButton");
|
|
|
|
|
// window->CreateNewButton = yon_gtk_builder_get_widget(builder,"CreateNewButton");
|
|
|
|
|
// window->DisableButton = yon_gtk_builder_get_widget(builder,"DisableButton");
|
|
|
|
|
// window->DeleteButton = yon_gtk_builder_get_widget(builder,"DeleteButton");
|
|
|
|
|
// window->ReposBox = yon_gtk_builder_get_widget(builder,"ReposBox");
|
|
|
|
|
// window->AddEntry = yon_gtk_builder_get_widget(builder,"AddEntry");
|
|
|
|
|
// window->AddRepoButton = yon_gtk_builder_get_widget(builder,"AddRepoButton");
|
|
|
|
|
// window->storages_copy = gtk_tree_store_new(7,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INT);
|
|
|
|
|
// yon_gtk_tree_store_copy_full(main_config.tree_store,window->storages_copy);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->OpenExistingButton),"clicked",G_CALLBACK(on_storage_open),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->CreateNewButton),"clicked",G_CALLBACK(on_storage_create),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->DisableButton),"clicked",G_CALLBACK(on_storage_disable),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->DeleteButton),"clicked",G_CALLBACK(on_storage_remove),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->AddRepoButton),"clicked",G_CALLBACK(on_repo_add),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->StoragePathCombo),"changed",G_CALLBACK(on_storage_changed),window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return window;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_storage_configure_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
// storage_config_window *window = yon_storage_config_window_new();
|
|
|
|
|
// yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),MANAGE_STORAGES_TITLE_LABEL,icon_path,"storage-configuration-window");
|
|
|
|
|
// gtk_label_set_text(GTK_LABEL(window->HeadLabel),MANAGE_STORAGES_TITLE_LABEL);
|
|
|
|
|
// gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
|
// GtkTreeIter iter,itar;
|
|
|
|
|
// for_iter(window->storages_copy,&iter){
|
|
|
|
|
// char *storage;
|
|
|
|
|
// gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&iter,3,&storage,-1);
|
|
|
|
|
|
|
|
|
|
// gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage,storage);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// dictionary *dict = NULL;
|
|
|
|
|
// yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
// yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_storage_accept),dict);
|
|
|
|
|
// gtk_widget_show(window->MainWindow);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_changed(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
storage_config_window *yon_storage_config_window_new(){
|
|
|
|
|
storage_config_window *window = malloc(sizeof(storage_config_window));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_storage_config);
|
|
|
|
|
window->MainWindow = yon_gtk_builder_get_widget(builder,"MainWindow");
|
|
|
|
|
window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->StoragePathCombo = yon_gtk_builder_get_widget(builder,"StoragePathCombo");
|
|
|
|
|
window->OpenExistingButton = yon_gtk_builder_get_widget(builder,"OpenExistingButton");
|
|
|
|
|
window->CreateNewButton = yon_gtk_builder_get_widget(builder,"CreateNewButton");
|
|
|
|
|
window->DisableButton = yon_gtk_builder_get_widget(builder,"DisableButton");
|
|
|
|
|
window->DeleteButton = yon_gtk_builder_get_widget(builder,"DeleteButton");
|
|
|
|
|
window->ReposBox = yon_gtk_builder_get_widget(builder,"ReposBox");
|
|
|
|
|
window->AddEntry = yon_gtk_builder_get_widget(builder,"AddEntry");
|
|
|
|
|
window->AddRepoButton = yon_gtk_builder_get_widget(builder,"AddRepoButton");
|
|
|
|
|
window->storages_copy = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
|
window->delete_storages=NULL;
|
|
|
|
|
window->delete_storages_size=0;
|
|
|
|
|
|
|
|
|
|
yon_storage_hash_table_clone(main_config.storages,window->storages_copy);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->OpenExistingButton),"clicked",G_CALLBACK(on_storage_open),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CreateNewButton),"clicked",G_CALLBACK(on_storage_create),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->DisableButton),"clicked",G_CALLBACK(on_storage_disable),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DeleteButton),"clicked",G_CALLBACK(on_storage_remove),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AddRepoButton),"clicked",G_CALLBACK(on_repo_add),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->StoragePathCombo),"changed",G_CALLBACK(on_storage_changed),window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_storage_configure_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
storage_config_window *window = yon_storage_config_window_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),MANAGE_STORAGES_TITLE_LABEL,icon_path,"storage-configuration-window");
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
GList *storages = g_hash_table_get_values(main_config.storages);
|
|
|
|
|
GList *listiter;
|
|
|
|
|
for (listiter = storages;listiter;listiter=listiter->next){
|
|
|
|
|
storage_struct *cur_storage = (storage_struct*)listiter->data;
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),cur_storage->name,cur_storage->path);
|
|
|
|
|
}
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_storage_accept),dict);
|
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
|
}
|
|
|
|
|
|