func (s *ConnectionSession) setPropAvailableKeys() { s.AvailableKeys = make(map[string][]string) // clear structure for _, section := range getAvailableSections(s.data) { s.AvailableKeys[section] = generalGetSettingAvailableKeys(s.data, section) } dbus.NotifyChange(s, "AvailableKeys") }
func (t *Theme) setPropString(handle *string, name, value string) { if *handle == value { return } *handle = value dbus.NotifyChange(t, name) }
func (a *Audio) addSinkInput(idx uint32) { for _, si := range a.SinkInputs { if si.index == idx { return } } core, err := a.core.GetSinkInput(idx) if err != nil { logger.Warning(err) return } if filterSinkInput(core) { return } si := NewSinkInput(core) err = dbus.InstallOnSession(si) if err != nil { logger.Error(err) return } a.SinkInputs = append(a.SinkInputs, si) dbus.NotifyChange(a, "SinkInputs") }
func (m *Manager) setPropAllowGuest(allow bool) { if m.AllowGuest == allow { return } m.AllowGuest = allow dbus.NotifyChange(m, "AllowGuest") }
func (m *Manager) setPropGuestIcon(icon string) { if icon == m.GuestIcon { return } m.GuestIcon = icon dbus.NotifyChange(m, "GuestIcon") }
func (m *Manager) setPropString(handler *string, prop, value string) { if *handler == value { return } *handler = value dbus.NotifyChange(m, prop) }
func (s *ConnectionSession) setPropAllowDelete() { if isNmObjectPathValid(s.devPath) && nmGeneralGetDeviceUniqueUuid(s.devPath) == s.Uuid { s.AllowDelete = false } else { s.AllowDelete = true } dbus.NotifyChange(s, "AllowDelete") }
func (u *User) setPropString(handler *string, prop string, value string) { if *handler == value { return } *handler = value dbus.NotifyChange(u, prop) }
func (u *User) setPropInt32(handler *int32, prop string, value int32) { if *handler == value { return } *handler = value dbus.NotifyChange(u, prop) }
func (m *Manager) setPropBool(handler *bool, prop string, value bool) { if *handler == value { return } *handler = value dbus.NotifyChange(m, prop) }
func (theme *Theme) setPropSelectedItemColor(value string) { selectedItemColor := value if len(selectedItemColor) == 0 { // set a default value to avoid empty string selectedItemColor = theme.tplJSONData.DarkScheme.SelectedItemColor } theme.SelectedItemColor = selectedItemColor theme.tplJSONData.CurrentScheme.SelectedItemColor = selectedItemColor dbus.NotifyChange(theme, "SelectedItemColor") }
func (s *Audio) setPropSinkInputs(v []*SinkInput) { for _, o := range s.SinkInputs { dbus.UnInstallObject(o) } for _, o := range v { dbus.InstallOnSession(o) } s.SinkInputs = v dbus.NotifyChange(s, "SinkInputs") }
func (theme *Theme) setPropItemColor(value string) { itemColor := value if len(itemColor) == 0 { // set a default value to avoid empty string itemColor = theme.tplJSONData.DarkScheme.ItemColor } theme.ItemColor = itemColor theme.tplJSONData.CurrentScheme.ItemColor = itemColor dbus.NotifyChange(theme, "ItemColor") }
func (grub *Grub2) setPropEnableTheme(value bool) { grub.EnableTheme = value grub.config.setEnableTheme(value) if value { grub.setSettingTheme(themeMainFile) } else { grub.setSettingTheme("") } dbus.NotifyChange(grub, "EnableTheme") }
func (s *Audio) setPropSources(v []*Source) { for _, o := range s.Sources { dbus.UnInstallObject(o) } for _, o := range v { dbus.InstallOnSession(o) } s.Sources = v dbus.NotifyChange(s, "Sources") }
func (b *Bluetooth) setPropState() { b.State = stateUnavailable if len(b.adapters) > 0 { b.State = stateAvailable } for _, devs := range b.devices { for _, d := range devs { if d.connected { b.State = stateConnected break } } } dbus.NotifyChange(b, "State") }
func (s *ConnectionSession) setPropErrors() { s.Errors = make(sessionErrors) for _, section := range getAvailableSections(s.data) { s.Errors[section] = make(sectionErrors) if isSettingSectionExists(s.data, section) { // check error only section exists errs := generalCheckSettingValues(s.data, section) for k, v := range errs { s.Errors[section][k] = v } } } // clear setting key errors that not available for errSection, _ := range s.settingKeyErrors { if !isStringInArray(errSection, s.AvailableSections) { delete(s.settingKeyErrors, errSection) } else { for errKey, _ := range s.settingKeyErrors[errSection] { if !isStringInArray(errKey, s.AvailableKeys[errSection]) { delete(s.settingKeyErrors[errSection], errKey) } } } } // append errors when setting key for section, sectionErrors := range s.settingKeyErrors { for k, v := range sectionErrors { s.Errors[section][k] = v } } // check if vpn missing plugin switch getCustomConnectionType(s.data) { case connectionVpnL2tp, connectionVpnOpenconnect, connectionVpnPptp, connectionVpnVpnc, connectionVpnOpenvpn: if isKeyAvailable(s.data, vsectionVpn, NM_SETTING_VK_VPN_MISSING_PLUGIN) { if _, ok := s.Errors[vsectionVpn]; ok { s.Errors[vsectionVpn][NM_SETTING_VK_VPN_MISSING_PLUGIN] = fmt.Sprintf(NM_KEY_ERROR_MISSING_DEPENDS_PACKAGE, getSettingVkVpnMissingPlugin(s.data)) } else { logger.Errorf("missing section, errors[%s]", vsectionVpn) } } } dbus.NotifyChange(s, "Errors") }
func (a *Audio) removeSinkInput(idx uint32) { var tryRemoveSinkInput *SinkInput var newSinkInputList []*SinkInput for _, si := range a.SinkInputs { if si.index == idx { tryRemoveSinkInput = si } else { newSinkInputList = append(newSinkInputList, si) } } if tryRemoveSinkInput != nil { dbus.UnInstallObject(tryRemoveSinkInput) a.SinkInputs = newSinkInputList dbus.NotifyChange(a, "SinkInputs") } }
func (p *Power) setPropPlanInfo(v string) { if p.PlanInfo != v { p.PlanInfo = v dbus.NotifyChange(p, "PlanInfo") } }
func (p *Power) setPropBatteryPercentage(v float64) { if p.BatteryPercentage != v { p.BatteryPercentage = v dbus.NotifyChange(p, "BatteryPercentage") } }
func (p *Power) setPropBatteryState(v uint32) { if p.BatteryState != v { p.BatteryState = v dbus.NotifyChange(p, "BatteryState") } }
func (p *Power) setPropOnBattery(v bool) { if p.OnBattery != v { p.OnBattery = v dbus.NotifyChange(p, "OnBattery") } }
func (p *Power) setPropBatteryIsPresent(v bool) { if p.BatteryIsPresent != v { p.BatteryIsPresent = v dbus.NotifyChange(p, "BatteryIsPresent") } }
func (p *Power) setPropBatterySuspendDelay(v int32) { if p.BatterySuspendDelay != v { p.BatterySuspendDelay = v dbus.NotifyChange(p, "BatterySuspendDelay") } }
func (p *Power) setPropLinePowerSuspendDelay(v int32) { if p.LinePowerSuspendDelay != v { p.LinePowerSuspendDelay = v dbus.NotifyChange(p, "LinePowerSuspendDelay") } }
func (p *Power) setPropLidIsPresent(v bool) { if p.LidIsPresent != v { p.LidIsPresent = v dbus.NotifyChange(p, "LidIsPresent") } }
func (m *Mouse) setPropExist(exist bool) { if m.Exist != exist { m.Exist = exist dbus.NotifyChange(m, "Exist") } }
func (m *Mouse) setPropDeviceList(devList []wrapper.XIDeviceInfo) { m.DeviceList = devList dbus.NotifyChange(m, "DeviceList") }
func (m *Manager) setPropState() { m.State = nmGetManagerState() dbus.NotifyChange(m, "State") }
func (m *Manager) setPropActiveConnections() { m.ActiveConnections, _ = marshalJSON(m.activeConnections) dbus.NotifyChange(m, "ActiveConnections") }