当前位置: 首页>>代码示例>>Golang>>正文


Golang InfoBar.ShowAll方法代码示例

本文整理汇总了Golang中github.com/gotk3/gotk3/gtk.InfoBar.ShowAll方法的典型用法代码示例。如果您正苦于以下问题:Golang InfoBar.ShowAll方法的具体用法?Golang InfoBar.ShowAll怎么用?Golang InfoBar.ShowAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/gotk3/gotk3/gtk.InfoBar的用法示例。


在下文中一共展示了InfoBar.ShowAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: setCurrentNotification

func (account *account) setCurrentNotification(ib *gtk.InfoBar, notificationArea *gtk.Box) {
	account.Lock()
	defer account.Unlock()

	account.removeCurrentNotification()
	account.currentNotification = ib
	notificationArea.Add(ib)
	ib.ShowAll()
}
开发者ID:tanujmathur,项目名称:coyim,代码行数:9,代码来源:account.go

示例2: presenceSubscriptionDialog

func presenceSubscriptionDialog(accounts []*account, sendSubscription func(accountID, peer string) error) *gtk.Dialog {
	builder := builderForDefinition("AddContact")

	//TODO: move model to XML builder
	model, _ := gtk.ListStoreNew(
		glib.TYPE_STRING, // account name
		glib.TYPE_STRING, // account_id
	)

	for _, acc := range accounts {
		model.Set(model.Append(), []int{0, 1}, []interface{}{acc.session.GetConfig().Account, acc.session.GetConfig().ID()})
	}

	accountsObj, _ := builder.GetObject("accounts")
	accountInput := accountsObj.(*gtk.ComboBox)
	accountInput.SetModel(&model.TreeModel)

	accountObj, _ := builder.GetObject("address")
	contactInput := accountObj.(*gtk.Entry)

	if len(accounts) > 0 {
		accountInput.SetActive(0)
	}

	renderer, _ := gtk.CellRendererTextNew()
	accountInput.PackStart(renderer, true)
	accountInput.AddAttribute(renderer, "text", 0)

	dialogObj, _ := builder.GetObject("AddContact")
	dialog := dialogObj.(*gtk.Dialog)

	obj, _ := builder.GetObject("notification-area")
	notificationArea := obj.(*gtk.Box)

	failures := 0
	var notification *gtk.InfoBar

	builder.ConnectSignals(map[string]interface{}{
		"on_save_signal": func() {
			contact, _ := contactInput.GetText()
			isJid, errmsg := verifyXmppAddress(contact)

			if !isJid && failures > 0 {
				notificationArea.Remove(notification)
				notification = buildBadUsernameNotification(errmsg)
				notificationArea.Add(notification)
				notification.ShowAll()
				failures++
				log.Printf(errmsg)
				return
			}

			if !isJid {
				notification = buildBadUsernameNotification(errmsg)
				notificationArea.Add(notification)
				notification.ShowAll()
				failures++
				log.Printf(errmsg)
				return
			}

			iter, err := accountInput.GetActiveIter()
			if err != nil {
				log.Printf("Error encountered when getting account: %v", err)
				return
			}
			val, err := model.GetValue(iter, 1)
			if err != nil {
				log.Printf("Error encountered when getting account: %v", err)
				return
			}
			accountID, err := val.GetString()
			if err != nil {
				log.Printf("Error encountered when getting account: %v", err)
				return
			}

			err = sendSubscription(accountID, contact)
			if err != nil {
				log.Printf("Error encountered when sending subscription: %v", err)
				return
			}

			dialog.Destroy()
		},
	})

	return dialog
}
开发者ID:PMaynard,项目名称:coyim,代码行数:89,代码来源:subscription.go


注:本文中的github.com/gotk3/gotk3/gtk.InfoBar.ShowAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。