From 22dc99804156c9466dc78f8c507253168b93a8e5 Mon Sep 17 00:00:00 2001 From: Zachary Epps Date: Tue, 24 Jul 2018 15:52:16 -0400 Subject: [PATCH] added some files I've been using for playing around with various gtk widgets and Go --- testing/MastoClient.glade | 289 ++++++++++++++++++++++++++++++++++++++ testing/reveal2.go | 47 +++++++ 2 files changed, 336 insertions(+) create mode 100644 testing/MastoClient.glade create mode 100644 testing/reveal2.go diff --git a/testing/MastoClient.glade b/testing/MastoClient.glade new file mode 100644 index 0000000..80c5880 --- /dev/null +++ b/testing/MastoClient.glade @@ -0,0 +1,289 @@ + + + + + + + True + False + True + + + True + False + + + True + False + Public + True + True + True + VisabilityGroup + + + + + True + False + Unlisted + True + True + VisabilityGroup + + + + + True + False + Followers Only + True + True + VisabilityGroup + + + + + True + False + DM + True + True + VisabilityGroup + + + + + 370 + 275 + False + New Toot + False + 370 + 275 + + + + + + True + False + True + True + + + True + False + 20 + 20 + + + True + False + + + True + False + CW: + + + False + False + 0 + + + + + True + True + 41 + + + True + True + 1 + + + + + + + 0 + 0 + 6 + + + + + CW + True + True + False + True + True + + + 3 + 2 + + + + + Toot + True + True + True + True + + + 5 + 2 + + + + + button + True + True + True + + + 0 + 2 + + + + + True + True + True + VisabilityMenu + False + + + True + False + gtk-missing-image + + + + + 1 + 2 + + + + + True + False + + + 4 + 2 + + + + + button + True + True + True + + + 2 + 2 + + + + + True + False + True + + + True + True + True + 20 + 20 + 20 + 20 + True + True + word + TootComposeBuffer + + + -1 + + + + + True + False + 281 + 33 + 162 + 500 + + + + + + + + 0 + 1 + 6 + + + + + + + -1 + 40 + False + + + + + + True + False + + + Reveal + True + True + True + + + False + True + 0 + + + + + True + False + slide-right + + + True + False + label + + + + + True + True + 1 + + + + + + diff --git a/testing/reveal2.go b/testing/reveal2.go new file mode 100644 index 0000000..9a4d33f --- /dev/null +++ b/testing/reveal2.go @@ -0,0 +1,47 @@ +package main + +import ( + "github.com/gotk3/gotk3/gtk" + "os" + "strconv" +) + +var tootAmt int64 = 500 + +func main() { + gtk.Init(&os.Args) + b, _ := gtk.BuilderNewFromFile("MastoClient.glade") + + obj, _ := b.GetObject("WindowVert") + win := obj.(*gtk.Window) + + obj, _ = b.GetObject("ToggleCW") + btn := obj.(*gtk.Button) + + obj, _ = b.GetObject("CWRevealer") + r := obj.(*gtk.Revealer) + + obj, _ = b.GetObject("TootComposeBuffer") + buf := obj.(*gtk.TextBuffer) + + obj, _ = b.GetObject("TootCharacterCount") + charCnt := obj.(*gtk.Label) + charCnt.SetText(strconv.FormatInt(tootAmt, 10)) + + buf.Connect("changed", func(tbuf *gtk.TextBuffer) { + amt := tbuf.GetCharCount() + charCnt.SetText(strconv.FormatInt(tootAmt - int64(amt), 10)) + }) + + win.Connect("destroy", func() { + gtk.MainQuit() + }) + + btn.Connect("clicked", func() { + r.SetRevealChild(!r.GetChildRevealed()) + }) + + win.ShowAll() + + gtk.Main() +}