Beispiel #1
0
func (m *Manager) destroy() {
	if m.settings != nil {
		m.settings.Unref()
		m.settings = nil
	}

	if m.td1 != nil {
		timedate1.DestroyTimedate1(m.td1)
		m.td1 = nil
	}

	dbus.UnInstallObject(m)
}
func setTimezoneByLocale(locale string) error {
	tm, err := timedate1.NewTimedate1("org.freedesktop.timedate1",
		"/org/freedesktop/timedate1")
	if err != nil {
		return err
	}
	defer timedate1.DestroyTimedate1(tm)

	var zone string
	switch locale {
	case "zh_CN.UTF-8":
		zone = "Asia/Shanghai"
	case "zh_TW.UTF-8":
		zone = "Asia/Taipei"
	default:
		zone = "UTC"
	}

	return tm.SetTimezone(zone, false)
}