Commit 5b0d31d2 authored by Kai Willadsen's avatar Kai Willadsen

misc, emblemcellrenderer: Fix 3.20 API break in colour parsing

parent 4f7f5097
......@@ -147,6 +147,17 @@ def make_tool_button_widget(label):
MELD_STYLE_SCHEME = "meld-base"
def parse_rgba(string):
"""Parse a string to a Gdk.RGBA across different GTK+ APIs
Introspection changes broke this API in GTK+ 3.20; this function
is just a backwards-compatiblity workaround.
"""
colour = Gdk.RGBA()
result = colour.parse(string)
return result[1] if isinstance(result, tuple) else colour
def colour_lookup_with_fallback(name, attribute):
from meld.settings import meldsettings
source_style = meldsettings.style_scheme
......@@ -169,9 +180,7 @@ def colour_lookup_with_fallback(name, attribute):
"this is a bad install") % (name, attribute)
sys.exit(1)
colour = Gdk.RGBA()
colour.parse(style_attr)
return colour
return parse_rgba(style_attr)
def get_common_theme():
......
......@@ -19,6 +19,8 @@ from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
from meld.misc import parse_rgba
class EmblemCellRenderer(Gtk.CellRenderer):
......@@ -57,8 +59,7 @@ class EmblemCellRenderer(Gtk.CellRenderer):
elif pspec.name == "icon-tint":
self._icon_tint = value
if self._icon_tint:
self._tint_color = Gdk.RGBA()
self._tint_color.parse(value)
self._tint_color = parse_rgba(value)
else:
self._tint_color = None
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment