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:
2016-10-10 19:16:51 +05:00
parent 25dfa5072b
commit 2784586f8d
19 changed files with 1650 additions and 14 deletions

View File

@@ -29,6 +29,8 @@ type MainWindow struct {
// Gamemodes.
gamemodes map[string]string
text string
// Widgets.
// The window itself.
window *gtk.Window

View File

@@ -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
View 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()
}