|
|
|
|
@ -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,23 @@ 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);
|
|
|
|
|
name_string = yon_char_unite("(UTC ",local->tm_gmtoff>0?"+":"",strlen(hour_str)<2&&local->tm_gmtoff!=0?"0":"",hour_str,") ",_(parsed_sorted[i]),NULL);
|
|
|
|
|
free(hour_str);
|
|
|
|
|
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);
|
|
|
|
|
@ -531,7 +542,10 @@ void config_init(){
|
|
|
|
|
if (size>0){
|
|
|
|
|
if (strcmp(parsed[0],"(null)\n")){
|
|
|
|
|
yon_char_remove_last_symbol(parsed[0],'\n');
|
|
|
|
|
main_config.ntp_default = parsed[0];
|
|
|
|
|
if (strstr(parsed[0],"[")&&strstr(parsed[0],"]"))
|
|
|
|
|
main_config.ntp_default = strstr(parsed[0],"] ")+2;
|
|
|
|
|
else
|
|
|
|
|
main_config.ntp_default = parsed[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -566,7 +580,6 @@ void yon_main_window_complete(main_window **window){
|
|
|
|
|
widgets->DateCalendar = yon_gtk_builder_get_widget(builder,"DateCalendar");
|
|
|
|
|
widgets->DateCancelButton = yon_gtk_builder_get_widget(builder,"DateCancelButton");
|
|
|
|
|
widgets->DateAcceptButton = yon_gtk_builder_get_widget(builder,"DateAcceptButton");
|
|
|
|
|
|
|
|
|
|
widgets->zone_list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
|
}
|
|
|
|
|
// Signal configuration
|
|
|
|
|
@ -699,6 +712,7 @@ 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((template_main_window*)widgets,argv,argc);
|
|
|
|
|
yon_main_window_complete((main_window**)&widgets);
|
|
|
|
|
if (getuid()!=0){
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
|
Перевод:
Северная Дакота