From 370d051a9519b1bdc77d58ab1ec0bc878e16f3bc Mon Sep 17 00:00:00 2001 From: Jacalz Date: Tue, 12 Nov 2024 10:41:18 +0100 Subject: [PATCH] Minor cleanup for handling of disabled animations --- app/settings.go | 4 +--- app/settings_noanimation.go | 7 ------- internal/build/animations_disabled.go | 7 +++++++ internal/build/animations_enabled.go | 7 +++++++ 4 files changed, 15 insertions(+), 10 deletions(-) delete mode 100644 app/settings_noanimation.go create mode 100644 internal/build/animations_disabled.go create mode 100644 internal/build/animations_enabled.go diff --git a/app/settings.go b/app/settings.go index ca83c84e6d..8eefb55aed 100644 --- a/app/settings.go +++ b/app/settings.go @@ -12,8 +12,6 @@ import ( "fyne.io/fyne/v2/theme" ) -var noAnimations bool // set to true at compile time if no_animations tag is passed - // SettingsSchema is used for loading and storing global settings type SettingsSchema struct { // these items are used for global settings load @@ -82,7 +80,7 @@ func (s *settings) SetTheme(theme fyne.Theme) { } func (s *settings) ShowAnimations() bool { - return !s.schema.DisableAnimations && !noAnimations + return !s.schema.DisableAnimations && !build.NoAnimations } func (s *settings) ThemeVariant() fyne.ThemeVariant { diff --git a/app/settings_noanimation.go b/app/settings_noanimation.go deleted file mode 100644 index 7d808d8dcb..0000000000 --- a/app/settings_noanimation.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build no_animations - -package app - -func init() { - noAnimations = true -} diff --git a/internal/build/animations_disabled.go b/internal/build/animations_disabled.go new file mode 100644 index 0000000000..4d5a83d804 --- /dev/null +++ b/internal/build/animations_disabled.go @@ -0,0 +1,7 @@ +//go:build no_animations + +package build + +// NoAnimations is true if the application was built without animations by +// passing the no_animations build tag. +const NoAnimations = true diff --git a/internal/build/animations_enabled.go b/internal/build/animations_enabled.go new file mode 100644 index 0000000000..e1eba8fa8c --- /dev/null +++ b/internal/build/animations_enabled.go @@ -0,0 +1,7 @@ +//go:build !no_animations + +package build + +// NoAnimations is true if the application was built without animations by +// passing the no_animations build tag. +const NoAnimations = false