[gom] gom: cursor: use G_ADD_PRIVATE for type definition
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gom] gom: cursor: use G_ADD_PRIVATE for type definition
- Date: Tue, 18 Feb 2020 15:05:21 +0000 (UTC)
commit 370ba2dd6c47b9ec3fd0c3da168fad9b4bddb829
Author: Victor Toso <me victortoso com>
Date: Mon Feb 17 23:44:26 2020 +0100
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]