本文整理汇总了Golang中pkg/linuxdeepin/com/lib/dbus.InstallOnSession函数的典型用法代码示例。如果您正苦于以下问题:Golang InstallOnSession函数的具体用法?Golang InstallOnSession怎么用?Golang InstallOnSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InstallOnSession函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: mustGetEntry
func (m *EntryManager) mustGetEntry(nApp *NormalApp, rApp *RuntimeApp) *AppEntry {
if rApp != nil {
if e, ok := m.appEntries[rApp.Id]; ok {
return e
} else {
e := NewAppEntryWithRuntimeApp(rApp)
m.appEntries[rApp.Id] = e
err := dbus.InstallOnSession(e)
if err != nil {
logger.Warning(err)
}
return e
}
} else if nApp != nil {
if e, ok := m.appEntries[nApp.Id]; ok {
return e
} else {
e := NewAppEntryWithNormalApp(nApp)
m.appEntries[nApp.Id] = e
err := dbus.InstallOnSession(e)
if err != nil {
logger.Warning(err)
}
return e
}
}
panic("mustGetEntry: at least give one app")
}
示例2: Start
func Start() {
if _m != nil {
return
}
var logger = log.NewLogger("com.deepin.daemon.InputDevices")
logger.BeginTracing()
if !initDeviceChangedWatcher() {
logger.Error("Init device changed wacher failed")
logger.EndTracing()
return
}
_m := NewManager(logger)
err := dbus.InstallOnSession(_m)
if err != nil {
logger.Error("Install Manager DBus Failed:", err)
finalize()
return
}
err = dbus.InstallOnSession(_m.mouse)
if err != nil {
logger.Error("Install Mouse DBus Failed:", err)
finalize()
return
}
err = dbus.InstallOnSession(_m.touchpad)
if err != nil {
logger.Error("Install Touchpad DBus Failed:", err)
finalize()
return
}
err = dbus.InstallOnSession(_m.kbd)
if err != nil {
logger.Error("Install Keyboard DBus Failed:", err)
finalize()
return
}
err = dbus.InstallOnSession(_m.wacom)
if err != nil {
logger.Error("Install Wacom DBus Failed:", err)
finalize()
return
}
}
示例3: Start
func Start() {
if _manager != nil {
return
}
logger.BeginTracing()
var err error
_manager, err = NewManager()
if err != nil {
logger.Error("Create Manager failed:", err)
logger.EndTracing()
return
}
err = dbus.InstallOnSession(_manager)
if err != nil {
logger.Error("Install DBus failed:", err)
_manager.destroy()
_manager = nil
logger.EndTracing()
return
}
_manager.handlePropChanged()
}
示例4: initTrayManager
func initTrayManager() {
composite.Init(TrayXU.Conn())
composite.QueryVersion(TrayXU.Conn(), 0, 4)
damage.Init(TrayXU.Conn())
damage.QueryVersion(TrayXU.Conn(), 1, 1)
xfixes.Init(TrayXU.Conn())
xfixes.QueryVersion(TrayXU.Conn(), 5, 0)
visualId := findRGBAVisualID()
TRAYMANAGER = &TrayManager{
owner: 0,
visual: visualId,
nameInfo: make(map[xproto.Window]string),
notifyInfo: make(map[xproto.Window]bool),
md5Info: make(map[xproto.Window][]byte),
dmageInfo: make(map[xproto.Window]damage.Damage),
}
TRAYMANAGER.Manage()
dbus.InstallOnSession(TRAYMANAGER)
xfixes.SelectSelectionInput(
TrayXU.Conn(),
TrayXU.RootWin(),
_NET_SYSTEM_TRAY_S0,
xfixes.SelectionEventMaskSelectionClientClose,
)
go TRAYMANAGER.startListener()
}
示例5: main
func main() {
if !lib.UniqueOnSession(DBUS_DEST) {
logger.Warning("There is an Search running")
return
}
logger.BeginTracing()
defer logger.EndTracing()
logger.SetRestartCommand("/usr/lib/deepin-daemon/search")
if err := dbus.InstallOnSession(GetManager()); err != nil {
logger.Fatal("Search Install DBus Failed:", err)
return
}
dbus.DealWithUnhandledMessage()
dbus.SetAutoDestroyHandler(time.Second*5, func() bool {
if GetManager().writeStart {
select {
case <-GetManager().writeEnd:
return true
}
}
return true
})
if err := dbus.Wait(); err != nil {
logger.Warning("Search lost dbus:", err)
os.Exit(-1)
} else {
os.Exit(0)
}
}
示例6: rebuildThemes
func (m *Manager) rebuildThemes() {
m.lock.Lock()
defer m.lock.Unlock()
m.destroyThemes()
var curThemeValid bool
for _, name := range m.ThemeList {
info, err := m.dtheme.GetInfoByName(path.Base(name))
if err != nil {
continue
}
t := NewTheme(info, m.applyTheme)
err = dbus.InstallOnSession(t)
if err != nil {
logger.Warning("Install dbus failed:", info, err)
continue
}
m.themeObjMap[info.BaseName] = t
if info.BaseName == m.CurrentTheme.Get() {
curThemeValid = true
m.applyTheme(info.BaseName)
}
}
if !curThemeValid {
m.applyTheme(defaultDThemeId)
}
}
示例7: addSinkInput
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")
}
示例8: Start
func Start() {
if power != nil {
return
}
logger.BeginTracing()
err := initializeLibs()
if err != nil {
logger.Error(err)
logger.EndTracing()
return
}
err = dbus.InstallOnSession(power)
if err != nil {
logger.Error("Failed InstallOnSession:", err)
finalizeLibs()
logger.EndTracing()
return
}
workaround = newFullScreenWorkaround()
go workaround.start()
}
示例9: registerEntry
func (m *EntryProxyerManager) registerEntry(name string) {
if !isEntryNameValid(name) {
return
}
logger.Debugf("register entry: %s", name)
entryId, ok := getEntryId(name)
if !ok {
return
}
logger.Debugf("register entry id: %s", entryId)
entry, err := NewEntryProxyer(entryId)
if err != nil {
logger.Warningf("register entry failed: %v", err)
return
}
err = dbus.InstallOnSession(entry)
if err != nil {
logger.Warningf("register entry failed: %v", err)
return
}
m.Entries = append(m.Entries, entry)
dbus.Emit(m, "Added", dbus.ObjectPath(entry.GetDBusInfo().ObjectPath))
logger.Infof("register entry success: %s", name)
}
示例10: Start
func Start() {
logger.BeginTracing()
grub = NewGrub2()
err := dbus.InstallOnSession(grub)
if err != nil {
logger.Errorf("register dbus interface failed: %v", err)
return
}
err = dbus.InstallOnSession(grub.theme)
if err != nil {
logger.Errorf("register dbus interface failed: %v", err)
return
}
// initialize grub2 after dbus service installed to ensure
// property changing signal send successful
grub.initGrub2()
}
示例11: setPropSinkInputs
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")
}
示例12: setPropSources
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")
}
示例13: startMediaMount
func startMediaMount() error {
_media = NewMediaMount()
if _media == nil {
return fmt.Errorf("Create MediaMount Failed")
}
err := dbus.InstallOnSession(_media)
if err != nil {
return err
}
return nil
}
示例14: addConnectionSession
func (m *Manager) addConnectionSession(session *ConnectionSession) {
m.connectionSessionsLock.Lock()
defer m.connectionSessionsLock.Unlock()
// install dbus session
err := dbus.InstallOnSession(session)
if err != nil {
logger.Error(err)
return
}
m.connectionSessions = append(m.connectionSessions, session)
}
示例15: startDefaultApps
func startDefaultApps() error {
_dapp = NewDefaultApps()
if _dapp == nil {
return fmt.Errorf("Create DefaultApps Failed")
}
err := dbus.InstallOnSession(_dapp)
if err != nil {
return err
}
return nil
}