Skip to content

Commit

Permalink
add menu item to open the wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
ftl committed Jun 25, 2023
1 parent 3859a1c commit c0878bc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func (c *Controller) Shutdown() {
c.Radio.Stop()
}

func (c *Controller) OpenWiki() {
c.openWithExternalApplication("https://github.com/ftl/hellocontest/wiki")
}

func (c *Controller) About() {
c.view.ShowInfoDialog("Hello Contest\n\nVersion %s\n\nThis software is published under the MIT License.\n(c) Florian Thienel/DL3NEY", c.version)
}
Expand Down
8 changes: 8 additions & 0 deletions ui/glade/contest.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,14 @@ THE SOFTWARE.
<object class="GtkMenu" id="submenuHelp">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkMenuItem" id="menuHelpWiki">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Wiki</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuHelpAbout">
<property name="visible">True</property>
Expand Down
11 changes: 10 additions & 1 deletion ui/mainMenu.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

// MainMenuController provides the functionality for the main menu.
type MainMenuController interface {
OpenWiki()
About()
New()
Open()
Expand Down Expand Up @@ -71,7 +72,9 @@ type mainMenu struct {
windowScore *gtk.MenuItem
windowRate *gtk.MenuItem
windowSpots *gtk.MenuItem
helpAbout *gtk.MenuItem

helpWiki *gtk.MenuItem
helpAbout *gtk.MenuItem
}

func setupMainMenu(builder *gtk.Builder) *mainMenu {
Expand Down Expand Up @@ -104,6 +107,7 @@ func setupMainMenu(builder *gtk.Builder) *mainMenu {
result.windowScore = getUI(builder, "menuWindowScore").(*gtk.MenuItem)
result.windowRate = getUI(builder, "menuWindowRate").(*gtk.MenuItem)
result.windowSpots = getUI(builder, "menuWindowSpots").(*gtk.MenuItem)
result.helpWiki = getUI(builder, "menuHelpWiki").(*gtk.MenuItem)
result.helpAbout = getUI(builder, "menuHelpAbout").(*gtk.MenuItem)

result.fileNew.Connect("activate", result.onNew)
Expand Down Expand Up @@ -133,6 +137,7 @@ func setupMainMenu(builder *gtk.Builder) *mainMenu {
result.windowScore.Connect("activate", result.onScore)
result.windowRate.Connect("activate", result.onRate)
result.windowSpots.Connect("activate", result.onSpots)
result.helpWiki.Connect("activate", result.onWiki)
result.helpAbout.Connect("activate", result.onAbout)

return result
Expand Down Expand Up @@ -163,6 +168,10 @@ func (m *mainMenu) ContestPagesChanged(rulesAvailable bool, uploadAvailable bool
m.fileOpenUpload.SetSensitive(uploadAvailable)
}

func (m *mainMenu) onWiki() {
m.controller.OpenWiki()
}

func (m *mainMenu) onAbout() {
m.controller.About()
}
Expand Down

0 comments on commit c0878bc

Please sign in to comment.