|
|
|
|
@ -307,8 +307,8 @@ void on_date_clicked(GtkWidget *,main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_region_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
char *active = (char*)gtk_combo_box_get_active_id(self);
|
|
|
|
|
active = yon_char_append("/usr/share/zoneinfo/",active);
|
|
|
|
|
char *active_name = (char*)gtk_combo_box_get_active_id(self);
|
|
|
|
|
char *active = yon_char_append("/usr/share/zoneinfo/",active_name);
|
|
|
|
|
int size;
|
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo));
|
|
|
|
|
if (yon_file_is_directory(active)){
|
|
|
|
|
@ -316,12 +316,25 @@ void on_region_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
config_str parsed_sorted = yon_char_parsed_sort(parsed,size);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
if (strstr(parsed_sorted[i],"GMT")){
|
|
|
|
|
char *temp = yon_char_unite("UTC",parsed_sorted[i]+3," (",parsed_sorted[i],")",NULL);
|
|
|
|
|
free(parsed_sorted[i]);
|
|
|
|
|
parsed_sorted[i]=temp;
|
|
|
|
|
}
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed_sorted[i],_(parsed_sorted[i]));
|
|
|
|
|
char *name_string = NULL;
|
|
|
|
|
if (strstr(parsed_sorted[i],"GMT")){
|
|
|
|
|
char *temp = yon_char_unite("UTC",parsed_sorted[i]+3," (",parsed_sorted[i],")",NULL);
|
|
|
|
|
free(parsed_sorted[i]);
|
|
|
|
|
parsed_sorted[i]=temp;
|
|
|
|
|
} else if (strcmp(active_name,"Etc")){
|
|
|
|
|
char *zonereg = yon_char_unite(active,"/",parsed_sorted[i],NULL);
|
|
|
|
|
if (g_setenv("TZ",zonereg,1)){
|
|
|
|
|
time_t curtime = time(NULL);
|
|
|
|
|
struct tm *local = localtime(&curtime);
|
|
|
|
|
char *hour_str = yon_char_from_long(local->tm_gmtoff/3600);
|
|
|
|
|
char *minute = yon_char_from_long((local->tm_gmtoff%3600)/60);
|
|
|
|
|
name_string = yon_char_unite("(UTC ",local->tm_gmtoff>0?"+":"-",hour_str,":",minute,") ",_(parsed_sorted[i]),NULL);
|
|
|
|
|
free(hour_str);
|
|
|
|
|
free(minute);
|
|
|
|
|
free(zonereg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed_sorted[i],name_string?name_string:_(parsed_sorted[i]));
|
|
|
|
|
}
|
|
|
|
|
if (size) yon_char_parsed_free(parsed_sorted,size);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0);
|
|
|
|
|
|