After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786866 - Port NautilusListModel to GLib type declaration
Port NautilusListModel to GLib type declaration
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks: 771777
 
 
Reported: 2017-08-27 17:01 UTC by Vyas Giridhar
Modified: 2017-09-02 09:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
list-model: port to G_DECLARE_* macros. (37.31 KB, patch)
2017-08-27 17:04 UTC, Vyas Giridhar
none Details | Review
list-model: port to G_DECLARE_* macros. (38.34 KB, patch)
2017-08-28 12:00 UTC, Vyas Giridhar
none Details | Review
list-model: port to G_DECLARE_* macros. (38.39 KB, patch)
2017-08-29 16:57 UTC, Vyas Giridhar
committed Details | Review
list-model: use macro for type casting (3.83 KB, patch)
2017-08-29 17:50 UTC, Vyas Giridhar
none Details | Review
list-model: use macro for type casting (4.38 KB, patch)
2017-09-01 04:02 UTC, Vyas Giridhar
none Details | Review
list-model: use macro for type casting (4.38 KB, patch)
2017-09-01 04:34 UTC, Vyas Giridhar
committed Details | Review

Description Vyas Giridhar 2017-08-27 17:01:28 UTC
.
Comment 1 Vyas Giridhar 2017-08-27 17:04:41 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.
Comment 2 Ernestas Kulik 2017-08-28 07:25:20 UTC
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.
Comment 3 Vyas Giridhar 2017-08-28 12:00:03 UTC
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.
Comment 4 Ernestas Kulik 2017-08-29 08:47:52 UTC
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.
Comment 5 Vyas Giridhar 2017-08-29 16:57:43 UTC
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.
Comment 6 Vyas Giridhar 2017-08-29 17:50:24 UTC
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.
Comment 7 Ernestas Kulik 2017-08-30 08:28:28 UTC
Review of attachment 358709 [details] [review]:

Cool. In the future, don’t use full stops in the subject line.
Comment 8 Ernestas Kulik 2017-08-30 08:29:28 UTC
Review of attachment 358713 [details] [review]:

Nice.
Comment 9 Ernestas Kulik 2017-08-30 08:33:33 UTC
Review of attachment 358713 [details] [review]:

Patch does not apply. Rebase it on your previous one.
Comment 10 Vyas Giridhar 2017-09-01 04:02:23 UTC
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
Comment 11 Vyas Giridhar 2017-09-01 04:34:20 UTC
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
Comment 12 Ernestas Kulik 2017-09-02 09:16:00 UTC
Review of attachment 358914 [details] [review]:

Sure.
Comment 13 Ernestas Kulik 2017-09-02 09:19:13 UTC
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