From 8411d8cd9666161c10da257f2bdb8fee8fb8cb81 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:12:31 +0100 Subject: [PATCH] build: bump glib2 to 2.38 for G_ADD_PRIVATE While at it, use a single variable for glib, gio and gobject --- meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index c19073b..c7459a5 100644 --- a/meson.build +++ b/meson.build @@ -17,9 +17,11 @@ pkgconfig = import('pkgconfig') enable_gir = get_option('enable-introspection') enable_gtkdoc = get_option('enable-gtk-doc') -gio_dep = dependency('gio-2.0', version: '>= 2.36') -glib_dep = dependency('glib-2.0', version: '>= 2.36') -gobject_dep = dependency('gobject-2.0', version: '>= 2.36') +glib2_required = '>= 2.38' + +gio_dep = dependency('gio-2.0', version: glib2_required) +glib_dep = dependency('glib-2.0', version: glib2_required) +gobject_dep = dependency('gobject-2.0', version: glib2_required) sqlite3_dep = dependency('sqlite3', version: '>= 3.7') gdkpixbuf_dep = dependency('gdk-pixbuf-2.0') -- GitLab From 1b8245d4f89464dfc72b6248ff120ac30e76d77b Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 22:51:47 +0100 Subject: [PATCH] tests: use G_ADD_PRIVATE for type definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes several of the following: > ../tests/test-gom-transform.c:170:3: warning: ‘g_type_class_add_private’ is deprecated [-Wdeprecated-declarations] > 170 | g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); > | ^~~~~~~~~~~~~~~~~~~~~~~~ --- tests/test-gom-constraints.c | 7 ++----- tests/test-gom-datetime.c | 7 ++----- tests/test-gom-find-specific.c | 7 ++----- tests/test-gom-find.c | 7 ++----- tests/test-gom-insert.c | 14 ++++---------- tests/test-gom-migration.c | 14 ++++---------- tests/test-gom-sorting.c | 7 ++----- tests/test-gom-stress.c | 7 ++----- tests/test-gom-table-name.c | 7 ++----- tests/test-gom-transform.c | 7 ++----- tests/test-gom-update.c | 7 ++----- 11 files changed, 26 insertions(+), 65 deletions(-) diff --git a/tests/test-gom-constraints.c b/tests/test-gom-constraints.c index b421b24..d706a36 100644 --- a/tests/test-gom-constraints.c +++ b/tests/test-gom-constraints.c @@ -29,7 +29,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -106,7 +106,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; object_class->finalize = item_resource_finalize; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -135,9 +134,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-datetime.c b/tests/test-gom-datetime.c index 77ad4d3..bfca8b0 100644 --- a/tests/test-gom-datetime.c +++ b/tests/test-gom-datetime.c @@ -39,7 +39,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) static GParamSpec *item_specs[LAST_PROP]; @@ -117,7 +117,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -151,9 +150,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-find-specific.c b/tests/test-gom-find-specific.c index 35cfd13..267b143 100644 --- a/tests/test-gom-find-specific.c +++ b/tests/test-gom-find-specific.c @@ -42,7 +42,7 @@ typedef struct GType episode_resource_get_type(void); -G_DEFINE_TYPE(EpisodeResource, episode_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(EpisodeResource, episode_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -159,7 +159,6 @@ episode_resource_class_init (EpisodeResourceClass *klass) object_class->finalize = episode_resource_finalize; object_class->get_property = episode_resource_get_property; object_class->set_property = episode_resource_set_property; - g_type_class_add_private(object_class, sizeof(EpisodeResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "episodes"); @@ -209,9 +208,7 @@ episode_resource_class_init (EpisodeResourceClass *klass) static void episode_resource_init (EpisodeResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - EPISODE_TYPE_RESOURCE, - EpisodeResourcePrivate); + resource->priv = episode_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-find.c b/tests/test-gom-find.c index aed010e..4544d10 100644 --- a/tests/test-gom-find.c +++ b/tests/test-gom-find.c @@ -33,7 +33,7 @@ typedef struct { GType bookmarks_resource_get_type(void); -G_DEFINE_TYPE(BookmarksResource, bookmarks_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(BookmarksResource, bookmarks_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -130,7 +130,6 @@ bookmarks_resource_class_init (BookmarksResourceClass *klass) object_class->finalize = bookmarks_resource_finalize; object_class->get_property = bookmarks_resource_get_property; object_class->set_property = bookmarks_resource_set_property; - g_type_class_add_private(object_class, sizeof(BookmarksResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "bookmarks"); @@ -184,9 +183,7 @@ bookmarks_resource_class_init (BookmarksResourceClass *klass) static void bookmarks_resource_init (BookmarksResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - BOOKMARKS_TYPE_RESOURCE, - BookmarksResourcePrivate); + resource->priv = bookmarks_resource_get_instance_private(resource); } #if 0 diff --git a/tests/test-gom-insert.c b/tests/test-gom-insert.c index 7b91f3c..26e0f93 100644 --- a/tests/test-gom-insert.c +++ b/tests/test-gom-insert.c @@ -37,7 +37,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) static GParamSpec *item_specs[LAST_PROP]; @@ -109,7 +109,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -143,9 +142,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } /* Item2Resource object */ @@ -174,7 +171,7 @@ typedef struct { GType item2_resource_get_type(void); -G_DEFINE_TYPE(Item2Resource, item2_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(Item2Resource, item2_resource, GOM_TYPE_RESOURCE) static GParamSpec *item2_specs[LAST_PROP]; @@ -244,7 +241,6 @@ item2_resource_class_init (Item2ResourceClass *klass) object_class->finalize = item2_resource_finalize; object_class->get_property = item2_resource_get_property; object_class->set_property = item2_resource_set_property; - g_type_class_add_private(object_class, sizeof(Item2ResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -278,9 +274,7 @@ item2_resource_class_init (Item2ResourceClass *klass) static void item2_resource_init (Item2Resource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM2_TYPE_RESOURCE, - Item2ResourcePrivate); + resource->priv = item2_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-migration.c b/tests/test-gom-migration.c index 2dea73b..4f0540d 100644 --- a/tests/test-gom-migration.c +++ b/tests/test-gom-migration.c @@ -48,7 +48,7 @@ struct _SeriesResourceClass GType series_resource_get_type (void); -G_DEFINE_TYPE (SeriesResource, series_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE (SeriesResource, series_resource, GOM_TYPE_RESOURCE) enum { PROP_SERIES_0, @@ -138,7 +138,6 @@ series_resource_class_init (SeriesResourceClass *klass) object_class->finalize = series_resource_finalize; object_class->get_property = series_resource_get_property; object_class->set_property = series_resource_set_property; - g_type_class_add_private(object_class, sizeof(SeriesResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, SERIES_TABLE_NAME); @@ -186,9 +185,7 @@ series_resource_class_init (SeriesResourceClass *klass) static void series_resource_init (SeriesResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - SERIES_TYPE_RESOURCE, - SeriesResourcePrivate); + resource->priv = series_resource_get_instance_private(resource); } /* BookmarksResource object */ @@ -219,7 +216,7 @@ typedef struct { GType bookmarks_resource_get_type(void); -G_DEFINE_TYPE(BookmarksResource, bookmarks_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(BookmarksResource, bookmarks_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -307,7 +304,6 @@ bookmarks_resource_class_init (BookmarksResourceClass *klass) object_class->finalize = bookmarks_resource_finalize; object_class->get_property = bookmarks_resource_get_property; object_class->set_property = bookmarks_resource_set_property; - g_type_class_add_private(object_class, sizeof(BookmarksResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "bookmarks"); @@ -351,9 +347,7 @@ bookmarks_resource_class_init (BookmarksResourceClass *klass) static void bookmarks_resource_init (BookmarksResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - BOOKMARKS_TYPE_RESOURCE, - BookmarksResourcePrivate); + resource->priv = bookmarks_resource_get_instance_private(resource); } #if 0 diff --git a/tests/test-gom-sorting.c b/tests/test-gom-sorting.c index a20a368..250bc6f 100644 --- a/tests/test-gom-sorting.c +++ b/tests/test-gom-sorting.c @@ -34,7 +34,7 @@ typedef struct GType episode_resource_get_type(void); -G_DEFINE_TYPE(EpisodeResource, episode_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(EpisodeResource, episode_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -151,7 +151,6 @@ episode_resource_class_init (EpisodeResourceClass *klass) object_class->finalize = episode_resource_finalize; object_class->get_property = episode_resource_get_property; object_class->set_property = episode_resource_set_property; - g_type_class_add_private(object_class, sizeof(EpisodeResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "episodes"); @@ -194,9 +193,7 @@ episode_resource_class_init (EpisodeResourceClass *klass) static void episode_resource_init (EpisodeResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - EPISODE_TYPE_RESOURCE, - EpisodeResourcePrivate); + resource->priv = episode_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-stress.c b/tests/test-gom-stress.c index 3f62bca..f86b682 100644 --- a/tests/test-gom-stress.c +++ b/tests/test-gom-stress.c @@ -27,7 +27,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -108,7 +108,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -142,9 +141,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-table-name.c b/tests/test-gom-table-name.c index d17f661..8c4d1d8 100644 --- a/tests/test-gom-table-name.c +++ b/tests/test-gom-table-name.c @@ -33,7 +33,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) static GParamSpec *item_specs[LAST_PROP]; @@ -103,7 +103,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); /* Invalid table name */ @@ -138,9 +137,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static void diff --git a/tests/test-gom-transform.c b/tests/test-gom-transform.c index 5a452ba..5ce9556 100644 --- a/tests/test-gom-transform.c +++ b/tests/test-gom-transform.c @@ -30,7 +30,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) enum { PROP_0, @@ -167,7 +167,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -218,9 +217,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static gboolean diff --git a/tests/test-gom-update.c b/tests/test-gom-update.c index 4b4065f..a7caf64 100644 --- a/tests/test-gom-update.c +++ b/tests/test-gom-update.c @@ -37,7 +37,7 @@ typedef struct { GType item_resource_get_type(void); -G_DEFINE_TYPE(ItemResource, item_resource, GOM_TYPE_RESOURCE) +G_DEFINE_TYPE_WITH_PRIVATE(ItemResource, item_resource, GOM_TYPE_RESOURCE) static GParamSpec *item_specs[LAST_PROP]; @@ -109,7 +109,6 @@ item_resource_class_init (ItemResourceClass *klass) object_class->finalize = item_resource_finalize; object_class->get_property = item_resource_get_property; object_class->set_property = item_resource_set_property; - g_type_class_add_private(object_class, sizeof(ItemResourcePrivate)); resource_class = GOM_RESOURCE_CLASS(klass); gom_resource_class_set_table(resource_class, "items"); @@ -143,9 +142,7 @@ item_resource_class_init (ItemResourceClass *klass) static void item_resource_init (ItemResource *resource) { - resource->priv = G_TYPE_INSTANCE_GET_PRIVATE(resource, - ITEM_TYPE_RESOURCE, - ItemResourcePrivate); + resource->priv = item_resource_get_instance_private(resource); } static void -- GitLab From feb9e661b19372efa45975330cb3b6d3c44ed6cb Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:31:45 +0100 Subject: [PATCH] gom: resource: use G_ADD_PRIVATE for type definition The G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE call was moved as it needs to know the storage size of private structure. --- gom/gom-resource.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-resource.c b/gom/gom-resource.c index f0c5d6a..0e86bae 100644 --- a/gom/gom-resource.c +++ b/gom/gom-resource.c @@ -28,14 +28,14 @@ #include "gom-resource-priv.h" #include "reserved-keywords.h" -G_DEFINE_ABSTRACT_TYPE(GomResource, gom_resource, G_TYPE_OBJECT) - struct _GomResourcePrivate { GomRepository *repository; gboolean is_from_table; }; +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GomResource, gom_resource, G_TYPE_OBJECT) + enum { PROP_0, @@ -1094,7 +1094,6 @@ gom_resource_class_init (GomResourceClass *klass) object_class->get_property = gom_resource_get_property; object_class->set_property = gom_resource_set_property; object_class->constructed = gom_resource_constructed; - g_type_class_add_private(object_class, sizeof(GomResourcePrivate)); gParamSpecs[PROP_REPOSITORY] = g_param_spec_object("repository", @@ -1115,10 +1114,7 @@ gom_resource_class_init (GomResourceClass *klass) static void gom_resource_init (GomResource *resource) { - resource->priv = - G_TYPE_INSTANCE_GET_PRIVATE(resource, - GOM_TYPE_RESOURCE, - GomResourcePrivate); + resource->priv = gom_resource_get_instance_private(resource); } gboolean -- GitLab From 269598babac74c6ff1060c30fd5078e83388403a Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:38:08 +0100 Subject: [PATCH] gom: adapter: 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-adapter.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-adapter.c b/gom/gom-adapter.c index f3fae36..e413688 100644 --- a/gom/gom-adapter.c +++ b/gom/gom-adapter.c @@ -22,8 +22,6 @@ #include "gom-command.h" #include "gom-error.h" -G_DEFINE_TYPE(GomAdapter, gom_adapter, G_TYPE_OBJECT) - struct _GomAdapterPrivate { sqlite3 *db; @@ -31,6 +29,8 @@ struct _GomAdapterPrivate GAsyncQueue *queue; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomAdapter, gom_adapter, G_TYPE_OBJECT) + typedef enum { ASYNC_CMD_TYPE_OPEN, ASYNC_CMD_TYPE_READ, @@ -506,7 +506,6 @@ gom_adapter_class_init (GomAdapterClass *klass) object_class = G_OBJECT_CLASS(klass); object_class->finalize = gom_adapter_finalize; - g_type_class_add_private(object_class, sizeof(GomAdapterPrivate)); } /** @@ -518,8 +517,5 @@ gom_adapter_class_init (GomAdapterClass *klass) static void gom_adapter_init (GomAdapter *adapter) { - adapter->priv = - G_TYPE_INSTANCE_GET_PRIVATE(adapter, - GOM_TYPE_ADAPTER, - GomAdapterPrivate); + adapter->priv = gom_adapter_get_instance_private(adapter); } -- GitLab From 568a5c9e44896226babd9acb7318892be4523270 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:40:59 +0100 Subject: [PATCH] gom: command-builder: 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-command-builder.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-command-builder.c b/gom/gom-command-builder.c index 4fc2723..d4ee21f 100644 --- a/gom/gom-command-builder.c +++ b/gom/gom-command-builder.c @@ -24,8 +24,6 @@ #include "gom-resource-priv.h" #include "gom-sorting.h" -G_DEFINE_TYPE(GomCommandBuilder, gom_command_builder, G_TYPE_OBJECT) - struct _GomCommandBuilderPrivate { GomAdapter *adapter; @@ -38,6 +36,8 @@ struct _GomCommandBuilderPrivate GType m2m_type; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomCommandBuilder, gom_command_builder, G_TYPE_OBJECT) + enum { PROP_0, @@ -1027,7 +1027,6 @@ gom_command_builder_class_init (GomCommandBuilderClass *klass) object_class->finalize = gom_command_builder_finalize; object_class->get_property = gom_command_builder_get_property; object_class->set_property = gom_command_builder_set_property; - g_type_class_add_private(object_class, sizeof(GomCommandBuilderPrivate)); gParamSpecs[PROP_ADAPTER] = g_param_spec_object("adapter", @@ -1115,8 +1114,5 @@ gom_command_builder_class_init (GomCommandBuilderClass *klass) static void gom_command_builder_init (GomCommandBuilder *builder) { - builder->priv = - G_TYPE_INSTANCE_GET_PRIVATE(builder, - GOM_TYPE_COMMAND_BUILDER, - GomCommandBuilderPrivate); + builder->priv = gom_command_builder_get_instance_private(builder); } -- GitLab From 370ba2dd6c47b9ec3fd0c3da168fad9b4bddb829 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:44:26 +0100 Subject: [PATCH] gom: cursor: 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-cursor.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-cursor.c b/gom/gom-cursor.c index 6ffdc28..963c201 100644 --- a/gom/gom-cursor.c +++ b/gom/gom-cursor.c @@ -21,14 +21,14 @@ #include "gom-cursor.h" -G_DEFINE_TYPE(GomCursor, gom_cursor, G_TYPE_OBJECT) - struct _GomCursorPrivate { sqlite3_stmt *stmt; guint n_columns; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomCursor, gom_cursor, G_TYPE_OBJECT) + enum { PROP_0, @@ -292,7 +292,6 @@ gom_cursor_class_init (GomCursorClass *klass) object_class->finalize = gom_cursor_finalize; object_class->get_property = gom_cursor_get_property; object_class->set_property = gom_cursor_set_property; - g_type_class_add_private(object_class, sizeof(GomCursorPrivate)); gParamSpecs[PROP_STATEMENT] = g_param_spec_pointer("statement", @@ -312,8 +311,5 @@ gom_cursor_class_init (GomCursorClass *klass) static void gom_cursor_init (GomCursor *cursor) { - cursor->priv = - G_TYPE_INSTANCE_GET_PRIVATE(cursor, - GOM_TYPE_CURSOR, - GomCursorPrivate); + cursor->priv = gom_cursor_get_instance_private(cursor); } -- GitLab From d26a07cdc8617d1cc4b802ae0a81140488fca275 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:48:35 +0100 Subject: [PATCH] gom: command: 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-command.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-command.c b/gom/gom-command.c index abad299..8824420 100644 --- a/gom/gom-command.c +++ b/gom/gom-command.c @@ -23,8 +23,6 @@ #include "gom-command.h" #include "gom-error.h" -G_DEFINE_TYPE(GomCommand, gom_command, G_TYPE_OBJECT) - struct _GomCommandPrivate { GomAdapter *adapter; @@ -35,6 +33,8 @@ struct _GomCommandPrivate GPtrArray *blobs; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomCommand, gom_command, G_TYPE_OBJECT) + enum { PROP_0, @@ -545,7 +545,6 @@ gom_command_class_init (GomCommandClass *klass) object_class->finalize = gom_command_finalize; object_class->get_property = gom_command_get_property; object_class->set_property = gom_command_set_property; - g_type_class_add_private(object_class, sizeof(GomCommandPrivate)); gParamSpecs[PROP_ADAPTER] = g_param_spec_object("adapter", @@ -575,9 +574,6 @@ gom_command_class_init (GomCommandClass *klass) static void gom_command_init (GomCommand *command) { - command->priv = - G_TYPE_INSTANCE_GET_PRIVATE(command, - GOM_TYPE_COMMAND, - GomCommandPrivate); + command->priv = gom_command_get_instance_private(command); command->priv->blobs = g_ptr_array_new_with_free_func ((GDestroyNotify) g_bytes_unref); } -- GitLab From fd3a992cc23a1bef6336b72c507fb06224ebfb96 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:50:47 +0100 Subject: [PATCH] gom: filter: 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-filter.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-filter.c b/gom/gom-filter.c index 5e9618a..43085cf 100644 --- a/gom/gom-filter.c +++ b/gom/gom-filter.c @@ -21,8 +21,6 @@ #include "gom-filter.h" #include "gom-resource.h" -G_DEFINE_TYPE(GomFilter, gom_filter, G_TYPE_INITIALLY_UNOWNED) - struct _GomFilterPrivate { GomFilterMode mode; @@ -37,6 +35,8 @@ struct _GomFilterPrivate GQueue *subfilters; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomFilter, gom_filter, G_TYPE_INITIALLY_UNOWNED) + enum { PROP_0, @@ -696,7 +696,6 @@ gom_filter_class_init (GomFilterClass *klass) object_class->finalize = gom_filter_finalize; object_class->get_property = gom_filter_get_property; object_class->set_property = gom_filter_set_property; - g_type_class_add_private(object_class, sizeof(GomFilterPrivate)); gParamSpecs[PROP_MODE] = g_param_spec_enum("mode", @@ -727,10 +726,7 @@ gom_filter_class_init (GomFilterClass *klass) static void gom_filter_init (GomFilter *filter) { - filter->priv = - G_TYPE_INSTANCE_GET_PRIVATE(filter, - GOM_TYPE_FILTER, - GomFilterPrivate); + filter->priv = gom_filter_get_instance_private(filter); filter->priv->mode = GOM_FILTER_SQL; } -- GitLab From b86542ad0e19ba627e0b553c6a7a4455c66447a5 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:54:02 +0100 Subject: [PATCH] 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(); } -- GitLab From 05b33cc1238d4f4460cd3e79df37ffc5f9900972 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:56:01 +0100 Subject: [PATCH] gom: resource-group: 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-resource-group.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-resource-group.c b/gom/gom-resource-group.c index 97dc44e..b168c70 100644 --- a/gom/gom-resource-group.c +++ b/gom/gom-resource-group.c @@ -27,8 +27,6 @@ #include "gom-resource-group.h" #include "gom-sorting.h" -G_DEFINE_TYPE(GomResourceGroup, gom_resource_group, G_TYPE_OBJECT) - struct _GomResourceGroupPrivate { GomRepository *repository; @@ -47,6 +45,8 @@ struct _GomResourceGroupPrivate GPtrArray *to_write; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomResourceGroup, gom_resource_group, G_TYPE_OBJECT) + enum { PROP_0, @@ -1007,7 +1007,6 @@ gom_resource_group_class_init (GomResourceGroupClass *klass) object_class->finalize = gom_resource_group_finalize; object_class->get_property = gom_resource_group_get_property; object_class->set_property = gom_resource_group_set_property; - g_type_class_add_private(object_class, sizeof(GomResourceGroupPrivate)); gParamSpecs[PROP_COUNT] = g_param_spec_uint("count", @@ -1093,8 +1092,5 @@ gom_resource_group_class_init (GomResourceGroupClass *klass) static void gom_resource_group_init (GomResourceGroup *group) { - group->priv = - G_TYPE_INSTANCE_GET_PRIVATE(group, - GOM_TYPE_RESOURCE_GROUP, - GomResourceGroupPrivate); + group->priv = gom_resource_group_get_instance_private(group); } -- GitLab From e56d36c285938d9825ffc5b3b8fe2d2b86b73346 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Mon, 17 Feb 2020 23:57:49 +0100 Subject: [PATCH] gom: repository: 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-repository.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gom/gom-repository.c b/gom/gom-repository.c index 2f52ff7..0f765a2 100644 --- a/gom/gom-repository.c +++ b/gom/gom-repository.c @@ -22,13 +22,13 @@ #include "gom-error.h" #include "gom-repository.h" -G_DEFINE_TYPE(GomRepository, gom_repository, G_TYPE_OBJECT) - struct _GomRepositoryPrivate { GomAdapter *adapter; }; +G_DEFINE_TYPE_WITH_PRIVATE(GomRepository, gom_repository, G_TYPE_OBJECT) + enum { PROP_0, @@ -939,7 +939,6 @@ gom_repository_class_init (GomRepositoryClass *klass) object_class->finalize = gom_repository_finalize; object_class->get_property = gom_repository_get_property; object_class->set_property = gom_repository_set_property; - g_type_class_add_private(object_class, sizeof(GomRepositoryPrivate)); gParamSpecs[PROP_ADAPTER] = g_param_spec_object("adapter", @@ -960,8 +959,5 @@ gom_repository_class_init (GomRepositoryClass *klass) static void gom_repository_init (GomRepository *repository) { - repository->priv = - G_TYPE_INSTANCE_GET_PRIVATE(repository, - GOM_TYPE_REPOSITORY, - GomRepositoryPrivate); + repository->priv = gom_repository_get_instance_private(repository); } -- GitLab