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


Golang dbus.Emit函數代碼示例

本文整理匯總了Golang中pkg/linuxdeepin/com/lib/dbus.Emit函數的典型用法代碼示例。如果您正苦於以下問題:Golang Emit函數的具體用法?Golang Emit怎麽用?Golang Emit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Emit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: newAccessPoint

func (m *Manager) newAccessPoint(devPath, apPath dbus.ObjectPath) (ap *accessPoint, err error) {
	nmAp, err := nmNewAccessPoint(apPath)
	if err != nil {
		return
	}
	ap = &accessPoint{
		nmAp:    nmAp,
		devPath: devPath,
		Path:    apPath,
	}
	ap.updateProps()
	if len(ap.Ssid) == 0 {
		err = fmt.Errorf("ignore hidden access point")
		return
	}

	// connect properties changed signals
	ap.nmAp.ConnectPropertiesChanged(func(properties map[string]dbus.Variant) {
		if !m.isAccessPointExists(apPath) {
			return
		}

		m.accessPointsLock.Lock()
		defer m.accessPointsLock.Unlock()
		ap.updateProps()
		apJSON, _ := marshalJSON(ap)
		dbus.Emit(m, "AccessPointPropertiesChanged", string(devPath), apJSON)
	})

	apJSON, _ := marshalJSON(ap)
	dbus.Emit(m, "AccessPointAdded", string(devPath), apJSON)

	return
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:34,代碼來源:manager_ap.go

示例2: grabKeyboardAndMouse

func grabKeyboardAndMouse(m *Manager) {
	if m == nil {
		return
	}

	//go func() {
	X, err := xgbutil.NewConn()
	if err != nil {
		logger.Info("Get New Connection Failed:", err)
		return
	}
	keybind.Initialize(X)
	mousebind.Initialize(X)

	err = keybind.GrabKeyboard(X, X.RootWin())
	if err != nil {
		logger.Info("Grab Keyboard Failed:", err)
		return
	}

	grabAllMouseButton(X)

	xevent.ButtonPressFun(
		func(X *xgbutil.XUtil, e xevent.ButtonPressEvent) {
			dbus.Emit(m, "KeyReleaseEvent", "")
			ungrabAllMouseButton(X)
			keybind.UngrabKeyboard(X)
			logger.Info("Button Press Event")
			xevent.Quit(X)
		}).Connect(X, X.RootWin())

	xevent.KeyPressFun(
		func(X *xgbutil.XUtil, e xevent.KeyPressEvent) {
			value := parseKeyEnvent(X, e.State, e.Detail)
			pressKeyStr = value
			dbus.Emit(m, "KeyPressEvent", value)
		}).Connect(X, X.RootWin())

	xevent.KeyReleaseFun(
		func(X *xgbutil.XUtil, e xevent.KeyReleaseEvent) {
			if strings.ToLower(pressKeyStr) == "super_l" ||
				strings.ToLower(pressKeyStr) == "super_r" {
				pressKeyStr = "Super"
			}

			dbus.Emit(m, "KeyReleaseEvent", pressKeyStr)
			pressKeyStr = ""
			ungrabAllMouseButton(X)
			keybind.UngrabKeyboard(X)
			logger.Infof("Key: %s\n", pressKeyStr)
			xevent.Quit(X)
		}).Connect(X, X.RootWin())

	xevent.Main(X)
	//}()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:56,代碼來源:grab.go

示例3: RequestUninstall

func (self *Launcher) RequestUninstall(id string, purge bool) {
	go func(id ItemId) {
		logger.Warning("uninstall", id)
		err := self.itemManager.UninstallItem(id, purge, time.Minute*20)
		if err == nil {
			dbus.Emit(self, "UninstallSuccess", id)
			return
		}

		dbus.Emit(self, "UninstallFailed", id, err.Error())
	}(ItemId(id))
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:12,代碼來源:launcher.go

示例4: RequestRemoveFromDesktop

func (self *Launcher) RequestRemoveFromDesktop(id string) bool {
	itemId := ItemId(id)
	if filepath.IsAbs(id) {
		dbus.Emit(self, "RemoveFromDesktopFailed", itemId, "app id is expected")
		return false
	}

	if err := self.itemManager.RemoveItemFromDesktop(itemId); err != nil {
		dbus.Emit(self, "RemoveFromDesktopFailed", itemId, err.Error())
		return false
	}

	dbus.Emit(self, "RemoveFromDesktopSuccess", itemId)
	return true
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:15,代碼來源:launcher.go

示例5: Dock

func (m *DockedAppManager) Dock(id, title, icon, cmd string) bool {
	idElement := m.findItem(id)
	if idElement != nil {
		logger.Info(id, "is already docked.")
		return false
	}

	id = strings.ToLower(id)
	idElement = m.findItem(id)
	if idElement != nil {
		logger.Info(id, "is already docked.")
		return false
	}

	logger.Debug("id", id, "title", title, "cmd", cmd)
	desktopID := guess_desktop_id(id)
	if desktopID == "" {
		m.items.PushBack(id)
		if e := createScratchFile(id, title, icon, cmd); e != nil {
			logger.Warning("create scratch file failed:", e)
			return false
		}
	} else {
		id = trimDesktop(desktopID)
		m.items.PushBack(id)
	}
	dbus.Emit(m, "Docked", id)
	app := ENTRY_MANAGER.runtimeApps[id]
	if app != nil {
		app.buildMenu()
	}
	return true
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:33,代碼來源:docked_app_manager.go

示例6: listenGSettings

func (media *MediaMount) listenGSettings() {
	media.settings.Connect("changed::autorun-x-content-ignore",
		func(s *gio.Settings, key string) {
			dbus.Emit(media, "MediaActionChanged")
		})

	media.settings.Connect("changed::autorun-x-content-open-folder",
		func(s *gio.Settings, key string) {
			dbus.Emit(media, "MediaActionChanged")
		})

	media.settings.Connect("changed::autorun-x-content-start-app",
		func(s *gio.Settings, key string) {
			dbus.Emit(media, "MediaActionChanged")
		})
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:16,代碼來源:default_media.go

示例7: addTrayIcon

func (m *TrayManager) addTrayIcon(xid xproto.Window) {
	m.checkValid()
	for _, id := range m.TrayIcons {
		if xproto.Window(id) == xid {
			return
		}
	}

	if d, err := damage.NewDamageId(TrayXU.Conn()); err != nil {
		return
	} else {
		m.dmageInfo[xid] = d
		if err := damage.CreateChecked(TrayXU.Conn(), d, xproto.Drawable(xid), damage.ReportLevelRawRectangles).Check(); err != nil {
			logger.Debug("DamageCreate Failed:", err)
			return
		}
	}
	composite.RedirectWindow(TrayXU.Conn(), xid, composite.RedirectAutomatic)

	m.TrayIcons = append(m.TrayIcons, uint32(xid))
	icon := xwindow.New(TrayXU, xid)
	icon.Listen(xproto.EventMaskVisibilityChange | damage.Notify | xproto.EventMaskStructureNotify)
	icon.Change(xproto.CwBackPixel, 0)

	name, err := ewmh.WmNameGet(TrayXU, xid)
	if err != nil {
		logger.Debug("WmNameGet failed:", err, xid)
	}
	m.nameInfo[xid] = name
	m.notifyInfo[xid] = true
	dbus.Emit(m, "Added", uint32(xid))
	logger.Infof("Added try icon: \"%s\"(%d)", name, uint32(xid))
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:33,代碼來源:traymanager.go

示例8: triggerSigErr

func triggerSigErr(pid uint32, action, reason string) {
	if _m == nil {
		return
	}

	dbus.Emit(_m, "Error", pid, action, reason)
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:7,代碼來源:accounts.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: RetryManager

func (m *TrayManager) RetryManager() {
	m.Unmanage()
	m.Manage()

	for _, icon := range m.TrayIcons {
		dbus.Emit(m, "Added", icon)
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:8,代碼來源:traymanager.go

示例11: handleTrayDamage

func (m *TrayManager) handleTrayDamage(xid xproto.Window) {
	if m.notifyInfo[xid] {
		if md5 := icon2md5(xid); !md5Equal(m.md5Info[xid], md5) {
			m.md5Info[xid] = md5
			dbus.Emit(m, "Changed", uint32(xid))
			logger.Debugf("handleTrayDamage: %s(%d) changed (%v)", m.nameInfo[xid], xid, md5)
		}
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:9,代碼來源:traymanager.go

示例12: createPendingKey

func (a *agent) createPendingKey(connectionData map[string]map[string]dbus.Variant, keyId mapKey) chan string {
	autoConnect := nmGeneralGetConnectionAutoconnect(keyId.path)
	connectionId := getSettingConnectionId(connectionData)
	logger.Debug("createPendingKey:", keyId, connectionId, autoConnect)

	a.pendingKeys[keyId] = make(chan string)
	dbus.Emit(manager, "NeedSecrets", string(keyId.path), keyId.name, connectionId, autoConnect)
	return a.pendingKeys[keyId]
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:9,代碼來源:agent.go

示例13: MarkLaunched

func (self *Launcher) MarkLaunched(id string) {
	err := self.itemManager.MarkLaunched(ItemId(id))
	if err != nil {
		logger.Info(err)
		return
	}

	dbus.Emit(self, "NewAppLaunched", ItemId(id))
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:9,代碼來源:launcher.go

示例14: setDeviceEnabled

func (c *config) setDeviceEnabled(devPath dbus.ObjectPath, enabled bool) {
	devConfig, err := c.getDeviceConfigForPath(devPath)
	if err != nil {
		return
	}
	devConfig.Enabled = enabled
	dbus.Emit(manager, "DeviceEnabled", string(devPath), enabled)
	c.save()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:9,代碼來源:manager_config.go

示例15: handleUserDeleted

func (m *Manager) handleUserDeleted(list []string) {
	var paths = m.UserList
	for _, p := range list {
		m.uninstallUser(p)
		paths = deleteStrFromList(p, paths)
		dbus.Emit(m, "UserDeleted", p)
	}

	m.setPropUserList(paths)
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:10,代碼來源:handle_event.go


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