|
|
|
|
@ -16,6 +16,7 @@ void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->StoragePathCombo),storage->path);
|
|
|
|
|
yon_config_register(storage->path,STORAGE_command,"");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -31,31 +32,41 @@ void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->StoragePathCombo),storage->path,storage->path);
|
|
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->StoragePathCombo),storage->path);
|
|
|
|
|
yon_config_register(storage->path,STORAGE_command,"");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
if (yon_char_is_empty(storage_target)) return;
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_target);
|
|
|
|
|
if (storage){
|
|
|
|
|
const char *path = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
if (!config((char*)path)){
|
|
|
|
|
yon_config_register((char*)path,STORAGE_command,"-");
|
|
|
|
|
}
|
|
|
|
|
yon_config_set_status((char*)path,-1);
|
|
|
|
|
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);
|
|
|
|
|
// 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));
|
|
|
|
|
if (yon_char_is_empty(storage_target)) return;
|
|
|
|
|
storage_struct *storage = g_hash_table_lookup(window->storages_copy,storage_target);
|
|
|
|
|
if (storage){
|
|
|
|
|
const char *path = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
yon_config_remove_by_key((char*)path);
|
|
|
|
|
if (!config((char*)path)){
|
|
|
|
|
yon_config_register((char*)path,STORAGE_command,"-");
|
|
|
|
|
}
|
|
|
|
|
yon_config_set_status((char*)path,-2);
|
|
|
|
|
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);
|
|
|
|
|
// g_hash_table_remove(window->storages_copy,storage_target);
|
|
|
|
|
// yon_storage_sturct_free_full(storage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -122,7 +133,17 @@ void yon_storage_config_update(storage_config_window *window){
|
|
|
|
|
|
|
|
|
|
void yon_storage_remove(char *key, storage_struct *storage,void*){
|
|
|
|
|
char *parameter = config(key);
|
|
|
|
|
yon_window_config_add_instant_parameter(key,"storage_info",parameter,YON_TYPE_STRING);
|
|
|
|
|
switch (yon_config_get_status(key)){
|
|
|
|
|
case -2: yon_window_config_erase_instant_parameter(key,"storage_info");
|
|
|
|
|
if (rmdir(key)){};
|
|
|
|
|
break;
|
|
|
|
|
case -1: yon_window_config_erase_instant_parameter(key,"storage_info");
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1: yon_window_config_add_instant_parameter(key,"storage_info",parameter,YON_TYPE_STRING);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse(parameter,&size,",");
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
@ -142,27 +163,8 @@ void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
g_hash_table_unref(window->storages_copy);
|
|
|
|
|
free(window);
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
// 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);
|
|
|
|
|
// gtk_tree_store_clear(main_config.tree_store);
|
|
|
|
|
// yon_gtk_tree_store_copy_full(window->storages_copy,main_config.tree_store);
|
|
|
|
|
// gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->ReposTree),GTK_TREE_MODEL(main_config.tree_store));
|
|
|
|
|
// yon_window_config_save_instant();
|
|
|
|
|
// GtkTreeIter iter;
|
|
|
|
|
// const char *id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->StoragePathCombo));
|
|
|
|
|
// if (!yon_char_is_empty(id)){
|
|
|
|
|
// gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->RepoList),&iter,id);
|
|
|
|
|
// gtk_tree_view_expand_to_path(GTK_TREE_VIEW(widgets->ReposTree),gtk_tree_path_new_from_string(id));
|
|
|
|
|
// gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->ReposTree)),&iter);
|
|
|
|
|
// on_main_tree_selection_changed(NULL,widgets);
|
|
|
|
|
// }
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
|
|
|
|
@ -206,7 +208,7 @@ storage_config_window *yon_storage_config_window_new(){
|
|
|
|
|
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->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);
|
|
|
|
|
|