|
|
|
|
@ -3,6 +3,33 @@
|
|
|
|
|
config main_config;
|
|
|
|
|
|
|
|
|
|
// functions
|
|
|
|
|
|
|
|
|
|
int yon_char_parsed_compare(const void *a, const void *b){
|
|
|
|
|
const config_str str_a = (const config_str)a;
|
|
|
|
|
const config_str str_b = (const config_str)b;
|
|
|
|
|
|
|
|
|
|
// if (strstr(*str_a,"+")&&strstr(*str_b,"-")) return 1;
|
|
|
|
|
// else if (strstr(*str_a,"-")&&strstr(*str_b,"+")) return -1;
|
|
|
|
|
|
|
|
|
|
// if (strstr(*str_a,"-")&&strstr(*str_b,"-")) return strcmp(*str_b,*str_a);
|
|
|
|
|
|
|
|
|
|
if ((strstr(*str_a,"-")||strstr(*str_a,"+"))&&(strstr(*str_b,"-")||strstr(*str_b,"+"))){
|
|
|
|
|
int a = atoi(*str_a+3);
|
|
|
|
|
int b = atoi(*str_b+3);
|
|
|
|
|
if (a>b) return 1;
|
|
|
|
|
else if (b>a) return -1;
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
return strcmp(*str_a, *str_b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config_str yon_char_parsed_sort(config_str parsed, int size){
|
|
|
|
|
config_str new_parsed = yon_char_parsed_copy(parsed,size);
|
|
|
|
|
qsort(new_parsed,size,sizeof(char*),yon_char_parsed_compare);
|
|
|
|
|
return new_parsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Config functions
|
|
|
|
|
void yon_save_parameters(main_window *widgets){
|
|
|
|
|
int mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->DHCPCombo));
|
|
|
|
|
switch(mode){
|
|
|
|
|
@ -188,10 +215,12 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo));
|
|
|
|
|
if (yon_file_is_directory(active)){
|
|
|
|
|
config_str parsed = yon_file_ls(active,&size);
|
|
|
|
|
config_str parsed_sorted = yon_char_parsed_sort(parsed,size);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed[i],_(parsed[i]));
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed_sorted[i],_(parsed_sorted[i]));
|
|
|
|
|
}
|
|
|
|
|
if (size) yon_char_parsed_free(parsed,size);
|
|
|
|
|
if (size) yon_char_parsed_free(parsed_sorted,size);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0);
|
|
|
|
|
}
|
|
|
|
|
free(active);
|
|
|
|
|
|