Fixed update interval loading

pull/59/head
parent 1ee60c4d64
commit 5c0a5e2ec7

@ -363,18 +363,27 @@ void yon_interface_update(main_window *widgets){
autoupdate_config = config(AUTOUPDATE_interval); autoupdate_config = config(AUTOUPDATE_interval);
if (!yon_char_is_empty(autoupdate_config)){ if (!yon_char_is_empty(autoupdate_config)){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),0);
if (strstr(autoupdate_config,"min")){ int parsed_size;
config_str parsed = yon_char_parse(autoupdate_config,&parsed_size,",");
if (yon_char_parsed_check_exist(parsed,parsed_size,"boot")!=-1){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->BootCheck),1);
}
if (strstr(parsed[parsed_size-1],"min")){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0);
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='h'){ } else if (parsed[parsed_size-1][strlen(parsed[parsed_size-1])-1]=='h'){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),1); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),1);
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='d'){ } else if (parsed[parsed_size-1][strlen(parsed[parsed_size-1])-1]=='d'){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),2);
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='M'){ } else if (parsed[parsed_size-1][strlen(parsed[parsed_size-1])-1]=='M'){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3);
} }
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),atol(autoupdate_config)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),atol(parsed[parsed_size-1]));
} else { } else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->BootCheck),0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),0);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0);
} }
} }

@ -83,6 +83,9 @@
#define AUTOUPDATE_timestamp "AUTOUPDATE[timestamp]" #define AUTOUPDATE_timestamp "AUTOUPDATE[timestamp]"
#define AUTOUPDATE_timestamp_command "ubconfig --source global get [update] AUTOUPDATE[timestamp]" #define AUTOUPDATE_timestamp_command "ubconfig --source global get [update] AUTOUPDATE[timestamp]"
extern template_app_info template_app_information;
typedef char* string; typedef char* string;
string version_application; string version_application;

Loading…
Cancel
Save