示例#1
0
文件: menubar.go 项目: hsk81/btcgui
func createFileMenu() *gtk.MenuItem {
	menu, err := gtk.MenuItemNewWithMnemonic("_File")
	if err != nil {
		log.Fatal(err)
	}

	dropdown, err := gtk.MenuNew()
	if err != nil {
		log.Fatal(err)
	}

	menu.SetSubmenu(dropdown)

	mitem, err := gtk.MenuItemNewWithMnemonic("E_xit")
	if err != nil {
		log.Fatal(err)
	}
	mitem.Connect("activate", func() {
		gtk.MainQuit()
	})

	dropdown.Append(mitem)

	return menu
}
示例#2
0
文件: menubar.go 项目: hsk81/btcgui
func createHelpMenu() *gtk.MenuItem {
	menu, err := gtk.MenuItemNewWithMnemonic("_Help")
	if err != nil {
		log.Fatal(err)
	}
	dropdown, err := gtk.MenuNew()
	if err != nil {
		log.Fatal(err)
	}
	menu.SetSubmenu(dropdown)

	mitem, err := gtk.MenuItemNewWithLabel("Tutorial...")
	if err != nil {
		log.Fatal(err)
	}
	mitem.Connect("activate", func() {
		w, err := CreateTutorialDialog(mainWindow)
		if err != nil {
			// TODO(jrick): Log error to file.
			log.Fatal(err)
		}
		w.ShowAll()
	})
	dropdown.Append(mitem)

	return menu
}
示例#3
0
文件: menubar.go 项目: hsk81/btcgui
func createSettingsMenu() *gtk.MenuItem {
	menu, err := gtk.MenuItemNewWithMnemonic("_Settings")
	if err != nil {
		log.Fatal(err)
	}
	dropdown, err := gtk.MenuNew()
	if err != nil {
		log.Fatal(err)
	}
	menu.SetSubmenu(dropdown)

	// TODO(jrick): Dialog will be shown on first start and cannot be
	// cancled out of anymore, so disable this until multi-account
	// support is added.
	/*
		mitem, err := gtk.MenuItemNewWithLabel("New Wallet...")
		if err != nil {
			log.Fatal(err)
		}
		mitem.Connect("activate", func() {
			if dialog, err := createNewWalletDialog(); err != nil {
				log.Print(err)
			} else {
				dialog.Run()
			}
		})
		dropdown.Append(mitem)
		mitem.SetSensitive(false)
		MenuBar.Settings.New = mitem
	*/

	// TODO(jrick): Wallet is already encrypted, but we can possibly use
	// this code for a second level of encryption later that will encrypt
	// everything, not just private keys.
	/*
		mitem, err := gtk.MenuItemNewWithLabel("Encrypt Wallet...")
		if err != nil {
			log.Fatal(err)
		}
		mitem.Connect("activate", func() {
			if dialog, err := createEncryptionDialog(); err != nil {
				log.Print(err)
			} else {
				dialog.Run()
			}
		})
		dropdown.Append(mitem)
		mitem.SetSensitive(false)
		MenuBar.Settings.Encrypt = mitem
	*/

	mitem, err := gtk.MenuItemNewWithLabel("Lock wallet")
	if err != nil {
		log.Fatal(err)
	}
	mitem.Connect("activate", func() {
		go func() {
			triggers.lockWallet <- 1
		}()
	})
	dropdown.Append(mitem)
	mitem.SetSensitive(false)
	MenuBar.Settings.Lock = mitem

	mitem, err = gtk.MenuItemNewWithLabel("Unlock Wallet...")
	if err != nil {
		log.Fatal(err)
	}
	mitem.Connect("activate", func() {
		if dialog, err := createUnlockDialog(unlockManual, nil); err != nil {
			log.Print(err)
		} else {
			dialog.Run()
		}
	})
	dropdown.Append(mitem)
	mitem.SetSensitive(false)
	MenuBar.Settings.Unlock = mitem

	sep, err := gtk.SeparatorMenuItemNew()
	if err != nil {
		log.Fatal(err)
	}
	dropdown.Append(sep)

	mitem, err = gtk.MenuItemNewWithLabel("Set Transaction Fee...")
	if err != nil {
		log.Fatal(err)
	}
	mitem.Connect("activate", func() {
		if dialog, err := createTxFeeDialog(); err != nil {
			log.Print(err)
		} else {
			dialog.Run()
		}
	})
	dropdown.Append(mitem)
	//mitem.SetSensitive(false)
	MenuBar.Settings.TxFee = mitem

	return menu
}