|
|
|
|
@ -27,7 +27,7 @@ void on_save_done(main_window *, config_str output, int size){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_save_interface(main_window *widgets){
|
|
|
|
|
void yon_save_interface( main_window *widgets){
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoUpdateCheck))){
|
|
|
|
|
yon_config_register(AUTOUPDATE,AUTOUPDATE_command,"enable");
|
|
|
|
|
} else {
|
|
|
|
|
@ -61,11 +61,11 @@ void yon_save_interface(main_window *widgets){
|
|
|
|
|
case 3: interval = yon_char_unite(int_str,"M",NULL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
yon_config_register(AUTOUPDATE,AUTOUPDATE_command,interval);
|
|
|
|
|
yon_config_register(AUTOUPDATE_interval,AUTOUPDATE_interval_command,interval);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->UpdateRepoListCombo))){
|
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UpdateRepoListCheck))){
|
|
|
|
|
yon_config_remove_by_key(AUTOUPDATE_repos);
|
|
|
|
|
} else {
|
|
|
|
|
char *repos = "";
|
|
|
|
|
@ -112,7 +112,7 @@ void yon_save_interface(main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PublicationCombo))){
|
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->PublicationCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_NET_parameter);
|
|
|
|
|
} else {
|
|
|
|
|
char *repos = "";
|
|
|
|
|
@ -175,6 +175,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
char *command = yon_config_get_custom_command(path);
|
|
|
|
|
yon_config_load_config(type,command,NULL);
|
|
|
|
|
}
|
|
|
|
|
yon_config_set_ignore(AUTOUPDATE_timestamp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_interface_update(main_window *widgets){
|
|
|
|
|
@ -241,13 +242,9 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
{
|
|
|
|
|
int repos_size;
|
|
|
|
|
config_str publish_repos = yon_config_load(get_publication_list_command,&repos_size);
|
|
|
|
|
for (int i=0;i<repos_size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(publish_repos[i],'\n');
|
|
|
|
|
gtk_list_store_append(widgets->PublicationList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PublicationList,&iter,0,1,1,publish_repos[i],-1);
|
|
|
|
|
}
|
|
|
|
|
char *publish = config(REPOPUBLIC_NET_parameter);
|
|
|
|
|
if (publish) {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PublicationCheck),1);
|
|
|
|
|
int cur_size;
|
|
|
|
|
config_str parsed = yon_char_parse(publish,&cur_size,",");
|
|
|
|
|
if (cur_size){
|
|
|
|
|
@ -261,14 +258,23 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
} else {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RecieveDBFromNetCheck),0);
|
|
|
|
|
}
|
|
|
|
|
for (int i=0;i<repos_size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(publish_repos[i],'\n');
|
|
|
|
|
gtk_list_store_append(widgets->PublicationList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PublicationList,&iter,1,publish_repos[i],0,!(cur_size-2)||(cur_size-2&&yon_char_parsed_check_exist(parsed,cur_size,publish_repos[i])>-1)?1:0,-1);
|
|
|
|
|
}
|
|
|
|
|
if (cur_size>2){
|
|
|
|
|
for (int i=2;i<cur_size;i++){
|
|
|
|
|
gtk_list_store_append(widgets->PublicationList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PublicationList,&iter,1,parsed[i],-1);
|
|
|
|
|
if (yon_char_parsed_check_exist(publish_repos,repos_size,parsed[i])==-1){
|
|
|
|
|
gtk_list_store_append(widgets->PublicationList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PublicationList,&iter,1,parsed[i],-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,cur_size);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PublicationCheck),1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
@ -323,6 +329,11 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
int repos_size;
|
|
|
|
|
config_str overall_repos = yon_config_load(get_publication_list_command,&repos_size);
|
|
|
|
|
char *autoupdate_repos = config(AUTOUPDATE_repos);
|
|
|
|
|
if (autoupdate_repos){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateRepoListCheck),1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateRepoListCheck),0);
|
|
|
|
|
}
|
|
|
|
|
if (repos_size){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
@ -330,31 +341,22 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
for (int i=0;i<repos_size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(overall_repos[i],'\n');
|
|
|
|
|
gtk_list_store_append(GTK_LIST_STORE(widgets->UpdateRepoList),&iter);
|
|
|
|
|
gtk_list_store_set(widgets->UpdateRepoList,&iter,1,overall_repos[i],0,!parsed_size||(parsed_size&&yon_char_parsed_check_exist(overall_repos,repos_size,overall_repos[i])>-1)?1:0,-1);
|
|
|
|
|
gtk_list_store_set(widgets->UpdateRepoList,&iter,1,overall_repos[i],0,!parsed_size||(parsed_size&&yon_char_parsed_check_exist(parsed,parsed_size,overall_repos[i])>-1)?1:0,-1);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
}
|
|
|
|
|
autoupdate_config = config(AUTOUPDATE_interval);
|
|
|
|
|
if (!yon_char_is_empty(autoupdate_config)){
|
|
|
|
|
if (!strcmp(autoupdate_config,"boot")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0);
|
|
|
|
|
} else {
|
|
|
|
|
if (strstr(autoupdate_config,"min")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),1);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0);
|
|
|
|
|
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='h'){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),2);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),1);
|
|
|
|
|
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='d'){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),2);
|
|
|
|
|
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='M'){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),4);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3);
|
|
|
|
|
}
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),atol(autoupdate_config));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *timestamp = config("AUTOUPDATE[timestamp]");
|
|
|
|
|
if (!yon_char_is_empty(timestamp)){
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->HeadLabel),timestamp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -686,19 +688,19 @@ void on_mirror_remove_accept(GtkWidget *, main_window *widgets){
|
|
|
|
|
void on_repositories_remove_accept(GtkWidget *, main_window *widgets){
|
|
|
|
|
GtkTreeModel *model=NULL;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepositoriesTree)),&model,&iter)) {
|
|
|
|
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepositoriesTree)),&model,&iter)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *repo;
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&repo,-1);
|
|
|
|
|
yon_config_remove_by_key(repo);
|
|
|
|
|
yon_config_remove_by_key(REPOSITORY(repo));
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_repo_edit(GtkWidget *,main_window *widgets){
|
|
|
|
|
repo_add_window *window = yon_repo_add_window_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),ADD_REPO_LABEL,icon_path,"add_repo_window");
|
|
|
|
|
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),EDIT_REPO_LABEL,icon_path,"add_repo_window");
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeadLabel),EDIT_REPO_LABEL);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
char *target;
|
|
|
|
|
gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepositoriesTree)),NULL,&iter);
|
|
|
|
|
@ -722,12 +724,10 @@ void on_repo_edit(GtkWidget *,main_window *widgets){
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->RepoSourceEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepoSourceCombo));
|
|
|
|
|
char *full_name = yon_char_append(type,target);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->RepoSourceEntry),"");
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_mirror_path_add_path);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->SourceBox),yon_gtk_builder_get_widget(builder,"PathRemovalBox"),0,0,2);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"PathEntry")),full_name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"PathEntry")),target);
|
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"PathEditButton"),"clicked",G_CALLBACK(on_mirror_path_edit),gtk_builder_get_object(builder,"PathRemovalBox"));
|
|
|
|
|
g_signal_connect(gtk_builder_get_object(builder,"PathRemoveButton"),"clicked",G_CALLBACK(on_mirror_path_removed),gtk_builder_get_object(builder,"PathRemovalBox"));
|
|
|
|
|
}
|
|
|
|
|
@ -926,9 +926,6 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(window->SourceBox));
|
|
|
|
|
for (guint i=0;i<g_list_length(list);i++){
|
|
|
|
|
GList *container = gtk_container_get_children(GTK_CONTAINER(g_list_nth_data(list,i)));
|
|
|
|
|
// if (gtk_entry_get_has_frame(GTK_ENTRY(g_list_nth_data(container,0)))){
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
char *cur = (char*)gtk_entry_get_text(GTK_ENTRY(g_list_nth_data(container,0)));
|
|
|
|
|
char *temp = yon_char_unite(sources,yon_char_is_empty(sources)?"":",",cur,NULL);
|
|
|
|
|
if (!yon_char_is_empty(sources)) free(sources);
|
|
|
|
|
@ -976,12 +973,6 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
|
|
|
|
|
sign_level_condiition="DatabaseTrustAll";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// int usage_level_default = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageDefaultCheck));
|
|
|
|
|
// int usage_level_enable_update = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableUpdateCheck));
|
|
|
|
|
// int usage_level_enable_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableSearchCheck));
|
|
|
|
|
// int usage_level_enable_install = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableInsallCheck));
|
|
|
|
|
// int usage_level_sysupgrade = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageSysupgradeCheck));
|
|
|
|
|
|
|
|
|
|
char *final = yon_char_unite(sources,";",sign_level_package,",",sign_level_condiition,";",";",enabled?"":"disable",NULL);
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(window->name)&&strcmp(repo_name,window->name)){
|
|
|
|
|
@ -1457,7 +1448,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
widgets->UpdateIntervalSpin = yon_gtk_builder_get_widget(builder,"UpdateIntervalSpin");
|
|
|
|
|
widgets->UpdateToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UpdateToggleCell"));
|
|
|
|
|
widgets->UpdateIntervalCombo = yon_gtk_builder_get_widget(builder,"UpdateIntervalCombo");
|
|
|
|
|
widgets->UpdateRepoListCombo = yon_gtk_builder_get_widget(builder,"UpdateRepoListCombo");
|
|
|
|
|
widgets->UpdateRepoListCheck = yon_gtk_builder_get_widget(builder,"UpdateRepoListCheck");
|
|
|
|
|
widgets->UpdateRepoTree = yon_gtk_builder_get_widget(builder,"UpdateRepoTree");
|
|
|
|
|
widgets->RepositoriesRepoListConfigurationCheck = yon_gtk_builder_get_widget(builder,"RepositoriesRepoListConfigurationCheck");
|
|
|
|
|
widgets->RepositoriesDisableSystemReposCheck = yon_gtk_builder_get_widget(builder,"RepositoriesDisableSystemReposCheck");
|
|
|
|
|
@ -1473,7 +1464,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
widgets->PublicationTree = yon_gtk_builder_get_widget(builder,"PublicationTree");
|
|
|
|
|
widgets->PublicationUpdateButton = yon_gtk_builder_get_widget(builder,"PublicationUpdateButton");
|
|
|
|
|
widgets->PublicationToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"PublicationToggleCell"));
|
|
|
|
|
widgets->PublicationCombo = yon_gtk_builder_get_widget(builder,"PublicationCombo");
|
|
|
|
|
widgets->PublicationCheck = yon_gtk_builder_get_widget(builder,"PublicationCheck");
|
|
|
|
|
widgets->WebPublicationUpdateButton = yon_gtk_builder_get_widget(builder,"WebPublicationUpdateButton");
|
|
|
|
|
widgets->WebPublicationAddButton = yon_gtk_builder_get_widget(builder,"WebPublicationAddButton");
|
|
|
|
|
widgets->WebPublicationEditButton = yon_gtk_builder_get_widget(builder,"WebPublicationEditButton");
|
|
|
|
|
@ -1525,6 +1516,10 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UpdateToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets->UpdateRepoList);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->PublicationToggleCell),"toggled",G_CALLBACK(on_toggle_cell_toggled),widgets->PublicationList);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UpdateRepoListCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->UpdateRepoTree);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationTree);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationUpdateButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->WebPublicationTree));
|
|
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
|
|
@ -1557,7 +1552,6 @@ int main(int argc, char *argv[]){
|
|
|
|
|
yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL);
|
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
|
yon_root_button_setup(widgets,argv,argc);
|
|
|
|
|
yon_main_window_complete((main_window*)widgets);
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
|