[libgit2-glib] Make GgitTransferProgress a boxed type.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Make GgitTransferProgress a boxed type.
- Date: Thu, 28 Mar 2013 07:35:49 +0000 (UTC)
commit 050f073b96627608e73790fb171255f4291040a5
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Mar 28 08:35:25 2013 +0100
Make GgitTransferProgress a boxed type.
libgit2-glib/Makefile.am | 2 +
libgit2-glib/ggit-transfer-progress.c | 65 +++++++++++++++++++++++++++++++++
libgit2-glib/ggit-transfer-progress.h | 42 +++++++++++++++++++++
3 files changed, 109 insertions(+), 0 deletions(-)
---
diff --git a/libgit2-glib/Makefile.am b/libgit2-glib/Makefile.am
index 5d81a2e..a5c5a22 100644
--- a/libgit2-glib/Makefile.am
+++ b/libgit2-glib/Makefile.am
@@ -49,6 +49,7 @@ INST_H_FILES = \
ggit-signature.h \
ggit-submodule.h \
ggit-tag.h \
+ ggit-transfer-progress.h \
ggit-tree.h \
ggit-tree-entry.h \
ggit-types.h \
@@ -94,6 +95,7 @@ C_FILES = \
ggit-signature.c \
ggit-submodule.c \
ggit-tag.c \
+ ggit-transfer-progress.c \
ggit-tree.c \
ggit-tree-entry.c \
ggit-types.c \
diff --git a/libgit2-glib/ggit-transfer-progress.c b/libgit2-glib/ggit-transfer-progress.c
new file mode 100644
index 0000000..a47895f
--- /dev/null
+++ b/libgit2-glib/ggit-transfer-progress.c
@@ -0,0 +1,65 @@
+/*
+ * ggit-transfer-progress.c
+ * This file is part of libgit2-glib
+ *
+ * Copyright (C) 2013 - Ignacio Casal Quinteiro
+ *
+ * libgit2-glib is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * libgit2-glib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libgit2-glib. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ggit-transfer-progress.h"
+
+G_DEFINE_BOXED_TYPE (GgitTransferProgress, ggit_transfer_progress,
+ ggit_transfer_progress_copy,
+ ggit_transfer_progress_free)
+
+/**
+ * ggit_transfer_progress_copy:
+ * @progress: a #GgitTransferProgress.
+ *
+ * Copies @progress into a newly allocated #GgitTransferProgress.
+ *
+ * Returns: (transfer full): a newly allocated #GgitTransferProgress.
+ */
+GgitTransferProgress *
+ggit_transfer_progress_copy (GgitTransferProgress *progress)
+{
+ GgitTransferProgress *copy;
+
+ g_return_val_if_fail (progress != NULL, NULL);
+
+ copy = g_slice_new (GgitTransferProgress);
+ copy->total_objects = progress->total_objects;
+ copy->indexed_objects = progress->indexed_objects;
+ copy->received_objects = progress->received_objects;
+ copy->received_bytes = progress->received_bytes;
+
+ return copy;
+}
+
+/**
+ * ggit_transfer_progress_free:
+ * @progress: a #GgitTransferProgress.
+ *
+ * Frees @progress.
+ */
+void
+ggit_transfer_progress_free (GgitTransferProgress *progress)
+{
+ g_return_if_fail (progress != NULL);
+
+ g_slice_free (GgitTransferProgress, progress);
+}
+
+/* ex:set ts=8 noet: */
diff --git a/libgit2-glib/ggit-transfer-progress.h b/libgit2-glib/ggit-transfer-progress.h
new file mode 100644
index 0000000..47336d8
--- /dev/null
+++ b/libgit2-glib/ggit-transfer-progress.h
@@ -0,0 +1,42 @@
+/*
+ * ggit-transfer-progress.h
+ * This file is part of libgit2-glib
+ *
+ * Copyright (C) 2013 - Ignacio Casal Quinteiro
+ *
+ * libgit2-glib is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * libgit2-glib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libgit2-glib. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GGIT_TRANSFER_PROGRESS_H__
+#define __GGIT_TRANSFER_PROGRESS_H__
+
+#include <glib-object.h>
+
+#include "ggit-types.h"
+
+G_BEGIN_DECLS
+
+#define GGIT_TYPE_TRANSFER_PROGRESS (ggit_transfer_progress_get_type ())
+#define GGIT_TRANSFER_PROGRESS(obj) ((GgitTransferProgress *)obj)
+
+GType ggit_transfer_progress_get_type (void) G_GNUC_CONST;
+
+GgitTransferProgress *ggit_transfer_progress_copy (GgitTransferProgress *progress);
+void ggit_transfer_progress_free (GgitTransferProgress *progress);
+
+G_END_DECLS
+
+#endif /* __GGIT_TRANSFER_PROGRESS_H__ */
+
+/* ex:set ts=8 noet: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]