GNOME Bugzilla – Bug 786815
Port NautilusFloatingBar to G_DECLARE_*_TYPE & G_DEFINE_TYPE_*
Last modified: 2017-08-30 08:26:35 UTC
.
Created attachment 358442 [details] [review] floating-bar: port to GLib type declaration macros. This patch ports the declaration of NautilusFloatingBar to G_DECLARE_FINAL_TYPE and G_DEFINE_TYPE_WITH_PRIVATE
Review of attachment 358442 [details] [review]: You shouldn’t be explaining in the commit message what changes you made in the code, as it’s obvious from the code itself. Rather, provide motivations, etc. Otherwise the patch looks mostly good. ::: src/nautilus-floating-bar.c @@ +58,3 @@ static guint signals[NUM_SIGNALS] = { 0, }; +G_DEFINE_TYPE_WITH_PRIVATE (NautilusFloatingBar, nautilus_floating_bar, Private data does not make sense here. Move the type struct here and use that to hold data. @@ -76,3 +76,3 @@ nautilus_floating_bar_finalize (GObject *obj) { - NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (obj); + NautilusFloatingBar *self; Unrelated change. @@ +84,2 @@ nautilus_floating_bar_remove_hover_timeout (self); + Unrelated change. @@ -91,3 +96,3 @@ GParamSpec *pspec) { - NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (object); + NautilusFloatingBar *self; Unrelated change. @@ +138,3 @@ + NautilusFloatingBar *self; + + self = NAUTILUS_FLOATING_BAR (object); Don’t make unrelated changes. @@ +195,3 @@ + NautilusFloatingBarPrivate *priv; + + priv = nautilus_floating_bar_get_instance_private (self); Tab indentation. @@ +197,3 @@ + priv = nautilus_floating_bar_get_instance_private (self); + + if (priv->hover_timeout_id != 0) Tab indentation. @@ +224,3 @@ CheckPointerData *data = user_data; gint pointer_y = -1; + NautilusFloatingBarPrivate *priv; You indented with a tab here. @@ +287,2 @@ check_pointer_timeout, data, check_pointer_data_free); Arguments are misaligned here. ::: src/nautilus-floating-bar.h @@ +30,2 @@ #define NAUTILUS_TYPE_FLOATING_BAR nautilus_floating_bar_get_type() +G_DECLARE_FINAL_TYPE (NautilusFloatingBar, nautilus_floating_bar, NAUTILUS, FLOATING_BAR, GtkBox); Semicolon here is unnecessary. @@ +33,1 @@ struct _NautilusFloatingBar { No reason to leave this in the header.
Created attachment 358584 [details] [review] floating-bar: port to GLib type declaration macros.
Review of attachment 358584 [details] [review]: Looks mostly good, but now your commit message has no body. ::: src/nautilus-floating-bar.c @@ +28,3 @@ #define HOVER_HIDE_TIMEOUT_INTERVAL 100 +struct _NautilusFloatingBar { Opening brace on a new line.
Created attachment 358708 [details] [review] floating-bar: port to GLib type declaration macros. Porting Nautilus object declarations to G_DECLARE_*_TYPE will reduce a a huge number of boilerplate code. That will make nautilus code easier for newcomers and others alike.
Created attachment 358710 [details] [review] floating-bar: port to GLib type declaration macros. Porting Nautilus object declarations to G_DECLARE_*_TYPE will reduce a huge number of boilerplate code. That will make nautilus code easier for newcomers and others alike.
Review of attachment 358710 [details] [review]: Yup.
Attachment 358710 [details] pushed as cad0a3e - floating-bar: port to GLib type declaration macros.