GNOME Bugzilla – Bug 786866
Port NautilusListModel to GLib type declaration
Last modified: 2017-09-02 09:19:26 UTC
.
Created attachment 358518 [details] [review] list-model: port to G_DECLARE_* macros. This patch ports NautilusListModel to G_DECLARE_DERIVABLE_TYPE and adds NautilusListModelDetails as a Private variable.
Review of attachment 358518 [details] [review]: As with your previous patch, fix the commit message to not retell what the diff already says. Apart from that and some style nitpicks, the patch looks fine. ::: src/nautilus-list-model.c @@ +78,2 @@ GList *highlight_files; +}NautilusListModelPrivate; Leave a space between the brace and the name. @@ +143,3 @@ + NautilusListModelPrivate *priv; + + priv = nautilus_list_model_get_instance_private (NAUTILUS_LIST_MODEL(tree_model)); Function-like macros should be treated like functions in that you should leave a space between the name and the opening parenthesis. This repeats in other places, too. Alternatively, you could introduce a new variable to hold the NautilusListModel pointer. @@ +225,3 @@ model = (NautilusListModel *) tree_model; + priv = nautilus_list_model_get_instance_private (model); + The newline here seems unnecessary. @@ +812,3 @@ + priv = nautilus_list_model_get_instance_private (model); + The newline here is unnecessary. @@ +917,2 @@ id = nautilus_list_model_get_sort_column_id_from_attribute + (model, priv->sort_attribute); As an exception, move the stuff here to the line above. Things like this aren’t fun when grepping for strings. @@ +1314,3 @@ g_return_if_fail (model != NULL); + NautilusListModelPrivate *priv; There is code above this line. We put declarations at the beginning of the block. @@ +1369,1 @@ subdirectory) != NULL) As the condition just got shorter, feel free to turn this into a single line. @@ +1399,2 @@ file_entry = g_sequence_get (iter->user_data); + Don’t add the newline here. If anything, you should probably separate the assignments above. @@ +1488,2 @@ column = + NAUTILUS_COLUMN (priv->columns->pdata[i]); Feel free to merge the lines here. @@ +1588,3 @@ g_return_if_fail (!view || GTK_IS_TREE_VIEW (view)); + NautilusListModelPrivate *priv; Same as before, declarations before code. @@ +1861,1 @@ refresh_row, model); This would be fine to merge at this point. @@ +1870,1 @@ refresh_row, model); Looks mergeable. ::: src/nautilus-list-model.h @@ +32,2 @@ #define NAUTILUS_TYPE_LIST_MODEL nautilus_list_model_get_type() +G_DECLARE_DERIVABLE_TYPE (NautilusListModel, nautilus_list_model, NAUTILUS, LIST_MODEL, GObject); Remove the semicolon. @@ +34,1 @@ #define NAUTILUS_LIST_MODEL(obj) \ You forgot to remove a bunch of macros here. @@ +64,1 @@ GType nautilus_list_model_get_type (void); Remove this as well.
Created attachment 358586 [details] [review] list-model: port to G_DECLARE_* macros. This patch ports NautilusListModel to G_DECLARE_DERIVABLE_TYPE and adds NautilusListModelDetails as a Private variable.
Review of attachment 358586 [details] [review]: Sure, but the commit message is still the same. Try providing motivations behind the change, i.e. what problem it solves. There is also a factual inaccuracy there, you do not add NautilusListModelDetails as private data.
Created attachment 358709 [details] [review] list-model: port to G_DECLARE_* 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 developers alike.
Created attachment 358713 [details] [review] list-model: use macro for type casting This patch converts all manual type casting to use the NAUTILUS_LIST_MODEL macro for converging into a single style.
Review of attachment 358709 [details] [review]: Cool. In the future, don’t use full stops in the subject line.
Review of attachment 358713 [details] [review]: Nice.
Review of attachment 358713 [details] [review]: Patch does not apply. Rebase it on your previous one.
Created attachment 358912 [details] [review] list-model: use macro for type casting This patch converts all manual type casting to use the NAUTILUS_LIST_MODEL macro for converging into a single style
Created attachment 358914 [details] [review] list-model: use macro for type casting This patch converts all manual type casting to use the NAUTILUS_LIST_MODEL macro for converging into a single style
Review of attachment 358914 [details] [review]: Sure.
Attachment 358709 [details] pushed as a5b8694 - list-model: port to G_DECLARE_* macros Attachment 358914 [details] pushed as 7b51ed6 - list-model: use macro for type casting