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

Function populateVisualsGroup

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

Source from the content-addressed store, hash-verified

295}
296
297func populateVisualsGroup(group *adw.PreferencesGroup) {
298 color, err := core.RGBAFromHex(core.Overrides.Color)
299 if err != nil {
300 log.Fatalf("unexpected: nil color, %v (%s)", err, core.UserPrefs.ProgressColor)
301 }
302
303 dialog := gtk.NewColorDialog()
304 dialog.SetWithAlpha(false)
305 colorSwitch := gtk.NewColorDialogButton(dialog)
306 colorSwitch.AddCSSClass("color-picker-btn")
307 colorSwitch.SetRGBA(color)
308 colorSwitch.SetVExpand(false)
309 colorRow := adw.NewActionRow()
310 colorRow.AddSuffix(colorSwitch)
311 colorRow.SetTitle("Progress color")
312
313 colorSwitch.Connect("notify", func() {
314 core.SetProgressColor(core.HexFromRGBA(colorSwitch.RGBA()))
315 })
316
317 roundedSwitch := adw.NewSwitchRow()
318 roundedSwitch.SetTitle("Rounded corners")
319 roundedSwitch.SetActive(core.UserPrefs.Rounded)
320 roundedSwitch.Connect("notify::active", func() {
321 core.SetRounded(roundedSwitch.Active())
322 })
323
324 shadowSwitch := adw.NewSwitchRow()
325 shadowSwitch.SetTitle("Shadow")
326 shadowSwitch.SetActive(core.UserPrefs.Shadow)
327 shadowSwitch.Connect("notify::active", func() {
328 core.SetShadow(shadowSwitch.Active())
329 })
330
331 lowFPSSwitch := adw.NewSwitchRow()
332 lowFPSSwitch.SetTitle("1 FPS mode")
333 lowFPSSwitch.SetSubtitleLines(2)
334 lowFPSSwitch.SetSubtitle(fmt.Sprintf("Does not affect preview"))
335 lowFPSSwitch.SetHasTooltip(true)
336 lowFPSSwitch.SetActive(core.UserPrefs.LowFPS)
337 lowFPSSwitch.Connect("notify::active", func() {
338 core.SetLowFPS(lowFPSSwitch.Active())
339 })
340
341 group.Add(colorRow)
342 group.Add(roundedSwitch)
343
344 if core.IsGnome || core.IsPlasma {
345 group.Add(shadowSwitch)
346 }
347
348 if core.IsGnome {
349 group.Add(lowFPSSwitch)
350 }
351}
352
353func populatePresetsGroup(group *adw.PreferencesGroup) {
354 defaultPresetSelect = adw.NewComboRow()

Callers 1

NewPrefsWidgetsFunction · 0.85

Calls 6

RGBAFromHexFunction · 0.92
SetProgressColorFunction · 0.92
HexFromRGBAFunction · 0.92
SetRoundedFunction · 0.92
SetShadowFunction · 0.92
SetLowFPSFunction · 0.92

Tested by

no test coverage detected