summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-08-14 19:16:15 +0200
committerraveit65 <[email protected]>2019-08-20 16:10:38 +0200
commit0a001ed9dce071b13d75219f51b4fd68f9697f50 (patch)
treee9e107227e8e51c6db90e0da4140756562142d71
parentd1706867cc6f69a237b21ba4428d70b2df42494d (diff)
downloadmate-control-center-0a001ed9dce071b13d75219f51b4fd68f9697f50.tar.bz2
mate-control-center-0a001ed9dce071b13d75219f51b4fd68f9697f50.tar.xz
time-admin: Display current time in time-admin.ui on startup
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->HourSpin),LocalTime->tm_hour); gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->MinuteSpin),LocalTime->tm_min); char *str = g_strdup_printf ("%02d", LocalTime->tm_sec); gtk_entry_set_text(GTK_ENTRY(ta->SecondSpin),str); g_free (str);
-rw-r--r--capplets/time-admin/src/main.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/capplets/time-admin/src/main.c b/capplets/time-admin/src/main.c
index bbb960d9..9fdc2cb0 100644
--- a/capplets/time-admin/src/main.c
+++ b/capplets/time-admin/src/main.c
@@ -142,19 +142,32 @@ static void InitMainWindow(TimeAdmin *ta)
gtk_lock_button_set_permission(GTK_LOCK_BUTTON (ta->ButtonLock),ta->Permission);
g_signal_connect(ta->Permission, "notify", G_CALLBACK (on_permission_changed), ta);
- struct tm *LocalTime = GetCurrentTime();
- ta->UpdateTimeId = 0;
- ta->ApplyId = 0;
- Update_Clock_Start(ta);
+ /* NTP sync switch */
+ ta->NtpState = GetNtpState(ta);
+ gtk_switch_set_state (GTK_SWITCH(ta->NtpSyncSwitch), ta->NtpState);
+
+ /* Time zone */
SetupTimezoneDialog(ta);
const char *TimeZone = GetTimeZone(ta);
char *ZoneName = translate(TimeZone);
gtk_entry_set_text (GTK_ENTRY (ta->TimeZoneEntry), ZoneName);
g_free (ZoneName);
- ta->NtpState = GetNtpState(ta);
- gtk_switch_set_state (GTK_SWITCH(ta->NtpSyncSwitch), ta->NtpState);
+
+ /* Local time & date */
+ /* time */
+ struct tm *LocalTime = GetCurrentTime();
+ ta->UpdateTimeId = 0;
+ ta->ApplyId = 0;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->HourSpin),LocalTime->tm_hour);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(ta->MinuteSpin),LocalTime->tm_min);
+ char *str = g_strdup_printf ("%02d", LocalTime->tm_sec);
+ gtk_entry_set_text(GTK_ENTRY(ta->SecondSpin),str);
+ g_free (str);
+ /* date */
gtk_calendar_mark_day (GTK_CALENDAR(ta->Calendar), LocalTime->tm_mday);
ta->OldDay = LocalTime->tm_mday;
+
+ Update_Clock_Start(ta);
}
static int RecordPid(void)