Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's Guide by SourceryThis pull request migrates the power management daemon from using No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @mhduiy - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the dconfig keys into a separate file or a dedicated section within the existing
constant.gofor better organization. - It looks like you've removed the gio dependency, make sure that there are no other packages that depend on it.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| return v.service.EmitPropertyChanged(v, "HasAmbientLightSensor", value) | ||
| } | ||
|
|
||
| func (v *Manager) setPropLinePowerScreensaverDelay(value int) (changed bool) { |
There was a problem hiding this comment.
issue (complexity): Consider using a generic helper function to reduce code duplication in the property setters by abstracting the common logic for setting a property and emitting the change signal.
You can reduce the duplication by abstracting the common logic into a single generic helper. For example, if you’re using Go 1.18+ you can define a generic setter that takes a pointer to the property, its new value, and the property name:
func (v *Manager) updateProp[T comparable](prop *T, newVal T, name string) bool {
if *prop == newVal {
return false
}
*prop = newVal
_ = v.service.EmitPropertyChanged(v, name, newVal)
return true
}Then update the individual setters to delegate to this helper:
func (v *Manager) setPropLinePowerScreensaverDelay(value int) bool {
return v.updateProp(&v.LinePowerScreensaverDelay, value, "LinePowerScreensaverDelay")
}
func (v *Manager) setPropScreenBlackLock(value bool) bool {
return v.updateProp(&v.ScreenBlackLock, value, "ScreenBlackLock")
}This approach keeps the functionality intact while reducing code repetition and complexity.
gsettings -> dconfig pms: TASK-374909
|
TAG Bot New tag: 6.1.27 |
|
TAG Bot New tag: 6.1.28 |
|
TAG Bot New tag: 6.1.29 |
|
TAG Bot New tag: 6.1.30 |
|
TAG Bot New tag: 6.1.31 |
|
TAG Bot New tag: 6.1.32 |
|
TAG Bot New tag: 6.1.33 |
|
TAG Bot New tag: 6.1.35 |
|
TAG Bot New tag: 6.1.36 |
|
TAG Bot New tag: 6.1.37 |
|
TAG Bot New tag: 6.1.38 |
|
TAG Bot New tag: 6.1.39 |
|
TAG Bot New tag: 6.1.40 |
|
TAG Bot New tag: 6.1.41 |
|
TAG Bot New tag: 6.1.42 |
|
TAG Bot New tag: 6.1.43 |
|
TAG Bot New tag: 6.1.44 |
|
TAG Bot New tag: 6.1.45 |
|
TAG Bot New tag: 6.1.46 |
|
TAG Bot New tag: 6.1.47 |
|
TAG Bot New tag: 6.1.48 |
|
TAG Bot New tag: 6.1.49 |
|
TAG Bot New tag: 6.1.50 |
|
TAG Bot New tag: 6.1.51 |
|
TAG Bot New tag: 6.1.52 |
|
TAG Bot New tag: 6.1.53 |
gsettings -> dconfig
pms: TASK-374909
Summary by Sourcery
Migrate power module configuration from GSettings to DConfig
Enhancements:
Chores: