[libgit2-glib] Port GgitRef to G_DECLARE_DERIVABLE_TYPE macro



commit 1e40b1c6b12f04a7e2fd14a350c5df78345183e9
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Jul 14 18:16:28 2015 +0200

    Port GgitRef to G_DECLARE_DERIVABLE_TYPE macro

 libgit2-glib/ggit-autocleanup.h |    2 --
 libgit2-glib/ggit-ref.c         |    6 ++++++
 libgit2-glib/ggit-ref.h         |   21 ++-------------------
 libgit2-glib/ggit-reflog.h      |    1 +
 libgit2-glib/ggit-types.h       |    7 -------
 5 files changed, 9 insertions(+), 28 deletions(-)
---
diff --git a/libgit2-glib/ggit-autocleanup.h b/libgit2-glib/ggit-autocleanup.h
index 2144ab6..996a87f 100644
--- a/libgit2-glib/ggit-autocleanup.h
+++ b/libgit2-glib/ggit-autocleanup.h
@@ -91,11 +91,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitIndexEntryResolveUndo, ggit_index_entry_resol
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitIndex, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitMergeOptions, ggit_merge_options_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitNote, ggit_note_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitObject, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitOId, ggit_oid_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitPatch, ggit_patch_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitPushOptions, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRef, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitReflog, ggit_reflog_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitReflogEntry, ggit_reflog_entry_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GgitRefSpec, ggit_ref_spec_unref)
diff --git a/libgit2-glib/ggit-ref.c b/libgit2-glib/ggit-ref.c
index a4cdfd6..cc4ccfa 100644
--- a/libgit2-glib/ggit-ref.c
+++ b/libgit2-glib/ggit-ref.c
@@ -31,6 +31,12 @@
 
 /* FIXME: we should have a ref superclass and direct and symbolic subclasses */
 
+/**
+ * GgitRef:
+ *
+ * Reprensents a git reference.
+ */
+
 G_DEFINE_TYPE (GgitRef, ggit_ref, GGIT_TYPE_NATIVE)
 
 static void
diff --git a/libgit2-glib/ggit-ref.h b/libgit2-glib/ggit-ref.h
index d9aa1f5..b0a52a0 100644
--- a/libgit2-glib/ggit-ref.h
+++ b/libgit2-glib/ggit-ref.h
@@ -29,23 +29,8 @@
 
 G_BEGIN_DECLS
 
-#define GGIT_TYPE_REF                  (ggit_ref_get_type ())
-#define GGIT_REF(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGIT_TYPE_REF, GgitRef))
-#define GGIT_REF_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GGIT_TYPE_REF, GgitRefClass))
-#define GGIT_IS_REF(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGIT_TYPE_REF))
-#define GGIT_IS_REF_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GGIT_TYPE_REF))
-#define GGIT_REF_GET_CLASS(obj)                (G_TYPE_INSTANCE_GET_CLASS ((obj), GGIT_TYPE_REF, 
GgitRefClass))
-
-typedef struct _GgitRefClass   GgitRefClass;
-
-struct _GgitRef
-{
-       /*< private >*/
-       GgitNative parent;
-
-       /* priv padding */
-       gpointer *_priv;
-};
+#define GGIT_TYPE_REF (ggit_ref_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GgitRef, ggit_ref, GGIT, REF, GgitNative)
 
 /**
  * GgitRefClass:
@@ -59,8 +44,6 @@ struct _GgitRefClass
        GgitNativeClass parent_class;
 };
 
-GType           ggit_ref_get_type           (void) G_GNUC_CONST;
-
 GgitRef        *_ggit_ref_wrap              (git_reference  *ref,
                                              gboolean        owned);
 
diff --git a/libgit2-glib/ggit-reflog.h b/libgit2-glib/ggit-reflog.h
index de5ec55..21c82a6 100644
--- a/libgit2-glib/ggit-reflog.h
+++ b/libgit2-glib/ggit-reflog.h
@@ -24,6 +24,7 @@
 #include <glib-object.h>
 #include <git2.h>
 #include "ggit-types.h"
+#include "ggit-ref.h"
 
 G_BEGIN_DECLS
 
diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 4d845f8..0801f99 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -278,13 +278,6 @@ typedef struct _GgitPatch GgitPatch;
 typedef struct _GgitPushOptions GgitPushOptions;
 
 /**
- * GgitRef:
- *
- * Reprensents a git reference.
- */
-typedef struct _GgitRef GgitRef;
-
-/**
  * GgitRefSpec:
  *
  * Reprensents a git reference specification.


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