diff --git a/source/ubinstall-gtk-region.c b/source/ubinstall-gtk-region.c index c63ffcb..57047a3 100644 --- a/source/ubinstall-gtk-region.c +++ b/source/ubinstall-gtk-region.c @@ -261,4 +261,12 @@ void yon_region_init(main_window *widgets){ gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->ZoneCombo),0); gtk_switch_set_active(GTK_SWITCH(widgets->RegionSensitiveSwitch),0); } + if (!gtk_switch_get_active(GTK_SWITCH(widgets->RegionSensitiveSwitch))){ + config_str autotimezone = yon_config_load(internet_tomezone_check_command,(int*)&size); + if (size&&!yon_char_is_empty(autotimezone[0])){ + yon_char_remove_last_symbol(autotimezone[0],'\n'); + gtk_entry_set_text(GTK_ENTRY(widgets->RegionEntry),autotimezone[0]); + cc_timezone_map_set_timezone(CC_TIMEZONE_MAP(widgets->RegionMapTarget),autotimezone[0]); + } + } } \ No newline at end of file diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 0998cbf..1eed35a 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -142,6 +142,8 @@ layout && /description:/ {\ }\ \" | sort -u\ " + +#define internet_tomezone_check_command "curl -s ipinfo.io/timezone" #define ubinstall_dry_run_command "ubinstall --dry-run" #define os_name_get_command "sed -En 's/^PRETTY_NAME=[\"]*([^\"]+)[\"]*/\\1/p' /etc/os-release"