[gom] gom: sorting: use G_ADD_PRIVATE for type definition



commit b86542ad0e19ba627e0b553c6a7a4455c66447a5
Author: Victor Toso <me victortoso com>
Date:   Mon Feb 17 23:54:02 2020 +0100

    gom: sorting: use G_ADD_PRIVATE for type definition
    
    The G_DEFINE_TYPE_WITH_PRIVATE call was moved as it needs to know the
    storage size of private structure.

 gom/gom-sorting.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gom/gom-sorting.c b/gom/gom-sorting.c
index b7b02f5..ede703f 100644
--- a/gom/gom-sorting.c
+++ b/gom/gom-sorting.c
@@ -21,13 +21,13 @@
 #include "gom-sorting.h"
 #include "gom-resource.h"
 
-G_DEFINE_TYPE(GomSorting, gom_sorting, G_TYPE_INITIALLY_UNOWNED)
-
 struct _GomSortingPrivate
 {
    GQueue *order_by_terms;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE(GomSorting, gom_sorting, G_TYPE_INITIALLY_UNOWNED)
+
 typedef struct GomOrderByTerm
 {
    GParamSpec *pspec;
@@ -59,15 +59,12 @@ gom_sorting_class_init (GomSortingClass *klass)
 
    object_class = G_OBJECT_CLASS(klass);
    object_class->finalize = gom_sorting_finalize;
-
-   g_type_class_add_private(object_class, sizeof(GomSortingPrivate));
 }
 
 static void
 gom_sorting_init (GomSorting *sorting)
 {
-   sorting->priv = G_TYPE_INSTANCE_GET_PRIVATE(sorting, GOM_TYPE_SORTING,
-                                               GomSortingPrivate);
+   sorting->priv = gom_sorting_get_instance_private(sorting);
    sorting->priv->order_by_terms = g_queue_new();
 }
 


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