summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rhlibrary/app_window.go4
-rw-r--r--src/rhlibrary/main.go14
-rw-r--r--src/rhlibrary/show_selector_widget.go2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/rhlibrary/app_window.go b/src/rhlibrary/app_window.go
index cf8ef18..2ed4c6a 100644
--- a/src/rhlibrary/app_window.go
+++ b/src/rhlibrary/app_window.go
@@ -25,6 +25,8 @@
package main
import (
+ "fmt"
+
"code.helsinki.at/rhrd-go/player"
"code.helsinki.at/rhrd-go/rddb"
"github.com/gotk3/gotk3/gtk"
@@ -73,7 +75,7 @@ func NewAppWindow(db *rddb.DBChan, player *player.PlayerChan, width, height int)
if aw.win, err = gtk.WindowNew(gtk.WINDOW_TOPLEVEL); err != nil {
return
}
- aw.win.SetTitle("rhlibrary")
+ aw.win.SetTitle(fmt.Sprintf("rhlibrary: logged in as %s", rhuser.Username))
aw.win.Connect("destroy", func() {
gtk.MainQuit()
})
diff --git a/src/rhlibrary/main.go b/src/rhlibrary/main.go
index 8221091..91e5790 100644
--- a/src/rhlibrary/main.go
+++ b/src/rhlibrary/main.go
@@ -30,6 +30,7 @@ import (
"io/ioutil"
"log"
"os"
+ "os/user"
"code.helsinki.at/rhrd-go/player"
"code.helsinki.at/rhrd-go/rddb"
@@ -37,14 +38,20 @@ import (
)
var (
- rhl = log.New(os.Stderr, "[rhlibrary]\t", log.LstdFlags)
- rhdl = log.New(ioutil.Discard, "[rhlibrary-dbg]\t", log.LstdFlags)
+ rhl = log.New(os.Stderr, "[rhlibrary]\t", log.LstdFlags)
+ rhdl = log.New(ioutil.Discard, "[rhlibrary-dbg]\t", log.LstdFlags)
+ rhuser *user.User
)
func init() {
// if _, exists := os.LookupEnv("RHLIBRARY_DEBUG"); exists {
rhdl.SetOutput(os.Stderr)
// }
+
+ var err error
+ if rhuser, err = user.Current(); err != nil {
+ panic(fmt.Sprintf("can't fetch current user: %s", err.Error()))
+ }
}
type envStringValue string
@@ -97,6 +104,9 @@ func main() {
rhl.Println("Error initializing Main Window:", err)
return
}
+
+
+ rhl.Printf("rhlibrary started as user: %s", rhuser.Username)
mw.ShowAndRun()
gtk.Main()
diff --git a/src/rhlibrary/show_selector_widget.go b/src/rhlibrary/show_selector_widget.go
index 1d4b90b..3b9d464 100644
--- a/src/rhlibrary/show_selector_widget.go
+++ b/src/rhlibrary/show_selector_widget.go
@@ -55,7 +55,7 @@ func getShowsSelectorWidget(db *rddb.DBChan, p *player.PlayerChan) (gtk.IWidget,
grid.SetHExpand(true)
grid.SetVExpand(true)
- shows, err := db.GetShowList("equinox") // TODO: get username from system
+ shows, err := db.GetShowList(rhuser.Username)
if err != nil {
rhdl.Println(err) // TODO: feedback at GUI?
return grid, nil