[libgit2-glib/body-diffformatemailoptions: 2/2] Add body property to DiffFormatEmailOptions
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib/body-diffformatemailoptions: 2/2] Add body property to DiffFormatEmailOptions
- Date: Tue, 1 Jan 2019 19:17:48 +0000 (UTC)
commit 53972bf77ea463594417544ad3742ffcfaf9d958
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Tue Jan 1 20:16:28 2019 +0100
Add body property to DiffFormatEmailOptions
libgit2-glib/ggit-diff-format-email-options.c | 64 +++++++++++++++++++++++++++
libgit2-glib/ggit-diff-format-email-options.h | 6 +++
2 files changed, 70 insertions(+)
---
diff --git a/libgit2-glib/ggit-diff-format-email-options.c b/libgit2-glib/ggit-diff-format-email-options.c
index 348bd60..d2fe2ea 100644
--- a/libgit2-glib/ggit-diff-format-email-options.c
+++ b/libgit2-glib/ggit-diff-format-email-options.c
@@ -35,6 +35,7 @@ typedef struct _GgitDiffFormatEmailOptionsPrivate
GgitOId *id;
gchar *summary;
+ gchar *body;
GgitSignature *author;
} GgitDiffFormatEmailOptionsPrivate;
@@ -48,6 +49,7 @@ enum
PROP_TOTAL_PATCHES,
PROP_ID,
PROP_SUMMARY,
+ PROP_BODY,
PROP_AUTHOR
};
@@ -65,6 +67,7 @@ ggit_diff_format_email_options_finalize (GObject *object)
}
g_free (priv->summary);
+ g_free (priv->body);
g_clear_object (&priv->author);
G_OBJECT_CLASS (ggit_diff_format_email_options_parent_class)->finalize (object);
@@ -98,6 +101,9 @@ ggit_diff_format_email_options_set_property (GObject *object,
case PROP_SUMMARY:
ggit_diff_format_email_options_set_summary (options, g_value_get_string (value));
break;
+ case PROP_BODY:
+ ggit_diff_format_email_options_set_body (options, g_value_get_string (value));
+ break;
case PROP_AUTHOR:
ggit_diff_format_email_options_set_author (options, g_value_get_object (value));
break;
@@ -135,6 +141,9 @@ ggit_diff_format_email_options_get_property (GObject *object,
case PROP_SUMMARY:
g_value_set_string (value, priv->summary);
break;
+ case PROP_BODY:
+ g_value_set_string (value, priv->body);
+ break;
case PROP_AUTHOR:
g_value_set_object (value, priv->author);
break;
@@ -204,6 +213,15 @@ ggit_diff_format_email_options_class_init (GgitDiffFormatEmailOptionsClass *klas
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_BODY,
+ g_param_spec_string ("body",
+ "Body",
+ "Body",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (object_class,
PROP_AUTHOR,
g_param_spec_object ("author",
@@ -486,6 +504,52 @@ ggit_diff_format_email_options_set_summary (GgitDiffFormatEmailOptions *options,
g_object_notify (G_OBJECT (options), "summary");
}
+/**
+ * ggit_diff_format_email_options_get_body:
+ * @options: a #GgitDiffFormatEmailOptions.
+ *
+ * Get the body.
+ *
+ * Returns: (transfer none) (nullable): the body.
+ *
+ **/
+const gchar *
+ggit_diff_format_email_options_get_body (GgitDiffFormatEmailOptions *options)
+{
+ GgitDiffFormatEmailOptionsPrivate *priv;
+
+ g_return_val_if_fail (GGIT_IS_DIFF_FORMAT_EMAIL_OPTIONS (options), NULL);
+
+ priv = ggit_diff_format_email_options_get_instance_private (options);
+
+ return priv->body;
+}
+
+/**
+ * ggit_diff_format_email_options_set_body:
+ * @options: a #GgitDiffFormatEmailOptions.
+ * @body: (allow-none): the body.
+ *
+ * Set the body.
+ *
+ **/
+void
+ggit_diff_format_email_options_set_body (GgitDiffFormatEmailOptions *options,
+ const gchar *body)
+{
+ GgitDiffFormatEmailOptionsPrivate *priv;
+
+ g_return_if_fail (GGIT_IS_DIFF_FORMAT_EMAIL_OPTIONS (options));
+
+ priv = ggit_diff_format_email_options_get_instance_private (options);
+
+ g_free (priv->body);
+ priv->body = g_strdup (body);
+
+ priv->options.body = priv->body;
+ g_object_notify (G_OBJECT (options), "body");
+}
+
/**
* ggit_diff_format_email_options_get_author:
* @options: a #GgitDiffFormatEmailOptions.
diff --git a/libgit2-glib/ggit-diff-format-email-options.h b/libgit2-glib/ggit-diff-format-email-options.h
index 731c860..ad8ad94 100644
--- a/libgit2-glib/ggit-diff-format-email-options.h
+++ b/libgit2-glib/ggit-diff-format-email-options.h
@@ -75,6 +75,12 @@ void ggit_diff_format_email_options_set_summary (
GgitDiffFormatEmailOptions *options,
const gchar *summary);
+const gchar *ggit_diff_format_email_options_get_body (
+ GgitDiffFormatEmailOptions *options);
+void ggit_diff_format_email_options_set_body (
+ GgitDiffFormatEmailOptions *options,
+ const gchar *body);
+
GgitSignature *ggit_diff_format_email_options_get_author (
GgitDiffFormatEmailOptions *options);
void ggit_diff_format_email_options_set_author (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]