GNOME Bugzilla – Bug 639936
[gi] Gdk.Window: Map the standard constructor to the *new* constructor
Last modified: 2011-02-02 14:15:07 UTC
Gdk.Window had to be made abstract (see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk), this override allows using the standard constructor This commit adds as well a testcase.
Created attachment 178708 [details] [review] [gi] Gdk.Window: Map the standard constructor to the *new* constructor
Created attachment 178733 [details] [review] [gi] Gdk.Window: Map the standard constructor to the *new* constructor Gdk.Window had to be made abstract (see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk), this override allows using the standard constructor This commit adds as well a testcase.
I get this when I apply and run make check: ====================================================================== ERROR: test_constructor (test_overrides.TestGdk) ---------------------------------------------------------------------- Traceback (most recent call last):
+ Trace 225710
window = Gdk.Window(None, attribute, attributes_mask)
return Gdk.Window.new(parent, attribute, attributes_mask)
return info.invoke(*args)
---------------------------------------------------------------------- Ran 396 tests in 7.650s
I'm guessing gdk_window_new needs a (allow-none) annotation.
(In reply to comment #4) > I'm guessing gdk_window_new needs a (allow-none) annotation. We rather need https://bugzilla.gnome.org/show_bug.cgi?id=561264 Everybody is welcome to take that patch and run with it as I'm not sure when I will have time to deal with it.
Created attachment 179508 [details] [review] Gdk.Window: Map the standard constructor to the *new* constructor Gdk.Window had to be made abstract (see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk), this override allows using the standard constructor This commit adds as well a testcase. Renamed the construct-time property: s/attribute/attributes
Pushed, thanks!
Hm, even with current g-i and pygobject I still get the test case failure from comment 3. What am I missing here?
Indeed in current gtk master head, gdk_window_new() is still a method (due to the first argument which looks like a "this" pointer). If I fix that with --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -1240,7 +1240,7 @@ sync_native_window_stack_position (GdkWindow *window) } /** - * gdk_window_new: + * gdk_window_new: (constructor): then it's back to being a ctor, and this test case works. As your referenced commit c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec doesn't actually exist in gtk, above change might be what you wanted to refer to?
As I also wanted to fix the Radio button constructors, I pushed this to GTK now: http://git.gnome.org/browse/gtk+/commit/?id=0e795b67c33400dcff78500a3fa0861af3ff0111 Now the tests work fine again, and we can also drop the special case workaround for radio button construction in Pygi apps.