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 771929 - search-engine-simple: port to use G_DECLARE* type declarations
search-engine-simple: port to use G_DECLARE* type declarations
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
master
Other Linux
: Normal minor
: ---
Assigned To: Neha Yadav
Nautilus Maintainers
Depends on:
Blocks: 771777
 
 
Reported: 2016-09-25 08:09 UTC by Ernestas Kulik
Modified: 2016-10-08 19:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
search-engine-simple: port to G_DECLARE* type declaration (8.67 KB, patch)
2016-10-07 14:00 UTC, Neha Yadav
none Details | Review
search-engine-simple: port to G_DECLARE* type declaration (8.60 KB, patch)
2016-10-07 18:22 UTC, Neha Yadav
none Details | Review
search-engine-simple: port to G_DECLARE* type declaration (8.57 KB, patch)
2016-10-08 14:21 UTC, Neha Yadav
none Details | Review
search-engine-simple: port to G_DECLARE* type declaration (8.85 KB, patch)
2016-10-08 19:31 UTC, Neha Yadav
committed Details | Review

Description Ernestas Kulik 2016-09-25 08:09:12 UTC
See bug 771777.
Comment 1 Neha Yadav 2016-10-06 20:41:36 UTC
working on it
Comment 2 Neha Yadav 2016-10-07 14:00:00 UTC
Created attachment 337172 [details] [review]
search-engine-simple: port to G_DECLARE* type declaration

Currently we are using the old GObject class declarations, which have two
problems.

One problem is that we cannot use smart pointers like g_autoptr. The other
problem is the boilerplate code generated that makes the code less readable,
so harder to understand.

To fix this use G_DECLARE* type.
Comment 3 Ernestas Kulik 2016-10-07 14:09:43 UTC
Review of attachment 337172 [details] [review]:

Thanks for the patch!

It still needs some work. I have pointed out the things I found wrong with it.

::: src/nautilus-search-engine-simple.c
@@ +545,3 @@
 nautilus_search_engine_simple_init (NautilusSearchEngineSimple *engine)
 {
+    engine = G_TYPE_INSTANCE_GET_PRIVATE (engine, NAUTILUS_TYPE_SEARCH_ENGINE_SIMPLE,

This should be removed altogether.

::: src/nautilus-search-engine-simple.h
@@ +27,1 @@
+#define NAUTILUS_TYPE_SEARCH_ENGINE_SIMPLE		(nautilus_search_engine_simple_get_type ())

No tabs, please.

@@ +29,1 @@
+G_DECLARE_FINAL_TYPE(NautilusSearchEngineSimple, nautilus_search_engine_simple, NAUTILUS, SEARCH_ENGINE_SIMPLE, GObject);

Need a space between the macro name and parens.

@@ -45,1 @@
-NautilusSearchEngineSimple* nautilus_search_engine_simple_new       (void);

This should not be removed.
Comment 4 Ernestas Kulik 2016-10-07 14:13:14 UTC
Some advice to go with the review: build Nautilus with your changes before attaching a patch. Make sure they do not introduce new warnings and the build succeeds.
Comment 5 Neha Yadav 2016-10-07 18:22:36 UTC
Created attachment 337194 [details] [review]
search-engine-simple: port to G_DECLARE* type declaration

Currently we are using the old GObject class declarations, which have two
problems.

One problem is that we cannot use smart pointers like g_autoptr. The other
problem is the boilerplate code generated that makes the code less readable,
so harder to understand.

To fix this use G_DECLARE* type.
Comment 6 Ernestas Kulik 2016-10-07 19:40:11 UTC
Review of attachment 337194 [details] [review]:

Yup, looks good to me now.

Just one thing I need to know.

::: src/nautilus-search-engine-simple.c
@@ +545,3 @@
 nautilus_search_engine_simple_init (NautilusSearchEngineSimple *engine)
 {
+    engine->recursive = TRUE;

Why add this? The property is set to false by default.
Comment 7 Neha Yadav 2016-10-08 14:21:24 UTC
Created attachment 337226 [details] [review]
search-engine-simple: port to G_DECLARE* type declaration

Currently we are using the old GObject class declarations, which have two
problems.

One problem is that we cannot use smart pointers like g_autoptr. The other
problem is the boilerplate code generated that makes the code less readable,
so harder to understand.

To fix this use G_DECLARE* type.
Comment 8 Ernestas Kulik 2016-10-08 15:53:23 UTC
Review of attachment 337226 [details] [review]:

Oops, I missed some things. Sorry about that.

You can also remove query_finished from the struct. Seems to be unused.

::: src/nautilus-search-engine-simple.c
@@ +64,1 @@
 {

Ah, you forgot to add the parent instance field.

@@ +545,2 @@
 nautilus_search_engine_simple_init (NautilusSearchEngineSimple *engine)
 {

query and active_search should be assigned NULL here.
Comment 9 Neha Yadav 2016-10-08 19:31:54 UTC
Created attachment 337253 [details] [review]
search-engine-simple: port to G_DECLARE* type declaration

Currently we are using the old GObject class declarations, which have two
problems.

One problem is that we cannot use smart pointers like g_autoptr. The other
problem is the boilerplate code generated that makes the code less readable,
so harder to understand.

To fix this use G_DECLARE* type.
Comment 10 Ernestas Kulik 2016-10-08 19:38:04 UTC
Review of attachment 337253 [details] [review]:

Solid work. Thanks!
Comment 11 Ernestas Kulik 2016-10-08 19:39:04 UTC
Attachment 337253 [details] pushed as 38e1379 - search-engine-simple: port to G_DECLARE* type declaration