summaryrefslogtreecommitdiff
path: root/gi/overrides/Gtk.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-11-04 20:27:36 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-11-04 20:53:12 +0100
commite6f62b6f306baca6d3c5d460e87639876dee5a32 (patch)
tree06425c91586a8fedea2de04e02fad500e953ac26 /gi/overrides/Gtk.py
parent9140750640b3e2f583a5a4f9b0507f7636d6eda1 (diff)
downloadpygobject-e6f62b6f306baca6d3c5d460e87639876dee5a32.tar.gz
tests: Make tests run with GTK4
This contains the minimum changes needed to get the tests to pass using our docker image which contains a build gtk master from today. This also makes the gtk4 CI job fatal so we don't regress in this area.
Diffstat (limited to 'gi/overrides/Gtk.py')
-rw-r--r--gi/overrides/Gtk.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 05da18aa..736c8d88 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -141,15 +141,17 @@ class Widget(Gtk.Widget):
super(Widget, self).freeze_child_notify()
return _FreezeNotifyManager(self)
- def drag_dest_set_target_list(self, target_list):
- if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)):
- target_list = Gtk.TargetList.new(_construct_target_list(target_list))
- super(Widget, self).drag_dest_set_target_list(target_list)
-
- def drag_source_set_target_list(self, target_list):
- if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)):
- target_list = Gtk.TargetList.new(_construct_target_list(target_list))
- super(Widget, self).drag_source_set_target_list(target_list)
+ if Gtk._version != "4.0":
+ def drag_dest_set_target_list(self, target_list):
+ if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)):
+ target_list = Gtk.TargetList.new(_construct_target_list(target_list))
+ super(Widget, self).drag_dest_set_target_list(target_list)
+
+ if Gtk._version != "4.0":
+ def drag_source_set_target_list(self, target_list):
+ if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)):
+ target_list = Gtk.TargetList.new(_construct_target_list(target_list))
+ super(Widget, self).drag_source_set_target_list(target_list)
def style_get_property(self, property_name, value=None):
if value is None:
@@ -184,8 +186,6 @@ class Container(Gtk.Container, Widget):
# alias for Python 2.x object protocol
__nonzero__ = __bool__
- get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain)
-
def child_get_property(self, child, property_name, value=None):
if value is None:
prop = self.find_child_property(property_name)
@@ -197,15 +197,18 @@ class Container(Gtk.Container, Widget):
Gtk.Container.child_get_property(self, child, property_name, value)
return value.get_value()
- def child_get(self, child, *prop_names):
- """Returns a list of child property values for the given names."""
- return [self.child_get_property(child, name) for name in prop_names]
+ if Gtk._version in ("2.0", "3.0"):
+ def child_get(self, child, *prop_names):
+ """Returns a list of child property values for the given names."""
+ return [self.child_get_property(child, name) for name in prop_names]
+
+ def child_set(self, child, **kwargs):
+ """Set a child properties on the given child to key/value pairs."""
+ for name, value in kwargs.items():
+ name = name.replace('_', '-')
+ self.child_set_property(child, name, value)
- def child_set(self, child, **kwargs):
- """Set a child properties on the given child to key/value pairs."""
- for name, value in kwargs.items():
- name = name.replace('_', '-')
- self.child_set_property(child, name, value)
+ get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain)
Container = override(Container)