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:
parent
b1d38bbdcf
commit
7f80f99529
@ -13,6 +13,10 @@ import (
|
|||||||
crand "crypto/rand"
|
crand "crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
//"reflect"
|
||||||
|
|
||||||
|
// github
|
||||||
|
"github.com/mattn/go-gtk/glib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Eventer struct {
|
type Eventer struct {
|
||||||
@ -44,11 +48,19 @@ func (e *Eventer) LaunchEvent(event string, data map[string]string) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Event " + event + " not found!")
|
return errors.New("Event " + event + " not found!")
|
||||||
}
|
}
|
||||||
fmt.Println("Launching event " + event)
|
|
||||||
|
|
||||||
for _, val := range e.events[event] {
|
fmt.Println("Launching event " + event)
|
||||||
val(data)
|
glib.IdleAdd(func() bool {
|
||||||
}
|
e.reallyLaunchEvent(event, data)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -152,7 +152,7 @@ func (f *FavoriteDialog) initializeWindow() {
|
|||||||
srv_addr_hbox.PackStart(f.server_address, true, true, 5)
|
srv_addr_hbox.PackStart(f.server_address, true, true, 5)
|
||||||
srv_addr_update_btn := gtk.NewButton()
|
srv_addr_update_btn := gtk.NewButton()
|
||||||
srv_addr_update_btn.SetTooltipText("Update server information")
|
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.SetImage(srv_addr_update_btn_image)
|
||||||
srv_addr_update_btn.Clicked(f.updateServerInfo)
|
srv_addr_update_btn.Clicked(f.updateServerInfo)
|
||||||
srv_addr_hbox.PackStart(srv_addr_update_btn, false, true, 5)
|
srv_addr_hbox.PackStart(srv_addr_update_btn, false, true, 5)
|
||||||
|
@ -153,7 +153,7 @@ func (m *MainWindow) Initialize() {
|
|||||||
m.launch_button = gtk.NewButtonWithLabel("Launch!")
|
m.launch_button = gtk.NewButtonWithLabel("Launch!")
|
||||||
m.launch_button.SetTooltipText("Launch Urban Terror")
|
m.launch_button.SetTooltipText("Launch Urban Terror")
|
||||||
m.launch_button.Clicked(m.launchGame)
|
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)
|
m.launch_button.SetImage(launch_button_image)
|
||||||
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)
|
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user