[libgit2-glib] Port GgitCommitParent to G_DECLARE_FINAL_TYPE macro
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Port GgitCommitParent to G_DECLARE_FINAL_TYPE macro
- Date: Thu, 16 Jul 2015 15:47:29 +0000 (UTC)
commit ac6efcbbfc5f18deb809b0e641581cc5f452b189
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Jul 16 17:23:21 2015 +0200
Port GgitCommitParent to G_DECLARE_FINAL_TYPE macro
libgit2-glib/ggit-autocleanup.h | 1 -
libgit2-glib/ggit-commit-parents.c | 30 ++++++++++++++++--------------
libgit2-glib/ggit-commit-parents.h | 36 ++++--------------------------------
libgit2-glib/ggit-commit.h | 1 +
libgit2-glib/ggit-types.h | 7 -------
5 files changed, 21 insertions(+), 54 deletions(-)
---
diff --git a/libgit2-glib/ggit-autocleanup.h b/libgit2-glib/ggit-autocleanup.h
index 0533aa0..1c36720 100644
--- a/libgit2-glib/ggit-autocleanup.h
+++ b/libgit2-glib/ggit-autocleanup.h
@@ -58,7 +58,6 @@ G_BEGIN_DECLS
#if GLIB_CHECK_VERSION (2, 44, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitCherryPickOptions, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitCommitParents, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitCred, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitCredPlaintext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitCredSshInteractive, g_object_unref)
diff --git a/libgit2-glib/ggit-commit-parents.c b/libgit2-glib/ggit-commit-parents.c
index 7d5cac1..106e724 100644
--- a/libgit2-glib/ggit-commit-parents.c
+++ b/libgit2-glib/ggit-commit-parents.c
@@ -1,5 +1,5 @@
/*
- * ggit-commit.c
+ * ggit-commit-parents.c
* This file is part of libgit2-glib
*
* Copyright (C) 2014 - Jesse van den Kieboom
@@ -24,10 +24,15 @@
#include "ggit-commit.h"
#include "ggit-oid.h"
-#define GGIT_COMMIT_PARENTS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object),
GGIT_TYPE_COMMIT_PARENTS, GgitCommitParentsPrivate))
-
-struct _GgitCommitParentsPrivate
+/**
+ * GgitCommitParents:
+ *
+ * Represents the parents of a commit object.
+ */
+struct _GgitCommitParents
{
+ GObject parent_instance;
+
GgitCommit *commit;
};
@@ -51,7 +56,7 @@ ggit_commit_parents_get_property (GObject *object,
switch (prop_id)
{
case PROP_COMMIT:
- g_value_set_object (value, parents->priv->commit);
+ g_value_set_object (value, parents->commit);
break;
case PROP_SIZE:
g_value_set_uint (value, ggit_commit_parents_get_size (parents));
@@ -68,12 +73,12 @@ ggit_commit_parents_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GgitCommitParentsPrivate *priv = GGIT_COMMIT_PARENTS (object)->priv;
+ GgitCommitParents *parents = GGIT_COMMIT_PARENTS (object);
switch (prop_id)
{
case PROP_COMMIT:
- priv->commit = g_value_dup_object (value);
+ parents->commit = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -92,7 +97,7 @@ ggit_commit_parents_finalize (GObject *object)
{
GgitCommitParents *parents = GGIT_COMMIT_PARENTS (object);
- g_object_unref (parents->priv->commit);
+ g_object_unref (parents->commit);
G_OBJECT_CLASS (ggit_commit_parents_parent_class)->finalize (object);
}
@@ -126,14 +131,11 @@ ggit_commit_parents_class_init (GgitCommitParentsClass *klass)
0,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
-
- g_type_class_add_private (object_class, sizeof (GgitCommitParentsPrivate));
}
static void
ggit_commit_parents_init (GgitCommitParents *self)
{
- self->priv = GGIT_COMMIT_PARENTS_GET_PRIVATE (self);
}
/**
@@ -152,7 +154,7 @@ ggit_commit_parents_get_size (GgitCommitParents *parents)
g_return_val_if_fail (GGIT_IS_COMMIT_PARENTS (parents), 0);
- c = _ggit_native_get (parents->priv->commit);
+ c = _ggit_native_get (parents->commit);
return (guint)git_commit_parentcount (c);
}
@@ -175,7 +177,7 @@ ggit_commit_parents_get (GgitCommitParents *parents,
g_return_val_if_fail (GGIT_IS_COMMIT_PARENTS (parents), NULL);
- c = _ggit_native_get (parents->priv->commit);
+ c = _ggit_native_get (parents->commit);
if (git_commit_parent (&p, c, idx) == GIT_OK)
{
@@ -204,7 +206,7 @@ ggit_commit_parents_get_id (GgitCommitParents *parents,
g_return_val_if_fail (GGIT_IS_COMMIT_PARENTS (parents), NULL);
- c = _ggit_native_get (parents->priv->commit);
+ c = _ggit_native_get (parents->commit);
oid = git_commit_parent_id (c, idx);
return _ggit_oid_wrap (oid);
diff --git a/libgit2-glib/ggit-commit-parents.h b/libgit2-glib/ggit-commit-parents.h
index 766890b..c21e184 100644
--- a/libgit2-glib/ggit-commit-parents.h
+++ b/libgit2-glib/ggit-commit-parents.h
@@ -1,5 +1,5 @@
/*
- * ggit-commit.h
+ * ggit-commit-parents.h
* This file is part of libgit2-glib
*
* Copyright (C) 2014 - Jesse van den Kieboom
@@ -25,42 +25,14 @@
#include <glib-object.h>
#include <libgit2-glib/ggit-types.h>
-#include <libgit2-glib/ggit-commit.h>
G_BEGIN_DECLS
-#define GGIT_TYPE_COMMIT_PARENTS (ggit_commit_parents_get_type ())
-#define GGIT_COMMIT_PARENTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGIT_TYPE_COMMIT_PARENTS,
GgitCommitParents))
-#define GGIT_COMMIT_PARENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGIT_TYPE_COMMIT_PARENTS,
GgitCommitParentsClass))
-#define GGIT_IS_COMMIT_PARENTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGIT_TYPE_COMMIT_PARENTS))
-#define GGIT_IS_COMMIT_PARENTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGIT_TYPE_COMMIT_PARENTS))
-#define GGIT_COMMIT_PARENTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GGIT_TYPE_COMMIT_PARENTS,
GgitCommitParentsClass))
-
-typedef struct _GgitCommitParentsClass GgitCommitParentsClass;
-typedef struct _GgitCommitParentsPrivate GgitCommitParentsPrivate;
-
-struct _GgitCommitParents
-{
- /*< private >*/
- GObject parent;
-
- /* priv padding */
- GgitCommitParentsPrivate *priv;
-};
+typedef struct _GgitCommit GgitCommit;
-/**
- * GgitCommitParentsClass:
- * @parent_class: The parent class.
- *
- * The class structure for #GgitCommitParentClass.
- */
-struct _GgitCommitParentsClass
-{
- /*< private >*/
- GObjectClass parent_class;
-};
+#define GGIT_TYPE_COMMIT_PARENTS (ggit_commit_parents_get_type ())
+G_DECLARE_FINAL_TYPE (GgitCommitParents, ggit_commit_parents, GGIT, COMMIT_PARENTS, GObject)
-GType ggit_commit_parents_get_type (void) G_GNUC_CONST;
GgitCommitParents *ggit_commit_parents_new (GgitCommit *commit);
guint ggit_commit_parents_get_size (GgitCommitParents *parents);
diff --git a/libgit2-glib/ggit-commit.h b/libgit2-glib/ggit-commit.h
index 4439fd7..b1c32f5 100644
--- a/libgit2-glib/ggit-commit.h
+++ b/libgit2-glib/ggit-commit.h
@@ -28,6 +28,7 @@
#include <libgit2-glib/ggit-object.h>
#include <libgit2-glib/ggit-types.h>
#include <libgit2-glib/ggit-tree.h>
+#include <libgit2-glib/ggit-commit-parents.h>
G_BEGIN_DECLS
diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 6574343..ce36ccc 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -40,13 +40,6 @@ typedef struct _GgitBranchEnumerator GgitBranchEnumerator;
typedef struct _GgitCloneOptions GgitCloneOptions;
/**
- * GgitCommitParents:
- *
- * Represents the parents of a commit object.
- */
-typedef struct _GgitCommitParents GgitCommitParents;
-
-/**
* GgitConfigEntry:
*
* Represents a git configuration entry.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]