[devhelp/wip/tintou/more-gobject-2] Register DhLanguage as Boxed
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/tintou/more-gobject-2] Register DhLanguage as Boxed
- Date: Tue, 1 Nov 2016 09:04:59 +0000 (UTC)
commit 6a28c7427c1b95892566d8f0e560dae1d1231962
Author: Corentin Noël <corentin elementary io>
Date: Mon Oct 31 20:54:15 2016 +0100
Register DhLanguage as Boxed
Created a copy function.
Registered the new functions in the documentation.
https://bugzilla.gnome.org/show_bug.cgi?id=770785
docs/reference/devhelp-sections.txt | 3 +++
src/dh-language.c | 26 ++++++++++++++++++++++++++
src/dh-language.h | 2 ++
3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/devhelp-sections.txt b/docs/reference/devhelp-sections.txt
index 48b8613..6ad16bd 100644
--- a/docs/reference/devhelp-sections.txt
+++ b/docs/reference/devhelp-sections.txt
@@ -174,6 +174,7 @@ dh_keyword_model_get_type
<TITLE>DhLanguage</TITLE>
DhLanguage
dh_language_new
+dh_language_copy
dh_language_free
dh_language_get_name
dh_language_compare
@@ -181,6 +182,8 @@ dh_language_compare_by_name
dh_language_get_n_books_enabled
dh_language_inc_n_books_enabled
dh_language_dec_n_books_enabled
+<SUBSECTION Private>
+dh_language_get_type
</SECTION>
<SECTION>
diff --git a/src/dh-language.c b/src/dh-language.c
index b2e0f8d..0781ad4 100644
--- a/src/dh-language.c
+++ b/src/dh-language.c
@@ -27,6 +27,11 @@ struct _DhLanguage {
gint n_books_enabled;
};
+G_DEFINE_BOXED_TYPE (DhLanguage,
+ dh_language,
+ dh_language_copy,
+ dh_language_free)
+
/**
* dh_language_free:
* @language: a #DhLanguage object
@@ -41,6 +46,27 @@ dh_language_free (DhLanguage *language)
}
/**
+ * dh_language_copy:
+ * @language: a #DhLanguage object
+ *
+ * Copy @language into a new #DhLanguage object.
+ *
+ * Returns: (transfer full): The copy of the #DhLanguage object
+ */
+DhLanguage *
+dh_language_copy (const DhLanguage *language)
+{
+ DhLanguage *new_language;
+
+ g_return_val_if_fail (language != NULL, NULL);
+
+ new_language = dh_language_new (language->name);
+ new_language->n_books_enabled = language->n_books_enabled;
+
+ return new_language;
+}
+
+/**
* dh_language_new:
* @name: the name of the language
*
diff --git a/src/dh-language.h b/src/dh-language.h
index 2c65400..e9920f2 100644
--- a/src/dh-language.h
+++ b/src/dh-language.h
@@ -23,8 +23,10 @@
typedef struct _DhLanguage DhLanguage;
+GType dh_language_get_type (void) G_GNUC_CONST;
DhLanguage *dh_language_new (const gchar *name);
void dh_language_free (DhLanguage *language);
+DhLanguage *dh_language_copy (const DhLanguage *language);
const gchar *dh_language_get_name (DhLanguage *language);
gint dh_language_compare (const DhLanguage *language_a,
const DhLanguage *language_b);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]