Fixed repository parameter

pull/59/head
parent 4d8884d71e
commit 441032aa8c

@ -794,13 +794,29 @@ void on_repo_edit(GtkWidget *,main_window *widgets){
section->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); section->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
section->edits=0; section->edits=0;
if (strstr(repos[i],"@")){ char *path = yon_char_new(repos[i]);
char *type = yon_char_divide_search(repos[i],"@",-1); if (strstr(repos[i],"file://")){
gtk_combo_box_set_active_id(GTK_COMBO_BOX(section->TypeCombo),type); gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),0);
free(type); free(yon_char_divide(path,6));
} else if (strstr(repos[i],"ftp://")){
gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),1);
free(yon_char_divide(path,5));
} else if (strstr(repos[i],"http://")){
gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),2);
free(yon_char_divide(path,6));
} else if (strstr(repos[i],"https://")){
gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),3);
free(yon_char_divide(path,7));
} else } else {
gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),4); gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),4);
}
gtk_entry_set_text(GTK_ENTRY(section->PathEntry),path);
free(path);
yon_dictionary_add_or_create_if_exists_with_data(window->sections,(char*)target,section); yon_dictionary_add_or_create_if_exists_with_data(window->sections,(char*)target,section);
gtk_entry_set_text(GTK_ENTRY(section->PathEntry),repos[i]); gtk_entry_set_text(GTK_ENTRY(section->PathEntry),repos[i]);
@ -1049,7 +1065,7 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
if (window->sections){ if (window->sections){
for_dictionaries (dact, window->sections){ for_dictionaries (dact, window->sections){
char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(((path_section*)dact->data)->TypeCombo)); char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(((path_section*)dact->data)->TypeCombo));
char *cur = yon_char_unite(type?type:"",type?"@":"",(char*)gtk_entry_get_text(GTK_ENTRY(((path_section*)dact->data)->PathEntry)),NULL); char *cur = yon_char_unite(type?type:"",(char*)gtk_entry_get_text(GTK_ENTRY(((path_section*)dact->data)->PathEntry)),NULL);
char *temp = yon_char_unite(sources,!yon_char_is_empty(sources)?",":"",cur,NULL); char *temp = yon_char_unite(sources,!yon_char_is_empty(sources)?",":"",cur,NULL);
if (!yon_char_is_empty(sources)) free(sources); if (!yon_char_is_empty(sources)) free(sources);
sources = temp; sources = temp;
@ -1058,7 +1074,7 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
char *source_main = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepoSourceEntry)); char *source_main = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepoSourceEntry));
if (!yon_char_is_empty(source_main)) { if (!yon_char_is_empty(source_main)) {
char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepoSourceCombo)); char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepoSourceCombo));
source_main = yon_char_unite(type?type:"",type?"@":"",source_main,NULL); source_main = yon_char_unite(type?type:"",source_main,NULL);
char *temp = yon_char_unite(sources,!yon_char_is_empty(sources)?",":"",source_main,NULL); char *temp = yon_char_unite(sources,!yon_char_is_empty(sources)?",":"",source_main,NULL);
if (!yon_char_is_empty(sources)) free(sources); if (!yon_char_is_empty(sources)) free(sources);
sources = temp; sources = temp;

Loading…
Cancel
Save