当前位置: 首页>>代码示例>>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;未经允许,请勿转载。