summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rhlibrary/main.go9
-rw-r--r--src/rhlibrary/mainwindow.go64
-rw-r--r--src/rhlibrary/player.go2
3 files changed, 72 insertions, 3 deletions
diff --git a/src/rhlibrary/main.go b/src/rhlibrary/main.go
index 85e5b8a..cbc5deb 100644
--- a/src/rhlibrary/main.go
+++ b/src/rhlibrary/main.go
@@ -84,13 +84,20 @@ func main() {
defer db.Cleanup()
player, _ := NewPlayer("/home/equinox/helsinki/rivenhell/contrib/rhlibrary/snd")
+ player.Play(1, 1)
+
+ mw, err := NewMainWindow()
+ if err != nil {
+ rhl.Println("Error initilizing Main Window:", err)
+ return
+ }
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
- player.Play(1, 1)
+ mw.ShowAndRun()
}()
alldone := make(chan bool)
diff --git a/src/rhlibrary/mainwindow.go b/src/rhlibrary/mainwindow.go
new file mode 100644
index 0000000..bfa0ac7
--- /dev/null
+++ b/src/rhlibrary/mainwindow.go
@@ -0,0 +1,64 @@
+//
+// rhlibrary
+//
+// The Radio Helsinki Rivendell Library
+//
+//
+// Copyright (C) 2016 Christian Pointner <equinox@helsinki.at>
+//
+// This file is part of rhlibrary.
+//
+// rhlibrary is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// rhlibrary is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with rhlibrary. If not, see <http://www.gnu.org/licenses/>.
+//
+
+package main
+
+import (
+ "github.com/gotk3/gotk3/gtk"
+)
+
+func init() {
+ gtk.Init(nil)
+}
+
+type MainWindow struct {
+ win *gtk.Window
+}
+
+func (mw *MainWindow) ShowAndRun() {
+ mw.win.ShowAll()
+ gtk.Main()
+}
+
+func NewMainWindow() (mw *MainWindow, err error) {
+ mw = &MainWindow{}
+ // Create a new toplevel window, set its title, and connect it to the
+ // "destroy" signal to exit the GTK main loop when it is destroyed.
+ if mw.win, err = gtk.WindowNew(gtk.WINDOW_TOPLEVEL); err != nil {
+ return
+ }
+ mw.win.SetTitle("rhlibrary")
+ mw.win.Connect("destroy", func() {
+ gtk.MainQuit()
+ })
+
+ var l *gtk.Label
+ if l, err = gtk.LabelNew("Hello, world!"); err != nil {
+ return
+ }
+ mw.win.Add(l)
+
+ mw.win.SetDefaultSize(800, 600)
+ return
+}
diff --git a/src/rhlibrary/player.go b/src/rhlibrary/player.go
index 3e4211c..98b7e35 100644
--- a/src/rhlibrary/player.go
+++ b/src/rhlibrary/player.go
@@ -27,7 +27,6 @@ package main
import (
"fmt"
"github.com/revmischa/gst"
- "github.com/ziutek/glib"
"path"
)
@@ -55,7 +54,6 @@ func (p *Player) Play(cart, cut uint) (err error) {
p.pipe.SetProperty("uri", "file://"+filename)
p.pipe.SetState(gst.STATE_PLAYING)
- glib.NewMainLoop(nil).Run()
return
}