Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
fix: GTK4.9 build (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
daudix committed Feb 24, 2023
1 parent f060f23 commit c5078fa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion gradience/frontend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,16 @@ def on_error(_, section, error):
)

css_provider.connect("parsing-error", on_error)
css_provider.load_from_data(gtk_css.encode())

# In GTK 4.8, bytes are expected, in GTK 4.10, you can provider a string, with a length.
# This patch still allows bytes for backwards compatibility, and add support for
# strings in GTK 4.8 and before.
# https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/231
# Credits to https://gitlab.gnome.org/amolenaar for the patch
if (Gtk.get_major_version(), Gtk.get_minor_version()) >= (4, 9):
css_provider.load_from_data(gtk_css, -1)
else:
css_provider.load_from_data(gtk_css.encode())

self.props.active_window.update_errors(
self.global_errors + parsing_errors)
Expand Down

0 comments on commit c5078fa

Please sign in to comment.