From 441032aa8c3c5e79a8f1f0de730ff1d050f3007a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 24 Dec 2024 16:59:49 +0600 Subject: [PATCH] Fixed repository parameter --- source/ubl-settings-update.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 83266cd..e55114c 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -794,13 +794,29 @@ void on_repo_edit(GtkWidget *,main_window *widgets){ section->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo"); section->edits=0; - if (strstr(repos[i],"@")){ - char *type = yon_char_divide_search(repos[i],"@",-1); - gtk_combo_box_set_active_id(GTK_COMBO_BOX(section->TypeCombo),type); - free(type); + char *path = yon_char_new(repos[i]); + if (strstr(repos[i],"file://")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(section->TypeCombo),0); + free(yon_char_divide(path,6)); - } else + } 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 { 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); 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){ for_dictionaries (dact, window->sections){ 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); if (!yon_char_is_empty(sources)) free(sources); 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)); if (!yon_char_is_empty(source_main)) { 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); if (!yon_char_is_empty(sources)) free(sources); sources = temp;