[pygobject/wip/jfelder/gtk4-toolbutton: 1/3] gtk overrides: Drop ToolButton for Gtk4



commit 2a1c627ae780aea2df7aa43fb6b2d69f2acda13d
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Mar 16 20:19:48 2020 +0100

    gtk overrides: Drop ToolButton for Gtk4
    
    It has been removed (gtk commit
    44e153d8a8679633681dd3ae2029735255e4f839).
    
    The associated test is removed.

 gi/overrides/Gtk.py         | 14 +++++++-------
 tests/test_overrides_gtk.py |  6 ------
 2 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 834f5eb6..74555d16 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -696,14 +696,14 @@ IconView = override(IconView)
 __all__.append('IconView')
 
 
-class ToolButton(Gtk.ToolButton):
-    __init__ = deprecated_init(Gtk.ToolButton.__init__,
-                               arg_names=('stock_id',),
-                               category=PyGTKDeprecationWarning)
-
+if Gtk._version in ("2.0", "3.0"):
+    class ToolButton(Gtk.ToolButton):
+        __init__ = deprecated_init(Gtk.ToolButton.__init__,
+                                   arg_names=('stock_id',),
+                                   category=PyGTKDeprecationWarning)
 
-ToolButton = override(ToolButton)
-__all__.append('ToolButton')
+    ToolButton = override(ToolButton)
+    __all__.append('ToolButton')
 
 
 class IMContext(Gtk.IMContext):
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 9c32e8ba..0b4eae60 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -778,12 +778,6 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(button.props.label, 'mylabel')
         self.assertEqual(button.props.icon_widget, icon)
 
-    def test_toolbutton_gtk4(self):
-        icon = Gtk.Image.new()
-        button = Gtk.ToolButton(label='mylabel', icon_widget=icon)
-        self.assertEqual(button.props.label, 'mylabel')
-        self.assertEqual(button.props.icon_widget, icon)
-
     @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
     def test_iconset(self):
         Gtk.IconSet()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]