linuxmint / cinnamon-screensaver

The Cinnamon screen locker and screensaver program
GNU General Public License v2.0
151 stars 86 forks source link

Theming broken with pygobject >= 3.46.0 #446

Closed bobby285271 closed 10 months ago

bobby285271 commented 11 months ago

Distribution

Fedora 39 Beta / NixOS unstable

Package version

5.8.0 (Fedora), 5.8.1 (NixOS)

Graphics hardware in use

(Not relevant)

Frequency

Always

Bug description

Don't know how to improve the issue title, screenshots can describe this issue better I guess.

pygobject 3.44.1 (using Mint-Y theme):

pygobject 3.46.0 (using Mint-Y theme):

Oct 22 12:22:33 localhost-live cinnamon-screensaver[3879]: Cinnamon Screensaver support not found in current theme - adding some...

(edit: never mind, later I noticed that the above log is also shown up in < 3.46.0, including Mint)

Steps to reproduce

(This can also be reproduced with a everything-up-to-date-GNOME-45 NixOS)

Expected behavior

The theming looks exactly like before.

Additional information

A quick bisect takes me to https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/231 "Fix incompatibility for CssProvider.load_from_data() (GTK 4.10)", though I did not look at how it affects the screensaver here.

mtwebster commented 10 months ago

Hi, can you try a couple of things for me?

These lines: https://github.com/linuxmint/cinnamon-screensaver/blob/master/src/cinnamon-screensaver-main.py#L142-L144

Change from:

            if fallback_prov.load_from_data(fallback_css.encode()):
                Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default(), fallback_prov, 600)
                Gtk.StyleContext.reset_widgets(Gdk.Screen.get_default())

to

            fallback_prov.load_from_data(fallback_css.encode())
            Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default(), fallback_prov, 600)
            Gtk.StyleContext.reset_widgets(Gdk.Screen.get_default())

(remove the conditional)

With their patch, they eliminated any return value from GtkCssProvider.load_from_data - this return value has been deprecated for a while in Gtk3 (though it still works I guess - we do the same thing in nemo as we do here), but it's gone in Gtk4, which is why they left it out in this override.

I also suspected the .encode() in the first line there, but I think that should be ok even with their change.

bobby285271 commented 10 months ago

Yes, this works for me, thanks for the fix!