theironrobin / siglo

GTK app to sync InfiniTime watch with PinePhone
Mozilla Public License 2.0
153 stars 23 forks source link

Check for Gnome schemas before trying to work with them to fix crash #46

Closed cincodenada closed 3 years ago

cincodenada commented 3 years ago

This is a fix for #45, wherein GIO crashes hard (with a core dump!) if we try to access a schema that doesn't exist, so check for existence first. If the settings don't exist, just don't try to fiddle with them.

Also, since this adds more caffeine-specific logic to init, I pulled that out into its own class while I was at it.

This PR is a little more fanfare and perhaps more paranoid than is strictly needed, with some checking for backwards-compatibility and trying to make Caffeine truly optional and pulling it into its own class, but I think is a reasonable solution. One could imagine adding handling for other power managers to the Caffeinator if desired as well.

Messages and the like are just my best attempt to describe what's going on, feel free to edit as you see fit :)

theironrobin commented 3 years ago

thanks for your efforts!