|
|
|
|
@ -64,6 +64,21 @@ void yon_save_parameters(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (!yon_char_is_empty(region)&&!yon_char_is_empty(zone)){
|
|
|
|
|
char *zone_parameter = yon_char_unite((char*)region,"/",(char*)zone,NULL);
|
|
|
|
|
yon_config_register(ZONE_parameter,ZONE_parameter_command,zone_parameter);
|
|
|
|
|
|
|
|
|
|
if (!yon_window_config_check_init()) return;
|
|
|
|
|
|
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now(tz);
|
|
|
|
|
long hours = atol(g_date_time_format(datetime,"%H"));
|
|
|
|
|
long minutes = atol(g_date_time_format(datetime,"%M"));
|
|
|
|
|
char *format = yon_settings_configuration_get(date_format_parameter);
|
|
|
|
|
char *date = g_date_time_format(datetime,format?format:"%d.%m.%Y");
|
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->HourSpin),hours);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->MinuteSpin),minutes);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),date);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -256,12 +271,15 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->TimeSyncTypeCombo),0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now_local();
|
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now(tz);
|
|
|
|
|
char *time = g_date_time_format(datetime,"%H %M");
|
|
|
|
|
char *format = yon_settings_configuration_get(date_format_parameter);
|
|
|
|
|
char *date = g_date_time_format(datetime,format?format:"%d.%m.%Y");
|
|
|
|
|
gtk_calendar_select_month(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_month(datetime)-1,g_date_time_get_year(datetime));
|
|
|
|
|
gtk_calendar_select_day(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_day_of_month(datetime));
|
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(time)){
|
|
|
|
|
char *hour = yon_char_divide_search(time," ",-1);
|
|
|
|
|
@ -379,9 +397,12 @@ void *yon_sync_thread_start(void *arg){
|
|
|
|
|
void on_sync_clicked(GtkWidget *, main_window *widgets){
|
|
|
|
|
char *hour = yon_char_from_long((long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->HourSpin)));
|
|
|
|
|
char *minute = yon_char_from_long((long)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->MinuteSpin)));
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now_local();
|
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now(tz);
|
|
|
|
|
char *second = g_date_time_format(datetime, "%S");
|
|
|
|
|
char *time = yon_char_unite(hour,":",minute,":",second,NULL);
|
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
|
|
|
|
|
|
const char *date = gtk_entry_get_text(GTK_ENTRY(widgets->DateEntry));
|
|
|
|
|
|
|
|
|
|
@ -504,12 +525,15 @@ void on_sync_hardware_clicked(){
|
|
|
|
|
void on_date_accept(GtkWidget *,main_window *widgets){
|
|
|
|
|
guint year=0, month=0, day=0;
|
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(widgets->DateCalendar),&year,&month,&day);
|
|
|
|
|
GDateTime *datetime = g_date_time_new_local(year,++month,day,0,0,0);
|
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
|
GDateTime *datetime = g_date_time_new(tz,year,++month,day,0,0,0);
|
|
|
|
|
char *format = yon_settings_configuration_get(date_format_parameter);
|
|
|
|
|
char *date = g_date_time_format(datetime,format?format:"%d.%m.%Y");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),date);
|
|
|
|
|
gtk_popover_popdown(GTK_POPOVER(widgets->DatePopover));
|
|
|
|
|
free(date);
|
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_date_cancel(GtkWidget *, main_window *widgets){
|
|
|
|
|
|