Exemplo n.º 1
0
func (userInterface *GtkUserInterface) showBasicMessageDialog(messageType gtk.MessageType, message string) {
	runOnUIThreadAndWait(func() interface{} {
		dialog := gtk.MessageDialogNew(userInterface.getVisibleWindow(), gtk.DIALOG_MODAL, messageType, gtk.BUTTONS_OK, message)
		defer dialog.Destroy()

		dialog.SetTitle(userInterface.launcher.GetTitle())
		dialog.Run()

		return nil
	})
}
Exemplo n.º 2
0
func (userInterface *GtkUserInterface) showYesNoDialog(messageType gtk.MessageType, message string) bool {
	result := runOnUIThreadAndWait(func() interface{} {
		dialog := gtk.MessageDialogNew(userInterface.getVisibleWindow(), gtk.DIALOG_MODAL, messageType, gtk.BUTTONS_YES_NO, message)
		defer dialog.Destroy()

		dialog.SetTitle(userInterface.launcher.GetTitle())

		var dialogResult int

		for {
			dialogResult = dialog.Run()

			if dialogResult == int(gtk.RESPONSE_YES) || dialogResult == int(gtk.RESPONSE_NO) {
				break
			}
		}
		return dialogResult == int(gtk.RESPONSE_YES)
	})

	return result.(bool)
}