當前位置: 首頁>>代碼示例>>Golang>>正文


Golang dbus.InstallOnSession函數代碼示例

本文整理匯總了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")
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:28,代碼來源:entry_manager.go

示例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
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:50,代碼來源:main.go

示例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()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:25,代碼來源:timedate.go

示例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()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:30,代碼來源:traymanager.go

示例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)
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:34,代碼來源:main.go

示例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)
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:29,代碼來源:manager.go

示例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")
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:26,代碼來源:audio_stub.go

示例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()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:25,代碼來源:init.go

示例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)
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:26,代碼來源:manager.go

示例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()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:19,代碼來源:module.go

示例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")
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:10,代碼來源:audio_stub.go

示例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")
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:10,代碼來源:audio_stub.go

示例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
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:12,代碼來源:main.go

示例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)
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:12,代碼來源:manager_connection.go

示例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
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:13,代碼來源:main.go


注:本文中的pkg/linuxdeepin/com/lib/dbus.InstallOnSession函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。