|
|
|
@ -266,39 +266,41 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
GTimeZone *tz = g_time_zone_new_identifier(config(ZONE_parameter));
|
|
|
|
GDateTime *datetime = g_date_time_new_now(tz);
|
|
|
|
if (tz){
|
|
|
|
char *time = g_date_time_format(datetime,"%H %M");
|
|
|
|
GDateTime *datetime = g_date_time_new_now(tz);
|
|
|
|
char *format = yon_settings_configuration_get(date_format_parameter);
|
|
|
|
char *time = g_date_time_format(datetime,"%H %M");
|
|
|
|
char *date = g_date_time_format(datetime,format?format:"%d.%m.%Y");
|
|
|
|
char *format = yon_settings_configuration_get(date_format_parameter);
|
|
|
|
gtk_calendar_select_month(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_month(datetime)-1,g_date_time_get_year(datetime));
|
|
|
|
char *date = g_date_time_format(datetime,format?format:"%d.%m.%Y");
|
|
|
|
gtk_calendar_select_day(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_day_of_month(datetime));
|
|
|
|
gtk_calendar_select_month(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_month(datetime)-1,g_date_time_get_year(datetime));
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
gtk_calendar_select_day(GTK_CALENDAR(widgets->DateCalendar),g_date_time_get_day_of_month(datetime));
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
g_date_time_unref(datetime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(time)){
|
|
|
|
|
|
|
|
char *hour = yon_char_divide_search(time," ",-1);
|
|
|
|
|
|
|
|
double hours = atof(hour);
|
|
|
|
|
|
|
|
double minutes = atof(time);
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->HourSpin),hours);
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->MinuteSpin),minutes);
|
|
|
|
|
|
|
|
free(hour);
|
|
|
|
|
|
|
|
free(time);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->HourSpin),0.0f);
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->MinuteSpin),0.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(time)){
|
|
|
|
if (!yon_char_is_empty(date)){
|
|
|
|
char *hour = yon_char_divide_search(time," ",-1);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),date);
|
|
|
|
double hours = atof(hour);
|
|
|
|
} else {
|
|
|
|
double minutes = atof(time);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),"");
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->HourSpin),hours);
|
|
|
|
}
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->MinuteSpin),minutes);
|
|
|
|
|
|
|
|
free(hour);
|
|
|
|
|
|
|
|
free(time);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->HourSpin),0.0f);
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->MinuteSpin),0.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(date)){
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->NTPEntry),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),date);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->DHCPCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
} else {
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TimeSyncTypeCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->DateEntry),"");
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_time_zone_unref(tz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->NTPEntry),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->DHCPCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TimeSyncTypeCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->RegionCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ZoneCombo),G_CALLBACK(yon_save_parameters),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_date_clicked(GtkWidget *,main_window *widgets){
|
|
|
|
void on_date_clicked(GtkWidget *,main_window *widgets){
|
|
|
|
|