|
|
|
|
@ -224,6 +224,15 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
config_str parsed = yon_config_load(get_publication_list_command,&size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(parsed[i],'\n');
|
|
|
|
|
gtk_list_store_append(widgets->PublicationList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PublicationList,&iter,1,parsed[i],-1);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
|
@ -272,11 +281,9 @@ void on_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
} else if (self == widgets->MirrorTree){
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->MirrorTree)),&model,&iter)){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorConfigureButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorEditButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorRemoveButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorConfigureButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorEditButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->MirrorRemoveButton,0);
|
|
|
|
|
}
|
|
|
|
|
@ -574,7 +581,55 @@ void on_mirror_configure(GtkWidget *,main_window *widgets){
|
|
|
|
|
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,"window",window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_mirror_accept),dict);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_mirror_configure_accept),dict);
|
|
|
|
|
|
|
|
|
|
char *port_str = config(REPOPUBLIC_CACHE_full("port"));
|
|
|
|
|
if (!yon_char_is_empty(port_str)){
|
|
|
|
|
double port = atof(port_str);
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PortDefaultCheck),0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->PortSpin),port);
|
|
|
|
|
}
|
|
|
|
|
char *cache = config(REPOPUBLIC_CACHE_full("cache_dir"));
|
|
|
|
|
if (!yon_char_is_empty(cache)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->CacheDefaultCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->CacheEntry),cache);
|
|
|
|
|
}
|
|
|
|
|
char *inactivity = config(REPOPUBLIC_CACHE_full("purge_files_after"));
|
|
|
|
|
if (!yon_char_is_empty(inactivity)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->InactivityDurationDefaultCheck),0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->InactivityDurationSpin),atof(inactivity));
|
|
|
|
|
}
|
|
|
|
|
char *timeout = config(REPOPUBLIC_CACHE_full("download_timeout"));
|
|
|
|
|
if (!yon_char_is_empty(timeout)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->CacheTimeoutDefaultCheck),0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->CacheTimeoutSpin),atof(timeout));
|
|
|
|
|
}
|
|
|
|
|
char *proxy = config(REPOPUBLIC_CACHE_full("http_proxy"));
|
|
|
|
|
if (!yon_char_is_empty(proxy)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ProxyCheck),1);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->ProxyEntry),proxy);
|
|
|
|
|
}
|
|
|
|
|
char *agent = config(REPOPUBLIC_CACHE_full("user_agent"));
|
|
|
|
|
if (!yon_char_is_empty(agent)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->AgentDefaultCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AgentEntry),agent);
|
|
|
|
|
}
|
|
|
|
|
char *cron = config(REPOPUBLIC_CACHE_full("prefetch.cron"));
|
|
|
|
|
if (!yon_char_is_empty(cron)){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->CronEntry),cron);
|
|
|
|
|
}
|
|
|
|
|
char *delay = config(REPOPUBLIC_CACHE_full("prefetch.ttl_unaccessed_in_days"));
|
|
|
|
|
if (!yon_char_is_empty(delay)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UpdatesDelayDefaultCheck),0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->UpdatesDelaySpin),atof(delay));
|
|
|
|
|
}
|
|
|
|
|
char *request_delay = config(REPOPUBLIC_CACHE_full("prefetch.ttl_unupdated_in_days"));
|
|
|
|
|
if (!yon_char_is_empty(request_delay)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UpdatesRequestDelayDefaultCheck),0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->UpdatesRequestDelaySpin),atof(request_delay));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -698,6 +753,75 @@ void on_mirror_accept(GtkWidget *,dictionary *dict){
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_mirror_configure_accept(GtkWidget *, dictionary *dict){
|
|
|
|
|
// main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
mirror_configure_window *window = yon_dictionary_get_data(dict->first->next,mirror_configure_window*);
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->PortDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("port"));
|
|
|
|
|
} else {
|
|
|
|
|
long port = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->PortSpin));
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("port"),REPOPUBLIC_CACHE_full_command("port"),yon_char_from_long(port));
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CacheDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("cache_dir"));
|
|
|
|
|
} else {
|
|
|
|
|
char *cache_path = (char*)gtk_entry_get_text(GTK_ENTRY(window->CacheEntry));
|
|
|
|
|
if (!yon_char_is_empty(cache_path)){
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("cache_dir"),REPOPUBLIC_CACHE_full_command("cache_dir"),cache_path);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->CacheEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->InactivityDurationDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("purge_files_after"));
|
|
|
|
|
} else {
|
|
|
|
|
long duration_inactivity = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->InactivityDurationSpin));
|
|
|
|
|
char *duration_str = yon_char_from_long(duration_inactivity);
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("purge_files_after"),REPOPUBLIC_CACHE_full_command("purge_files_after"),duration_str);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->CacheTimeoutDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("download_timeout"));
|
|
|
|
|
} else{
|
|
|
|
|
long duration_inactivity = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->CacheTimeoutSpin));
|
|
|
|
|
char *duration_str = yon_char_from_long(duration_inactivity);
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("download_timeout"),REPOPUBLIC_CACHE_full_command("download_timeout"),duration_str);
|
|
|
|
|
}
|
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ProxyCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("http_proxy"));
|
|
|
|
|
} else {
|
|
|
|
|
char *proxy = (char*)gtk_entry_get_text(GTK_ENTRY(window->ProxyEntry));
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("http_proxy"),REPOPUBLIC_CACHE_full_command("http_proxy"),proxy);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AgentDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("user_agent"));
|
|
|
|
|
} else {
|
|
|
|
|
char *agent = (char*)gtk_entry_get_text(GTK_ENTRY(window->AgentEntry));
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("user_agent"),REPOPUBLIC_CACHE_full_command("user_agent"),agent);
|
|
|
|
|
}
|
|
|
|
|
char *expression = (char*)gtk_entry_get_text(GTK_ENTRY(window->CronEntry));
|
|
|
|
|
if (!yon_char_is_empty(expression)){
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("prefetch.cron"),REPOPUBLIC_CACHE_full_command("prefetch.cron"),expression);
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("prefetch.cron"));
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UpdatesDelayDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("prefetch.ttl_unaccessed_in_days"));
|
|
|
|
|
} else {
|
|
|
|
|
char *agent = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->UpdatesDelaySpin)));
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("prefetch.ttl_unaccessed_in_days"),REPOPUBLIC_CACHE_full_command("prefetch.ttl_unaccessed_in_days"),agent);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UpdatesRequestDelayDefaultCheck))){
|
|
|
|
|
yon_config_remove_by_key(REPOPUBLIC_CACHE_full("prefetch.ttl_unupdated_in_days"));
|
|
|
|
|
} else {
|
|
|
|
|
char *agent = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->UpdatesRequestDelaySpin)));
|
|
|
|
|
yon_config_register(REPOPUBLIC_CACHE_full("prefetch.ttl_unupdated_in_days"),REPOPUBLIC_CACHE_full_command("prefetch.ttl_unupdated_in_days"),agent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_mirror_path_removed(GtkWidget *, GtkWidget *target){
|
|
|
|
|
if (GTK_IS_WIDGET(target)){
|
|
|
|
|
gtk_widget_destroy(target);
|
|
|
|
|
@ -840,25 +964,34 @@ mirror_configure_window *yon_mirror_configure_window_new(){
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
|
|
|
|
|
window->PortDefaultCheck = yon_gtk_builder_get_widget(builder,"PortDefaultCheck");
|
|
|
|
|
window->PortEntry = yon_gtk_builder_get_widget(builder,"PortEntry");
|
|
|
|
|
window->PortSpin = yon_gtk_builder_get_widget(builder,"PortSpin");
|
|
|
|
|
window->CacheDefaultCheck = yon_gtk_builder_get_widget(builder,"CacheDefaultCheck");
|
|
|
|
|
window->CacheEntry = yon_gtk_builder_get_widget(builder,"CacheEntry");
|
|
|
|
|
window->CacheButton = yon_gtk_builder_get_widget(builder,"CacheButton");
|
|
|
|
|
window->InactivityDurationDefaultCheck = yon_gtk_builder_get_widget(builder,"InactivityDurationDefaultCheck");
|
|
|
|
|
window->InactivityDurationEntry = yon_gtk_builder_get_widget(builder,"InactivityDurationEntry");
|
|
|
|
|
window->InactivityDurationSpin = yon_gtk_builder_get_widget(builder,"InactivityDurationSpin");
|
|
|
|
|
window->CacheTimeoutDefaultCheck = yon_gtk_builder_get_widget(builder,"CacheTimeoutDefaultCheck");
|
|
|
|
|
window->CacheTimeoutEntry = yon_gtk_builder_get_widget(builder,"CacheTimeoutEntry");
|
|
|
|
|
window->CacheTimeoutSpin = yon_gtk_builder_get_widget(builder,"CacheTimeoutSpin");
|
|
|
|
|
window->ProxyCheck = yon_gtk_builder_get_widget(builder,"ProxyCheck");
|
|
|
|
|
window->ProxyEntry = yon_gtk_builder_get_widget(builder,"ProxyEntry");
|
|
|
|
|
window->AgentDefaultCheck = yon_gtk_builder_get_widget(builder,"AgentDefaultCheck");
|
|
|
|
|
window->AgentEntry = yon_gtk_builder_get_widget(builder,"AgentEntry");
|
|
|
|
|
window->CronEntry = yon_gtk_builder_get_widget(builder,"CronEntry");
|
|
|
|
|
window->UpdatesDelayDefaultCheck = yon_gtk_builder_get_widget(builder,"UpdatesDelayDefaultCheck");
|
|
|
|
|
window->UpdatesDelayEntry = yon_gtk_builder_get_widget(builder,"UpdatesDelayEntry");
|
|
|
|
|
window->UpdatesDelaySpin = yon_gtk_builder_get_widget(builder,"UpdatesDelaySpin");
|
|
|
|
|
window->UpdatesRequestDelayDefaultCheck = yon_gtk_builder_get_widget(builder,"UpdatesRequestDelayDefaultCheck");
|
|
|
|
|
window->UpdatesRequestDelayEntry = yon_gtk_builder_get_widget(builder,"UpdatesRequestDelayEntry");
|
|
|
|
|
window->UpdatesRequestDelaySpin = yon_gtk_builder_get_widget(builder,"UpdatesRequestDelaySpin");
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PortDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->PortSpin);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CacheDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->CacheEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CacheDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->CacheButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->InactivityDurationDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->InactivityDurationSpin);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CacheTimeoutDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->CacheTimeoutSpin);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ProxyCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->ProxyEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AgentDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->AgentEntry);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UpdatesDelayDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UpdatesDelaySpin);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UpdatesRequestDelayDefaultCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UpdatesRequestDelaySpin);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
@ -969,6 +1102,8 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MirrorEditButton),"clicked",G_CALLBACK(on_mirror_edit),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->WebPublicationEditButton),"clicked",G_CALLBACK(on_web_publish_edit),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->RepositoriesEditButton),"clicked",G_CALLBACK(on_repo_edit),widgets);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MirrorConfigureButton),"clicked",G_CALLBACK(on_mirror_configure),widgets);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->MirrorTree));
|
|
|
|
|
|