Skip to content

Refactor dark theme detection into a function

Jente Hidskes requested to merge hjdskes/gitg:fix/dark-theme-detection into master

Fixes #133 (closed).

We need to instance a Gtk.Widget to be able to use get_style_context. Thus, we use the singleton pattern to avoid allocating an object every time we call use_dark_theme().

I'm not 100% sure about the solution. I mean, I believe we do need a Gtk.Widget instance so there's no way around placing this code inside a Gtk.Widget subclass, but perhaps there is a better place to put this or a better solution instead of a singleton.

Merge request reports