Commit 210ddbb2 authored by Kai Willadsen's avatar Kai Willadsen

Update required GTK+, etc. to 3.20 and remove some compat hacks

parent 6f928ff9
......@@ -16,11 +16,11 @@ Meld is licensed under the GPL v2 or later.
Requirements
------------
* Python 3.3
* GTK+ 3.14
* Python 3.4
* GTK+ 3.20
* GLib 2.36
* PyGObject 3.14
* GtkSourceView 3.14
* PyGObject 3.20
* GtkSourceView 3.20
* pycairo
......
......@@ -17,11 +17,6 @@ link-map {
background-color: @theme_bg_color;
}
/* Only for backwards-compatibility with pre-3.20 GTK+ */
LinkMap {
background-color: @theme_bg_color;
}
.meld-vc-console-pane {
border-width: 1px 0 0 0;
border-style: solid;
......
......@@ -238,14 +238,9 @@ class GutterRendererChunkAction(
GtkSource.GutterRendererPixbuf.do_draw(
self, context, background_area, cell_area, start, end, state)
if self.is_action:
if Gtk.get_minor_version() < 20:
style_context = get_style(None, "GtkButton.flat.image-button")
style_context.add_class(Gtk.STYLE_CLASS_BUTTON)
style_context.add_class(Gtk.STYLE_CLASS_FLAT)
else:
# TODO: Fix padding and min-height in CSS and use
# draw_style_common
style_context = get_style(None, "button.flat.image-button")
# TODO: Fix padding and min-height in CSS and use
# draw_style_common
style_context = get_style(None, "button.flat.image-button")
style_context.set_state(renderer_to_gtk_state(state))
x = background_area.x + 1
......
......@@ -134,11 +134,8 @@ class LinkMap(Gtk.DrawingArea):
def do_scroll_event(self, event):
self.filediff.next_diff(event.direction)
try:
LinkMap.set_css_name("link-map")
except AttributeError:
# New API in 3.20
pass
LinkMap.set_css_name("link-map")
class ScrollLinkMap(Gtk.DrawingArea):
......
......@@ -246,13 +246,9 @@ class MeldWindow(gnomeglade.Component):
rmenu = self.ui.get_widget('/Menubar/FileMenu/Recent').get_submenu()
rmenu.connect("map", self._on_recentmenu_map)
try:
builder = meld.ui.util.get_builder("shortcuts.ui")
shortcut_window = builder.get_object("shortcuts-meld")
self.widget.set_help_overlay(shortcut_window)
except GLib.Error:
# GtkShortcutsWindow is new in GTK+ 3.20
pass
builder = meld.ui.util.get_builder("shortcuts.ui")
shortcut_window = builder.get_object("shortcuts-meld")
self.widget.set_help_overlay(shortcut_window)
def _on_recentmenu_map(self, recentmenu):
for imagemenuitem in recentmenu.get_children():
......
......@@ -185,17 +185,6 @@ def get_base_style_scheme():
base_style_scheme = None
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
......@@ -217,7 +206,9 @@ def colour_lookup_with_fallback(name, attribute):
"this is a bad install") % (name, attribute), file=sys.stderr)
sys.exit(1)
return parse_rgba(style_attr)
colour = Gdk.RGBA()
colour.parse(style_attr)
return colour
def get_common_theme():
......
......@@ -19,8 +19,6 @@ 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):
......@@ -59,7 +57,8 @@ class EmblemCellRenderer(Gtk.CellRenderer):
elif pspec.name == "icon-tint":
self._icon_tint = value
if self._icon_tint:
self._tint_color = parse_rgba(value)
self._tint_color = Gdk.RGBA()
self._tint_color.parse(value)
else:
self._tint_color = None
else:
......
......@@ -42,9 +42,8 @@ def append_element(path, selector):
('link', Gtk.StateFlags.LINK),
('visited', Gtk.StateFlags.VISITED),
('checked', Gtk.StateFlags.CHECKED),
('drop(active)', Gtk.StateFlags.DROP_ACTIVE)
]
if Gtk.get_minor_version() >= 20:
pseudo_classes.append(('drop(active)', Gtk.StateFlags.DROP_ACTIVE))
toks = [t for t in re.split('([#\.:])', selector) if t]
elements = [toks[i] + toks[i + 1] for i in range(1, len(toks), 2)]
......
......@@ -38,9 +38,8 @@ class MeldNotebook(Gtk.Notebook):
css = (
b"""
@binding-set TabSwitchBindings {}
MeldNotebook { """ +
(b"" if Gtk.get_minor_version() <= 18 else b"-") +
b"gtk-key-bindings: TabSwitchBindings; }"
MeldNotebook { -gtk-key-bindings: TabSwitchBindings; }
"""
)
ui = """
......
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