[nautilus/wip/antoniof/column-chooser-dialog-rework: 2/3] column-chooser: Move some function definitions




commit 16808e905649541ea55fda1a2c2547b71a942e22
Author: António Fernandes <antoniof gnome org>
Date:   Sun Jul 25 00:00:23 2021 +0100

    column-chooser: Move some function definitions
    
    It's more usual to find the ::class_init() definition near the end,
    and it avoids a large number of forwards declarations.

 src/nautilus-column-chooser.c | 131 ++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 74 deletions(-)
---
diff --git a/src/nautilus-column-chooser.c b/src/nautilus-column-chooser.c
index e2342835f..3412fb1bd 100644
--- a/src/nautilus-column-chooser.c
+++ b/src/nautilus-column-chooser.c
@@ -69,23 +69,6 @@ static guint signals[LAST_SIGNAL];
 
 G_DEFINE_TYPE (NautilusColumnChooser, nautilus_column_chooser, GTK_TYPE_BOX);
 
-static void nautilus_column_chooser_constructed (GObject *object);
-static void view_row_activated_callback (GtkTreeView       *tree_view,
-                                         GtkTreePath       *path,
-                                         GtkTreeViewColumn *column,
-                                         gpointer           user_data);
-static void selection_changed_callback (GtkTreeSelection *selection,
-                                        gpointer          user_data);
-static void visible_toggled_callback (GtkCellRendererToggle *cell,
-                                      char                  *path_string,
-                                      gpointer               user_data);
-static void move_up_clicked_callback (GtkWidget *button,
-                                      gpointer   user_data);
-static void move_down_clicked_callback (GtkWidget *button,
-                                        gpointer   user_data);
-static void use_default_clicked_callback (GtkWidget *button,
-                                          gpointer   user_data);
-
 static void
 nautilus_column_chooser_set_property (GObject      *object,
                                       guint         param_id,
@@ -112,57 +95,6 @@ nautilus_column_chooser_set_property (GObject      *object,
     }
 }
 
-static void
-nautilus_column_chooser_class_init (NautilusColumnChooserClass *chooser_class)
-{
-    GtkWidgetClass *widget_class;
-    GObjectClass *oclass;
-
-    widget_class = GTK_WIDGET_CLASS (chooser_class);
-    oclass = G_OBJECT_CLASS (chooser_class);
-
-    oclass->set_property = nautilus_column_chooser_set_property;
-    oclass->constructed = nautilus_column_chooser_constructed;
-
-    gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-column-chooser.ui");
-    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, view);
-    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, store);
-    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, move_up_button);
-    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, move_down_button);
-    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, use_default_button);
-    gtk_widget_class_bind_template_callback (widget_class, view_row_activated_callback);
-    gtk_widget_class_bind_template_callback (widget_class, selection_changed_callback);
-    gtk_widget_class_bind_template_callback (widget_class, visible_toggled_callback);
-    gtk_widget_class_bind_template_callback (widget_class, move_up_clicked_callback);
-    gtk_widget_class_bind_template_callback (widget_class, move_down_clicked_callback);
-    gtk_widget_class_bind_template_callback (widget_class, use_default_clicked_callback);
-
-    signals[CHANGED] = g_signal_new
-                           ("changed",
-                           G_TYPE_FROM_CLASS (chooser_class),
-                           G_SIGNAL_RUN_LAST,
-                           0, NULL, NULL,
-                           g_cclosure_marshal_VOID__VOID,
-                           G_TYPE_NONE, 0);
-
-    signals[USE_DEFAULT] = g_signal_new
-                               ("use-default",
-                               G_TYPE_FROM_CLASS (chooser_class),
-                               G_SIGNAL_RUN_LAST,
-                               0, NULL, NULL,
-                               g_cclosure_marshal_VOID__VOID,
-                               G_TYPE_NONE, 0);
-
-    g_object_class_install_property (oclass,
-                                     PROP_FILE,
-                                     g_param_spec_object ("file",
-                                                          "File",
-                                                          "The file this column chooser is for",
-                                                          NAUTILUS_TYPE_FILE,
-                                                          G_PARAM_CONSTRUCT_ONLY |
-                                                          G_PARAM_WRITABLE));
-}
-
 static void
 update_buttons (NautilusColumnChooser *chooser)
 {
@@ -395,12 +327,6 @@ nautilus_column_chooser_constructed (GObject *object)
                       G_CALLBACK (row_deleted_callback), chooser);
 }
 
-static void
-nautilus_column_chooser_init (NautilusColumnChooser *chooser)
-{
-    gtk_widget_init_template (GTK_WIDGET (chooser));
-}
-
 static void
 set_visible_columns (NautilusColumnChooser  *chooser,
                      char                  **visible_columns)
@@ -592,6 +518,63 @@ nautilus_column_chooser_get_settings (NautilusColumnChooser   *chooser,
     *column_order = get_column_names (chooser, FALSE);
 }
 
+static void
+nautilus_column_chooser_class_init (NautilusColumnChooserClass *chooser_class)
+{
+    GtkWidgetClass *widget_class;
+    GObjectClass *oclass;
+
+    widget_class = GTK_WIDGET_CLASS (chooser_class);
+    oclass = G_OBJECT_CLASS (chooser_class);
+
+    oclass->set_property = nautilus_column_chooser_set_property;
+    oclass->constructed = nautilus_column_chooser_constructed;
+
+    gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-column-chooser.ui");
+    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, view);
+    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, store);
+    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, move_up_button);
+    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, move_down_button);
+    gtk_widget_class_bind_template_child (widget_class, NautilusColumnChooser, use_default_button);
+    gtk_widget_class_bind_template_callback (widget_class, view_row_activated_callback);
+    gtk_widget_class_bind_template_callback (widget_class, selection_changed_callback);
+    gtk_widget_class_bind_template_callback (widget_class, visible_toggled_callback);
+    gtk_widget_class_bind_template_callback (widget_class, move_up_clicked_callback);
+    gtk_widget_class_bind_template_callback (widget_class, move_down_clicked_callback);
+    gtk_widget_class_bind_template_callback (widget_class, use_default_clicked_callback);
+
+    signals[CHANGED] = g_signal_new
+                           ("changed",
+                           G_TYPE_FROM_CLASS (chooser_class),
+                           G_SIGNAL_RUN_LAST,
+                           0, NULL, NULL,
+                           g_cclosure_marshal_VOID__VOID,
+                           G_TYPE_NONE, 0);
+
+    signals[USE_DEFAULT] = g_signal_new
+                               ("use-default",
+                               G_TYPE_FROM_CLASS (chooser_class),
+                               G_SIGNAL_RUN_LAST,
+                               0, NULL, NULL,
+                               g_cclosure_marshal_VOID__VOID,
+                               G_TYPE_NONE, 0);
+
+    g_object_class_install_property (oclass,
+                                     PROP_FILE,
+                                     g_param_spec_object ("file",
+                                                          "File",
+                                                          "The file this column chooser is for",
+                                                          NAUTILUS_TYPE_FILE,
+                                                          G_PARAM_CONSTRUCT_ONLY |
+                                                          G_PARAM_WRITABLE));
+}
+
+static void
+nautilus_column_chooser_init (NautilusColumnChooser *chooser)
+{
+    gtk_widget_init_template (GTK_WIDGET (chooser));
+}
+
 GtkWidget *
 nautilus_column_chooser_new (NautilusFile *file)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]