GNOME Bugzilla – Bug 774709
Modernize our use of GObject
Last modified: 2021-07-05 12:32:25 UTC
We should start using recent GObject improvements and conveniences like G_ADD_PRIVATE (or G_DEFINE_*TYPE_WITH_PRIVATE) and G_DECLARE_*_TYPE. Not only will it clean up and improve the code inside libgd, it will also let libgd users leverage g_auto*. Some of these changes will change the ABI of the public structs, but that won't matter since we are not a conventional library. I don't know if some libgd user is using a non-GCC/LLVM compiler, so I am not going to start using g_auto* inside libgd.
Created attachment 340298 [details] [review] main-view: Use G_DEFINE_WITH_PRIVATE
Created attachment 340299 [details] [review] main-view: Drop the priv pointer
Created attachment 340346 [details] [review] main-view: Use G_DECLARE_DERIVABLE_TYPE
Created attachment 340347 [details] [review] main-view: Don't export the typedef for the private structure
Review of attachment 340298 [details] [review]: Looks good
Review of attachment 340299 [details] [review]: OK
Review of attachment 340346 [details] [review]: OK
Review of attachment 340347 [details] [review]: OK
Pushed to master.
Created attachment 340623 [details] [review] main-icon-view: Use G_ADD_PRIVATE
Review of attachment 340623 [details] [review]: Looks good.
Created attachment 340842 [details] [review] main-icon-view: Drop the priv pointer
Review of attachment 340842 [details] [review]: Looks good.
Created attachment 373388 [details] [review] main-icon-view: Use G_DECLARE_DERIVABLE_TYPE
Created attachment 373389 [details] [review] main-icon-view: Don't export the typedef for the private structure
Created attachment 373390 [details] [review] styled-test-renderer: Use G_DEFINE_WITH_PRIVATE
Created attachment 373391 [details] [review] styled-text-renderer: Drop the priv pointer
Created attachment 373392 [details] [review] styled-text-renderer: Use G_DECLARE_DERIVABLE_TYPE
Created attachment 373393 [details] [review] styled-text-renderer: Don't export the private typedef
I pushed this set of patches. A few builds and smoke-testing later, they seem to work as expected. Comments still welcome, though.
Review of attachment 373390 [details] [review]: ::: libgd/gd-styled-text-renderer.c @@ +26,3 @@ }; +G_DEFINE_TYPE_WITH_PRIVATE (GdStyledTextRenderer, gd_styled_text_renderer, GTK_TYPE_CELL_RENDERER_TEXT); Pre-existing, but you can drop the terminal semicolon
Only this one small comment; anything else left to do before we can close this ticket?
(In reply to Cosimo Cecchi from comment #22) > Only this one small comment; anything else left to do before we can close > this ticket? There are a few more classes that use g_type_class_add_private that we need to migrate. Ever since it was actually marked as deprecated in GLib 2.57.2, it has started throwing deprecation warnings during the build.
Created attachment 373435 [details] [review] two-lines-renderer: Use G_DEFINE_WITH_PRIVATE
Created attachment 373436 [details] [review] two-lines-renderer: Drop the priv pointer
Created attachment 373437 [details] [review] two-lines-renderer: Use G_DECLARE_DERIVABLE_TYPE
Created attachment 373438 [details] [review] two-lines-renderer: Don't export the private typedef
Created attachment 373440 [details] [review] Remove trailing semi-colons from G_DEFINE_TYPE* calls
Review of attachment 373435 [details] [review]: LGTM
Review of attachment 373436 [details] [review]: LGTM
Review of attachment 373437 [details] [review]: LGTM
Review of attachment 373438 [details] [review]: LGTM
Review of attachment 373440 [details] [review]: LGTM
Thanks for all the reviews so far, Cosimo! Pushed them to master.
Created attachment 373857 [details] [review] toggle-pixbuf-renderer: Use G_DEFINE_WITH_PRIVATE
Created attachment 373858 [details] [review] toggle-pixbuf-renderer: Drop the priv pointer
Created attachment 373859 [details] [review] toggle-pixbuf-renderer: Use G_DECLARE_DERIVABLE_TYPE
Created attachment 373860 [details] [review] toggle-pixbuf-renderer: Don't export the private typedef
Review of attachment 373857 [details] [review]: ++
Review of attachment 373858 [details] [review]: ++
Review of attachment 373859 [details] [review]: ++
Review of attachment 373860 [details] [review]: ++
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libgd/-/issues/ Thank you for your understanding and your help.