func NewKeyboard(l *log.Logger) *Keyboard { kbd := &Keyboard{} kbd.settings = gio.NewSettings("com.deepin.dde.keyboard") kbd.CurrentLayout = property.NewGSettingsStringProperty( kbd, "CurrentLayout", kbd.settings, kbdKeyLayout) kbd.RepeatEnabled = property.NewGSettingsBoolProperty( kbd, "RepeatEnabled", kbd.settings, kbdKeyRepeatEnable) kbd.RepeatInterval = property.NewGSettingsUintProperty( kbd, "RepeatInterval", kbd.settings, kbdKeyRepeatInterval) kbd.RepeatDelay = property.NewGSettingsUintProperty( kbd, "RepeatDelay", kbd.settings, kbdKeyRepeatDelay) kbd.CursorBlink = property.NewGSettingsIntProperty( kbd, "CursorBlink", kbd.settings, kbdKeyCursorBlink) kbd.CapslockToggle = property.NewGSettingsBoolProperty( kbd, "CapslockToggle", kbd.settings, kbdKeyCapslockToggle) kbd.UserLayoutList = property.NewGSettingsStrvProperty( kbd, "UserLayoutList", kbd.settings, kbdKeyUserLayoutList) kbd.UserOptionList = property.NewGSettingsStrvProperty( kbd, "UserOptionList", kbd.settings, kbdKeyLayoutOptions) kbd.logger = l var err error kbd.layoutDescMap, err = getLayoutListByFile(kbdKeyLayoutXml) if err != nil { //TODO: handle error kbd.errorInfo("Get Layout Desc List Failed: %v", err) return nil } kbd.greeter, err = greeterutils.NewGreeterUtils( "com.deepin.api.GreeterUtils", "/com/deepin/api/GreeterUtils") if err != nil { kbd.warningInfo("Create GreeterUtils Failed: %v", err) kbd.greeter = nil } kbd.xsettings, err = sessionmanager.NewXSettings( "com.deepin.SessionManager", "/com/deepin/XSettings", ) if err != nil { kbd.warningInfo("Create XSettings Failed: %v", err) kbd.xsettings = nil } kbd.handleGSettings() kbd.init() return kbd }
func NewWacom(l *log.Logger) *Wacom { w := &Wacom{} w.settings = gio.NewSettings("com.deepin.dde.wacom") w.LeftHanded = property.NewGSettingsBoolProperty( w, "LeftHanded", w.settings, wacomKeyLeftHanded) w.CursorMode = property.NewGSettingsBoolProperty( w, "CursorMode", w.settings, wacomKeyCursorMode) w.KeyUpAction = property.NewGSettingsStringProperty( w, "KeyUpAction", w.settings, wacomKeyUpAction) w.KeyDownAction = property.NewGSettingsStringProperty( w, "KeyDownAction", w.settings, wacomKeyDownAction) w.DoubleDelta = property.NewGSettingsUintProperty( w, "DoubleDelta", w.settings, wacomKeyDoubleDelta) w.PressureSensitive = property.NewGSettingsUintProperty( w, "PressureSensitive", w.settings, wacomKeyPressureSensitive) _, _, wacomList := wrapper.GetDevicesList() w.setPropDeviceList(wacomList) if len(w.DeviceList) > 0 { w.setPropExist(true) } else { w.setPropExist(false) } w.logger = l w.ActionInfos = generateActionInfos() _wacom = w w.init() w.handleGSettings() return w }
func NewManager() *Manager { m := &Manager{} m.dtheme = NewFactory(ObjectTypeDeepinTheme, m.handleDThemeChanged) m.gtk = NewFactory(ObjectTypeGtk, m.setPropGtkThemeList) m.icon = NewFactory(ObjectTypeIcon, m.setPropIconThemeList) m.cursor = NewFactory(ObjectTypeCursor, m.setPropSoundThemeList) m.sound = NewFactory(ObjectTypeSound, m.setPropSoundThemeList) m.greeter = NewFactory(ObjectTypeGreeter, m.setPropGreeterThemeList) m.bg = NewFactory(ObjectTypeBackground, m.setPropBackgroundList) m.font = fonts.NewFontManager() m.setPropThemeList(getThemeObjectList(m.dtheme.GetNameStrList())) m.setPropGtkThemeList(m.gtk.GetNameStrList()) m.setPropIconThemeList(m.icon.GetNameStrList()) m.setPropCursorThemeList(m.cursor.GetNameStrList()) m.setPropSoundThemeList(m.sound.GetNameStrList()) m.setPropGreeterThemeList(m.greeter.GetNameStrList()) m.setPropBackgroundList(m.bg.GetNameStrList()) m.settings = NewGSettings("com.deepin.dde.personalization") m.CurrentTheme = property.NewGSettingsStringProperty( m, "CurrentTheme", m.settings, deepinGSKeyTheme) m.GreeterTheme = property.NewGSettingsStringProperty( m, "GreeterTheme", m.settings, deepinGSKeyGreeter) m.wrapSetting = NewGSettings("com.deepin.wrap.gnome.desktop.background") m.gnomeSettings = CheckAndNewGSettings("org.gnome.desktop.background") m.themeObjMap = make(map[string]*Theme) m.listenGSettings() m.rebuildThemes() return m }