|
|
|
@ -9,12 +9,11 @@ void on_repo_signed(){
|
|
|
|
void on_repo_removed(GtkWidget *self,storage_config_window *window){
|
|
|
|
void on_repo_removed(GtkWidget *self,storage_config_window *window){
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_widget_get_parent(self)));
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_widget_get_parent(self)));
|
|
|
|
char *repo = (char*)gtk_entry_get_text(GTK_ENTRY(g_list_nth_data(list,0)));
|
|
|
|
char *repo = (char*)gtk_entry_get_text(GTK_ENTRY(g_list_nth_data(list,0)));
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
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_get(GTK_TREE_MODEL(window->StorageList),&iter,0,&storage,-1);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
dictionary *storg = yon_dictionary_get_data(yon_dictionary_get(&window->storages,storage),dictionary*);
|
|
|
|
gtk_tree_store_remove(GTK_TREE_STORE(window->storages_copy),&itar);
|
|
|
|
window->storages->data = yon_dictionary_rip(yon_dictionary_get(&storg,repo));
|
|
|
|
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -23,38 +22,40 @@ void yon_storage_config_update(storage_config_window *window){
|
|
|
|
for (int i=0;i<g_list_length(children);i++){
|
|
|
|
for (int i=0;i<g_list_length(children);i++){
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(children,i));
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(children,i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter,itar, childiter;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
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_get(GTK_TREE_MODEL(window->StorageList),&iter,0,&name,-1);
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
dictionary *current = yon_dictionary_get(&window->storages,name);
|
|
|
|
if (gtk_tree_model_iter_children(GTK_TREE_MODEL(window->storages_copy),&childiter,&itar)){
|
|
|
|
if (current&¤t->data){
|
|
|
|
int valid = 1;
|
|
|
|
dictionary *cur_repo = yon_dictionary_get_data(current,dictionary*);
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->storages_copy),&childiter)){
|
|
|
|
dictionary *dic=NULL;
|
|
|
|
char *repo;
|
|
|
|
for_dictionaries(dic,cur_repo){
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&childiter,2,&repo,-1);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_repo_block);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_repo_block);
|
|
|
|
GtkWidget *box = yon_gtk_builder_get_widget(builder,"MainBox");
|
|
|
|
GtkWidget *box = yon_gtk_builder_get_widget(builder,"MainBox");
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->ReposBox),box,0,0,0);
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->ReposBox),box,0,0,0);
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"SignatureButton"),"clicked",G_CALLBACK(on_repo_signed),window);
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"SignatureButton"),"clicked",G_CALLBACK(on_repo_signed),window);
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"RepoRemoveButton"),"clicked",G_CALLBACK(on_repo_removed),window);
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"RepoRemoveButton"),"clicked",G_CALLBACK(on_repo_removed),window);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"RepoNameEntry")),dic->key);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"RepoNameEntry")),repo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//storage-configure window section
|
|
|
|
//storage-configure window section
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
void on_storage_open(GtkWidget *self, storage_config_window *window){
|
|
|
|
GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,GTK_WINDOW(window->MainWindow),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CLOSE_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,GTK_WINDOW(window->MainWindow),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CLOSE_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
int responce = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
int responce = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
gtk_list_store_append(window->StorageList,&iter);
|
|
|
|
gtk_tree_store_append(window->storages_copy,&iter,NULL);
|
|
|
|
gtk_list_store_set(window->StorageList,&iter,0,path,-1);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->storages,path,NULL);
|
|
|
|
char *name = yon_char_new(path);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter);
|
|
|
|
free(yon_char_divide(name,yon_char_find_last(name,'/')));
|
|
|
|
|
|
|
|
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_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -67,33 +68,33 @@ void on_storage_create(GtkWidget *self, storage_config_window *window){
|
|
|
|
if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
if (responce == GTK_RESPONSE_ACCEPT){
|
|
|
|
char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
char *path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
if (!yon_char_is_empty(path)){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
gtk_list_store_append(window->StorageList,&iter);
|
|
|
|
gtk_tree_store_append(window->storages_copy,&iter,NULL);
|
|
|
|
gtk_list_store_set(window->StorageList,&iter,0,path,-1);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->storages,path,NULL);
|
|
|
|
char *name = yon_char_new(path);
|
|
|
|
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter);
|
|
|
|
free(yon_char_divide(name,yon_char_find_last(name,'/')));
|
|
|
|
|
|
|
|
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_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AddEntry),"");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_disable(GtkWidget *self, storage_config_window *window){
|
|
|
|
void on_storage_disable(GtkWidget *self, storage_config_window *window){
|
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
|
data->action_text=DISABLE_CONFIRMATION_LABEL;
|
|
|
|
data->action_text=DISABLE_CONFIRMATION_LABEL;
|
|
|
|
data->function=NULL;
|
|
|
|
data->function=NULL;
|
|
|
|
data->data=NULL;
|
|
|
|
data->data=NULL;
|
|
|
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(window->StoragePathCombo),&iter)){
|
|
|
|
if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
char *storage;
|
|
|
|
char *storage;
|
|
|
|
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_get(GTK_TREE_MODEL(window->StorageList),&iter,0,&storage,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,0,&storage,-1);
|
|
|
|
dictionary *storages = yon_dictionary_get(&window->storages,storage);
|
|
|
|
|
|
|
|
if (storages){
|
|
|
|
|
|
|
|
gtk_list_store_remove(window->StorageList,&iter);
|
|
|
|
|
|
|
|
window->storages = yon_dictionary_rip(storages);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
|
@ -101,69 +102,49 @@ void on_storage_remove(GtkWidget *self, storage_config_window *window){
|
|
|
|
data->function=NULL;
|
|
|
|
data->function=NULL;
|
|
|
|
data->data=NULL;
|
|
|
|
data->data=NULL;
|
|
|
|
if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
if (yon_confirmation_dialog_call(self,data)){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
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_get(GTK_TREE_MODEL(window->StorageList),&iter,0,&storage,-1);
|
|
|
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
dictionary *storages = yon_dictionary_get(&window->storages,storage);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->storages_copy),&itar,0,&storage,-1);
|
|
|
|
if (storages){
|
|
|
|
|
|
|
|
gtk_list_store_remove(window->StorageList,&iter);
|
|
|
|
|
|
|
|
window->storages = yon_dictionary_rip(storages);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_repo_add(GtkWidget *self, storage_config_window *window){
|
|
|
|
void on_repo_add(GtkWidget *self, storage_config_window *window){
|
|
|
|
char *new_repo = (char*)gtk_entry_get_text(GTK_ENTRY(window->AddEntry));
|
|
|
|
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)){
|
|
|
|
if (yon_char_is_empty(new_repo)){
|
|
|
|
yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->AddEntry);
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_NAME_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_NAME_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter,itar, childiter;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
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_get(GTK_TREE_MODEL(window->StorageList),&iter,0,&name,-1);
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(window->StorageFilter),&itar,&iter);
|
|
|
|
dictionary *current = yon_dictionary_get(&window->storages,name);
|
|
|
|
gtk_tree_store_append(window->storages_copy,&childiter,&itar);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(current->data,new_repo,NULL);
|
|
|
|
gtk_tree_store_set(window->storages_copy,&childiter,2,new_repo,-1);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
yon_storage_config_update(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(new_repo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_accept(GtkWidget *self,dictionary *dict){
|
|
|
|
void on_storage_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
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*);
|
|
|
|
storage_config_window *window = yon_dictionary_get_data(dict->first->next,storage_config_window*);
|
|
|
|
dictionary *present = NULL;
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->ReposTree),NULL);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gtk_tree_store_clear(main_config.tree_store);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->RepoList),&iter);
|
|
|
|
yon_gtk_tree_store_copy_full(window->storages_copy,main_config.tree_store);
|
|
|
|
for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->RepoList),&iter)){
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->ReposTree),GTK_TREE_MODEL(main_config.tree_store));
|
|
|
|
char *name;
|
|
|
|
on_subwindow_close(self);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->RepoList),&iter,3,&name,-1);
|
|
|
|
}
|
|
|
|
if (yon_dictionary_get(&window->storages,name)){
|
|
|
|
|
|
|
|
dictionary *cur = yon_gtk_tree_store_get_children(GTK_TREE_STORE(widgets->RepoList),&iter,2);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(present,name,cur);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_tree_store_remove(widgets->RepoList,&iter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dictionary *dic=NULL;
|
|
|
|
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
|
|
|
for_dictionaries(dic,window->storages){
|
|
|
|
|
|
|
|
if (!yon_dictionary_get(&present,dic->key)){
|
|
|
|
|
|
|
|
gtk_tree_store_append(widgets->RepoList,&parent,NULL);
|
|
|
|
|
|
|
|
gtk_tree_store_set(widgets->RepoList,&parent,3,dic->key,-1);
|
|
|
|
|
|
|
|
char *name = yon_char_new(dic->key);
|
|
|
|
|
|
|
|
int pos = yon_char_find_last(name,'/');
|
|
|
|
|
|
|
|
if (pos>-1) free(yon_char_divide(name,pos));
|
|
|
|
|
|
|
|
gtk_tree_store_set(widgets->RepoList,&parent,2,name,3,dic->key,-1);
|
|
|
|
|
|
|
|
yon_gtk_tree_store_fill_children(widgets->RepoList,&parent,dic->data,2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
gboolean yon_storage_filter_func(GtkTreeModel *model,
|
|
|
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
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 *yon_storage_config_window_new(){
|
|
|
|
@ -182,30 +163,30 @@ storage_config_window *yon_storage_config_window_new(){
|
|
|
|
window->ReposBox = yon_gtk_builder_get_widget(builder,"ReposBox");
|
|
|
|
window->ReposBox = yon_gtk_builder_get_widget(builder,"ReposBox");
|
|
|
|
window->AddEntry = yon_gtk_builder_get_widget(builder,"AddEntry");
|
|
|
|
window->AddEntry = yon_gtk_builder_get_widget(builder,"AddEntry");
|
|
|
|
window->AddRepoButton = yon_gtk_builder_get_widget(builder,"AddRepoButton");
|
|
|
|
window->AddRepoButton = yon_gtk_builder_get_widget(builder,"AddRepoButton");
|
|
|
|
window->StorageList = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
window->TestTree = yon_gtk_builder_get_widget(builder,"TestTree");
|
|
|
|
|
|
|
|
window->storages_copy = gtk_tree_store_new(6,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
|
|
|
|
yon_gtk_tree_store_copy_full(main_config.tree_store,window->storages_copy);
|
|
|
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->TestTree),GTK_TREE_MODEL(window->storages_copy));
|
|
|
|
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->OpenExistingButton),"clicked",G_CALLBACK(on_storage_open),window);
|
|
|
|
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->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->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->AddRepoButton),"clicked",G_CALLBACK(on_repo_add),window);
|
|
|
|
window->storages=NULL;
|
|
|
|
g_signal_connect(G_OBJECT(window->StoragePathCombo),"changed",G_CALLBACK(on_storage_changed),window);
|
|
|
|
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->StoragePathCombo),GTK_TREE_MODEL(window->storages_copy));
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_storage_configure_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_storage_configure_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
storage_config_window *window = yon_storage_config_window_new();
|
|
|
|
storage_config_window *window = yon_storage_config_window_new();
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,"com.ublinux.ubl-settings-repomanager","storage-configuration-window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"storage-configuration-window");
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
GtkTreeIter iter;
|
|
|
|
window->StorageFilter = gtk_tree_model_filter_new(GTK_TREE_MODEL(window->storages_copy),NULL);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->RepoList),&iter);
|
|
|
|
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(window->StorageFilter),yon_storage_filter_func,widgets,NULL);
|
|
|
|
for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->RepoList),&iter)){
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->StoragePathCombo),GTK_TREE_MODEL(window->StorageFilter));
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->RepoList),&iter,2,&name,-1);
|
|
|
|
|
|
|
|
dictionary *cur = yon_gtk_tree_store_get_children(GTK_TREE_STORE(widgets->RepoList),&iter,2);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->storages,name,cur);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
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,"widgets",widgets);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
@ -214,6 +195,58 @@ void on_storage_configure_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//repo-add window section
|
|
|
|
//repo-add window section
|
|
|
|
|
|
|
|
gboolean yon_storage_filter_func(GtkTreeModel *model,
|
|
|
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
|
|
|
gpointer data){
|
|
|
|
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter))
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_repo_filter_func(GtkTreeModel *model,
|
|
|
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
|
|
|
gpointer data){
|
|
|
|
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_arch_filter_func(GtkTreeModel *model,
|
|
|
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
|
|
|
gpointer data){
|
|
|
|
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model,&parent,iter))
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_package_filter_func(GtkTreeModel *model,
|
|
|
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
|
|
|
gpointer data){
|
|
|
|
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, &parent, iter)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model,&parent,iter)){
|
|
|
|
|
|
|
|
if (gtk_tree_model_iter_parent(model, iter, &parent)){
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_repo_add);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_repo_add);
|
|
|
|
@ -241,6 +274,12 @@ repo_add_window *yon_repo_add_window_new(){
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->PackagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PackagesList"));
|
|
|
|
window->PackagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PackagesList"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window->storage_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
|
|
|
|
window->repo_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
|
|
|
|
window->arch_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
|
|
|
|
window->package_filter = (GtkTreeModelFilter*)gtk_tree_model_filter_new(GTK_TREE_MODEL(main_config.tree_store),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
@ -249,13 +288,22 @@ repo_add_window *yon_repo_add_window_new(){
|
|
|
|
|
|
|
|
|
|
|
|
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,"com.ublinux.ubl-settings-repomanager","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);
|
|
|
|
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->repo_filter,yon_repo_filter_func,NULL,NULL);
|
|
|
|
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->arch_filter,yon_arch_filter_func,NULL,NULL);
|
|
|
|
|
|
|
|
gtk_tree_model_filter_set_visible_func(window->package_filter,yon_package_filter_func,NULL,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->StorageCombo),GTK_TREE_MODEL(window->storage_filter));
|
|
|
|
|
|
|
|
gtk_combo_box_set_model(GTK_COMBO_BOX(window->RepositoryCombo),GTK_TREE_MODEL(window->repo_filter));
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_move_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_move_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,"com.ublinux.ubl-settings-repomanager","add-repo-window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"move-repo-window");
|
|
|
|
gtk_widget_show(window->MoveSourceFrame);
|
|
|
|
gtk_widget_show(window->MoveSourceFrame);
|
|
|
|
gtk_widget_show(window->MoveTargetFrame);
|
|
|
|
gtk_widget_show(window->MoveTargetFrame);
|
|
|
|
gtk_widget_hide(gtk_widget_get_parent(window->PackageSignCombo));
|
|
|
|
gtk_widget_hide(gtk_widget_get_parent(window->PackageSignCombo));
|
|
|
|
@ -264,7 +312,7 @@ void on_move_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
void on_remove_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_remove_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,"com.ublinux.ubl-settings-repomanager","add-repo-window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"remove-repo-window");
|
|
|
|
gtk_widget_hide(gtk_widget_get_parent(window->PackageSignCombo));
|
|
|
|
gtk_widget_hide(gtk_widget_get_parent(window->PackageSignCombo));
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -305,6 +353,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
widgets->RepoList = GTK_TREE_STORE(gtk_builder_get_object(builder,"RepoStore"));
|
|
|
|
widgets->RepoList = GTK_TREE_STORE(gtk_builder_get_object(builder,"RepoStore"));
|
|
|
|
widgets->RepoFileList = GTK_LIST_STORE(gtk_builder_get_object(builder,"RepoFileList"));
|
|
|
|
widgets->RepoFileList = GTK_LIST_STORE(gtk_builder_get_object(builder,"RepoFileList"));
|
|
|
|
widgets->RepoPackagesTre = GTK_LIST_STORE(gtk_builder_get_object(builder,"RepoPackagesTre"));
|
|
|
|
widgets->RepoPackagesTre = GTK_LIST_STORE(gtk_builder_get_object(builder,"RepoPackagesTre"));
|
|
|
|
|
|
|
|
main_config.tree_store = widgets->RepoList;
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DBConfigurationButton),"clicked",G_CALLBACK(on_storage_configure_clicked),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DBConfigurationButton),"clicked",G_CALLBACK(on_storage_configure_clicked),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_add_clicked),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_add_clicked),widgets);
|
|
|
|
|