GTK actions fix WIP and icon size fix.

Again, possibly fixed GTK actions calls from other goroutines
by wrapping events calls in glib.IdleAdd(). This should prevent
executing more than one event simultaneously, which will also
prevent crashes.

Fixed icons sizing for couple of icons.
This commit is contained in:
pztrn committed 2016-11-04 18:28:52 +05:00
1 parent b1d38bbdcf
commit 7f80f99529
3 files changed
+18 -6

No files matched your search

+16 -4
View File
@@ -13,6 +13,10 @@ import (
crand "crypto/rand"
"errors"
"fmt"
//"reflect"
// github
"github.com/mattn/go-gtk/glib"
)
type Eventer struct {
@@ -44,11 +48,19 @@ func (e *Eventer) LaunchEvent(event string, data map[string]string) error {
if !ok {
return errors.New("Event " + event + " not found!")
}
fmt.Println("Launching event " + event)
for _, val := range e.events[event] {
val(data)
}
fmt.Println("Launching event " + event)
glib.IdleAdd(func() bool {
e.reallyLaunchEvent(event, data)
return false
})
return nil
}
func (e *Eventer) reallyLaunchEvent(event string, data map[string]string) {
fmt.Println("Really launching event " + event + "...")
for _, val := range e.events[event] {
val(data)
}
}
+1 -1
View File
@@ -152,7 +152,7 @@ func (f *FavoriteDialog) initializeWindow() {
srv_addr_hbox.PackStart(f.server_address, true, true, 5)
srv_addr_update_btn := gtk.NewButton()
srv_addr_update_btn.SetTooltipText("Update server information")
srv_addr_update_btn_image := gtk.NewImageFromStock(gtk.STOCK_REDO, 24)
srv_addr_update_btn_image := gtk.NewImageFromStock(gtk.STOCK_REDO, gtk.ICON_SIZE_SMALL_TOOLBAR)
srv_addr_update_btn.SetImage(srv_addr_update_btn_image)
srv_addr_update_btn.Clicked(f.updateServerInfo)
srv_addr_hbox.PackStart(srv_addr_update_btn, false, true, 5)
+1 -1
View File
@@ -153,7 +153,7 @@ func (m *MainWindow) Initialize() {
m.launch_button = gtk.NewButtonWithLabel("Launch!")
m.launch_button.SetTooltipText("Launch Urban Terror")
m.launch_button.Clicked(m.launchGame)
launch_button_image := gtk.NewImageFromStock(gtk.STOCK_APPLY, 24)
launch_button_image := gtk.NewImageFromStock(gtk.STOCK_APPLY, gtk.ICON_SIZE_SMALL_TOOLBAR)
m.launch_button.SetImage(launch_button_image)
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)