More Mac integration works - now it is able to load and use GTK+
themes. Configuration interface on ToDo. This also indicates that URTrator is now able to perform basic window theming.
This commit is contained in:
@@ -29,6 +29,8 @@ type MainWindow struct {
|
||||
// Gamemodes.
|
||||
gamemodes map[string]string
|
||||
|
||||
text string
|
||||
|
||||
// Widgets.
|
||||
// The window itself.
|
||||
window *gtk.Window
|
||||
|
@@ -76,7 +76,11 @@ func (m *MainWindow) Initialize() {
|
||||
m.options_dialog = &OptionsDialog{}
|
||||
|
||||
// Main menu.
|
||||
m.InitializeMainMenu()
|
||||
if runtime.GOOS == "darwin" {
|
||||
m.initializeMacMenu()
|
||||
} else {
|
||||
m.InitializeMainMenu()
|
||||
}
|
||||
|
||||
// Toolbar.
|
||||
m.InitializeToolbar()
|
||||
@@ -140,6 +144,7 @@ func (m *MainWindow) Initialize() {
|
||||
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)
|
||||
|
||||
m.window.Add(m.vbox)
|
||||
|
||||
m.window.ShowAll()
|
||||
|
||||
// Launch events.
|
||||
|
28
ui/mainwindow_init_mac.go
Normal file
28
ui/mainwindow_init_mac.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
// other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
func (m *MainWindow) initializeMac() {
|
||||
if runtime.GOOS == "darwin" {
|
||||
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
|
||||
gtk.RCParse(dir + "/../Resources/themes/gtkrc-keybindings")
|
||||
|
||||
// ToDo: theming support and theme seletion in settings.
|
||||
gtk.RCParse(dir + "/../Resources/themes/ClearlooksBrave/gtk-2.0/gtkrc")
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MainWindow) initializeMacMenu() {
|
||||
// This is a placeholder, in future we will use native mac menu.
|
||||
// For now it launches default menu initialization.
|
||||
m.InitializeMainMenu()
|
||||
}
|
Reference in New Issue
Block a user