MCPcopy Create free account
hub / github.com/efogdev/mpris-timer / populateInterfaceGroup

Function populateInterfaceGroup

internal/ui/prefs.go:143–200  ·  view source on GitHub ↗
(group *adw.PreferencesGroup)

Source from the content-addressed store, hash-verified

141}
142
143func populateInterfaceGroup(group *adw.PreferencesGroup) {
144 titleEntry := adw.NewEntryRow()
145 titleEntry.SetTitle("Default title")
146 titleEntry.SetText(core.UserPrefs.DefaultTitle)
147 titleEntry.ConnectChanged(func() {
148 core.SetDefaultTitle(titleEntry.Text())
149 })
150
151 titleSwitch := adw.NewSwitchRow()
152 titleSwitch.SetTitle("Title in UI")
153 titleSwitch.SetSubtitle("Requires restart")
154 titleSwitch.SetActive(core.UserPrefs.ShowTitle)
155 titleSwitch.Connect("notify::active", func() {
156 core.SetShowTitle(titleSwitch.Active())
157 })
158
159 winSizeSwitch := adw.NewSwitchRow()
160 winSizeSwitch.SetTitle("Remember window size")
161 winSizeSwitch.SetActive(core.UserPrefs.RememberWinSize)
162 winSizeSwitch.Connect("notify::active", func() {
163 core.SetRememberWindowSize(winSizeSwitch.Active())
164 })
165
166 showPresetsSwitch := adw.NewSwitchRow()
167 showPresetsSwitch.SetTitle("Show presets")
168 showPresetsSwitch.SetSubtitle("Requires restart")
169 showPresetsSwitch.SetActive(core.UserPrefs.ShowPresets)
170 showPresetsSwitch.Connect("notify::active", func() {
171 core.SetShowPresets(showPresetsSwitch.Active())
172 presetsOnRightSwitch.SetSensitive(showPresetsSwitch.Active())
173 defaultPresetSelect.SetSensitive(showPresetsSwitch.Active())
174 presetsGroup.SetVisible(showPresetsSwitch.Active())
175 })
176 presetsGroup.SetVisible(showPresetsSwitch.Active())
177
178 presetsOnRightSwitch = adw.NewSwitchRow()
179 presetsOnRightSwitch.SetTitle("Presets on right side")
180 presetsOnRightSwitch.SetSubtitle("Requires restart")
181 presetsOnRightSwitch.SetSensitive(core.UserPrefs.ShowPresets)
182 presetsOnRightSwitch.SetActive(core.UserPrefs.PresetsOnRight)
183 presetsOnRightSwitch.Connect("notify::active", func() {
184 core.SetPresetsOnRight(presetsOnRightSwitch.Active())
185 })
186
187 forceTraySwitch := adw.NewSwitchRow()
188 forceTraySwitch.SetTitle("Force tray icon")
189 forceTraySwitch.SetActive(core.UserPrefs.ForceTrayIcon)
190 forceTraySwitch.Connect("notify::active", func() {
191 core.SetForceTrayIcon(forceTraySwitch.Active())
192 })
193
194 group.Add(titleEntry)
195 group.Add(titleSwitch)
196 group.Add(showPresetsSwitch)
197 group.Add(presetsOnRightSwitch)
198 group.Add(winSizeSwitch)
199 group.Add(forceTraySwitch)
200}

Callers 1

NewPrefsWidgetsFunction · 0.85

Calls 6

SetDefaultTitleFunction · 0.92
SetShowTitleFunction · 0.92
SetRememberWindowSizeFunction · 0.92
SetShowPresetsFunction · 0.92
SetPresetsOnRightFunction · 0.92
SetForceTrayIconFunction · 0.92

Tested by

no test coverage detected