Skip to content

Commit

Permalink
Merge pull request #4433 from Jacalz/build-hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz authored Dec 4, 2023
2 parents 261ac0d + 4916310 commit fc111ac
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion container/tabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/internal"
"fyne.io/fyne/v2/internal/build"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
Expand Down Expand Up @@ -209,7 +210,7 @@ func selectItem(t baseTabs, item *TabItem) {
}

func setItems(t baseTabs, items []*TabItem) {
if internal.HintsEnabled && mismatchedTabItems(items) {
if build.HasHints && mismatchedTabItems(items) {
internal.LogHint("Tab items should all have the same type of content (text, icons or both)")
}
t.setItems(items)
Expand Down
8 changes: 8 additions & 0 deletions internal/build/hints_disabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !hints
// +build !hints

package build

// HasHints is false to indicate that hints are not currently switched on.
// To enable please rebuild with "-tags hints" parameters.
const HasHints = false
7 changes: 7 additions & 0 deletions internal/build/hints_enabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build hints
// +build hints

package build

// HasHints is true to indicate that hints are currently switched on.
const HasHints = true
4 changes: 0 additions & 4 deletions internal/hints_disabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

package internal

// HintsEnabled is false to indicate that hints are not currently switched on.
// To enable please rebuild with "-tags hints" parameters.
const HintsEnabled = false

// LogHint reports a developer hint that should be followed to improve their app.
// This does nothing unless the "hints" build flag is used.
func LogHint(reason string) {
Expand Down
3 changes: 0 additions & 3 deletions internal/hints_enabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import (
"runtime"
)

// HintsEnabled is true to indicate that hints are currently switched on.
const HintsEnabled = true

// LogHint reports a developer hint that should be followed to improve their app.
func LogHint(reason string) {
log.Println("Fyne hint: ", reason)
Expand Down

0 comments on commit fc111ac

Please sign in to comment.