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 782204 - nautilus-window:port from old-style type declarations
nautilus-window:port from old-style type declarations
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-05-05 08:01 UTC by Waqar Ahmed
Modified: 2017-05-06 11:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nautilus-window: port to G_DECLARE_DERIVABLE_TYPE declaration (58.19 KB, patch)
2017-05-05 08:08 UTC, Waqar Ahmed
none Details | Review
nautilus-window: port to G_DECLARE_*_TYPE decl (59.32 KB, patch)
2017-05-05 09:48 UTC, Waqar Ahmed
none Details | Review
nautilus-window: port to G_DECLARE_*_TYPE decl (55.96 KB, patch)
2017-05-05 14:59 UTC, Waqar Ahmed
committed Details | Review

Description Waqar Ahmed 2017-05-05 08:01:45 UTC
Port to G_DECLARE_*_TYPE Style Decls
Comment 1 Waqar Ahmed 2017-05-05 08:08:13 UTC
Created attachment 351161 [details] [review]
nautilus-window: port to G_DECLARE_DERIVABLE_TYPE declaration

nautilus-window: port to G_DECLARE_DERIVABLE_TYPE declaration
Comment 2 Ernestas Kulik 2017-05-05 08:25:42 UTC
Review of attachment 351161 [details] [review]:

It seems that you attached a raw diff.

Follow https://wiki.gnome.org/Newcomers/SubmitPatch for a guide on how to submit patches.

The code looks fine overall, but it’ll be easier to review the actual changes after you’ve separated unrelated ones.

::: src/nautilus-window.c
@@ +71,2 @@
 /* Forward and back buttons on the mouse */
+

Whitespace.

@@ +141,3 @@
     guint sidebar_width_handler_id;
     guint bookmarks_id;
+}NautilusWindowPrivate;

Leave a space after the closing brace.

@@ +2338,3 @@
     window = NAUTILUS_WINDOW (object);
 
+    NautilusWindowPrivate *priv = nautilus_window_get_instance_private(window);

Leave a space before the opening parenthesis.

@@ +2596,3 @@
 {
     g_assert (NAUTILUS_IS_WINDOW (window));
+    NautilusWindowPrivate *priv = nautilus_window_get_instance_private(window);

Variable declarations go before code.

::: src/nautilus-window.h
@@ +63,3 @@
+};
+
+

Don’t move things around for no reason, please.

@@ +110,3 @@
                                                guint           distance,
                                                NautilusWindowOpenFlags flags);
+

Left some whitespace here.

@@ +113,2 @@
 void nautilus_window_hide_view_menu (NautilusWindow *window);
+void nautilus_window_reset_menus    (NautilusWindow *window);

It’s nice that you do this, but do style changes separately.
Comment 3 Waqar Ahmed 2017-05-05 09:48:44 UTC
Created attachment 351169 [details] [review]
nautilus-window: port to G_DECLARE_*_TYPE decl

This patch ports the manual definition of macros to G_Declare type
declaration, which makes the code cleaner and easier to read and 
understand.
Comment 4 Ernestas Kulik 2017-05-05 14:13:50 UTC
Review of attachment 351169 [details] [review]:

Thanks for working on this. :)

We’ll work on the style now (and other nits to be picked).

::: src/nautilus-window.c
@@ +158,3 @@
 static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 
+G_DEFINE_TYPE_WITH_PRIVATE (NautilusWindow, nautilus_window, GTK_TYPE_APPLICATION_WINDOW)

Unrelated change.

@@ +363,3 @@
                   gpointer       user_data)
 {
+    NautilusWindow *window = user_data;

Why remove the cast?

@@ +442,3 @@
 on_location_changed (NautilusWindow *window)
 {
+    NautilusWindowPrivate *priv = nautilus_window_get_instance_private (window);

Leave some vertical space between declarations and code. Keep the style consistent.

@@ +552,3 @@
                                  NautilusWindowOpenFlags  flags)
 {
+    NautilusWindowPrivate *priv = nautilus_window_get_instance_private (window);

The assignment would probably make more sense after the assertions. We tend to follow the C89 convention of separating declarations, assignments and code, so you might want to do the same in the rest of the places.

@@ +558,2 @@
     connect_slot (window, slot);
+    g_signal_handlers_block_by_func (priv->notebook,

Try not to remove vertical spaces.

::: src/nautilus-window.h
@@ +49,3 @@
 #include "nautilus-window-slot.h"
 
+struct _NautilusWindowClass {

Opening brace goes to a new line.

@@ +66,3 @@
+                                                 GFile *location,
+                                                 GError *error,
+                                                 gpointer user_data);

Why move this?

@@ +92,3 @@
                                                        NautilusWindowSlot      *target_slot);
 
+void                 nautilus_window_new_tab               (NautilusWindow    *window);

Unrelated change.

@@ +108,3 @@
                                                guint           distance,
                                                NautilusWindowOpenFlags flags);
+

Left some trailing whitespace here.

@@ +111,2 @@
 void nautilus_window_hide_view_menu (NautilusWindow *window);
+void nautilus_window_reset_menus    (NautilusWindow *window);

Unrelated change.

@@ +125,3 @@
+				       NautilusWindowSlot *slot);
+void nautilus_window_sync_title       (NautilusWindow *window,
+				       NautilusWindowSlot *slot);

Also unrelated.

@@ +136,3 @@
+                                      GdkDragContext *context);
+void nautilus_window_search          (NautilusWindow *window,
+                                      const gchar    *text);

Unrelated as well.
Comment 5 Waqar Ahmed 2017-05-05 14:59:40 UTC
Created attachment 351205 [details] [review]
nautilus-window: port to G_DECLARE_*_TYPE decl

This patch ports the manual definition of macros to G_Declare type
declaration, which makes the code cleaner and easier to read and 
understand.
Comment 6 Ernestas Kulik 2017-05-06 11:00:05 UTC
Review of attachment 351205 [details] [review]:

Thanks!
Comment 7 Ernestas Kulik 2017-05-06 11:51:58 UTC
Attachment 351205 [details] pushed as ff7e8f7 - window: port to G_DECLARE_*_TYPE decl