[libgit2-glib] Set property at construction.



commit 9f11ef711851a2b7848e1bd59e1df24d80c88898
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Nov 4 16:54:43 2012 +0100

    Set property at construction.
    
    Also we set the native destruct func in the init,
    so it is set no matter what.

 libgit2-glib/ggit-index.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/libgit2-glib/ggit-index.c b/libgit2-glib/ggit-index.c
index 86d4da4..3a5b636 100644
--- a/libgit2-glib/ggit-index.c
+++ b/libgit2-glib/ggit-index.c
@@ -183,25 +183,22 @@ ggit_index_class_init (GgitIndexClass *klass)
 }
 
 static void
-ggit_index_init (GgitIndex *self)
+ggit_index_init (GgitIndex *index)
 {
-	self->priv = GGIT_INDEX_GET_PRIVATE (self);
+	index->priv = GGIT_INDEX_GET_PRIVATE (index);
+
+	_ggit_native_set_destroy_func (index, (GDestroyNotify) git_index_free);
 }
 
 GgitIndex *
 _ggit_index_wrap (git_index *idx)
 {
-	GgitIndex *ret;
-
 	if (idx == NULL)
 	{
 		return NULL;
 	}
 
-	ret = g_object_new (GGIT_TYPE_INDEX, NULL);
-	_ggit_native_set (ret, idx, (GDestroyNotify) git_index_free);
-
-	return ret;
+	return GGIT_INDEX (g_object_new (GGIT_TYPE_INDEX, "native", idx, NULL));
 }
 
 git_index *



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