[evolution-data-server/wip/camel-more-gobject] Add some stub structures/files for early builds
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/camel-more-gobject] Add some stub structures/files for early builds
- Date: Tue, 30 Aug 2016 09:10:50 +0000 (UTC)
commit 1f743efae3d50c058063ac1342147600e6420c85
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 30 11:09:42 2016 +0200
Add some stub structures/files for early builds
This keeps the branch still buildable, which is good for further
work. Once the structures are finelized, they will be renamed and
the code will be chaned to use the new objects instead.
camel/Makefile.am | 4 +
camel/camel-folder-summary.h | 2 +-
camel/camel-message-content-info.c | 16 ++++
camel/camel-message-content-info.h | 16 ++++
camel/camel-message-info.c | 169 ++++++++++++++++++++++++++++++++++++
camel/camel-message-info.h | 72 +++++++++++++++
camel/camel.h | 2 +
configure.ac | 2 +-
8 files changed, 281 insertions(+), 2 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index dc7bb1d..7573bfa 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -92,6 +92,8 @@ libcamel_1_2_la_SOURCES = \
camel-medium.c \
camel-memchunk.c \
camel-mempool.c \
+ camel-message-info.c \
+ camel-message-content-info.c \
camel-mime-filter-basic.c \
camel-mime-filter-bestenc.c \
camel-mime-filter-canon.c \
@@ -210,6 +212,8 @@ libcamelinclude_HEADERS = \
camel-medium.h \
camel-memchunk.h \
camel-mempool.h \
+ camel-message-info.h \
+ camel-message-content-info.h \
camel-mime-filter-basic.h \
camel-mime-filter-bestenc.h \
camel-mime-filter-canon.h \
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index d6dfff0..192d527 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -28,7 +28,7 @@
#include <time.h>
#include <camel/camel-index.h>
-#include <camel/camel-memchunk.h>
+#include <camel/camel-message-info.h>
#include <camel/camel-mime-message.h>
#include <camel/camel-mime-parser.h>
diff --git a/camel/camel-message-content-info.c b/camel/camel-message-content-info.c
new file mode 100644
index 0000000..f70a98e
--- /dev/null
+++ b/camel/camel-message-content-info.c
@@ -0,0 +1,16 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/camel/camel-message-content-info.h b/camel/camel-message-content-info.h
new file mode 100644
index 0000000..f70a98e
--- /dev/null
+++ b/camel/camel-message-content-info.h
@@ -0,0 +1,16 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/camel/camel-message-info.c b/camel/camel-message-info.c
new file mode 100644
index 0000000..fe0717e
--- /dev/null
+++ b/camel/camel-message-info.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include "camel-folder-summary.h"
+
+#include "camel-message-info.h"
+
+struct _xCamelMessageInfoPrivate {
+ GMutex property_lock;
+
+ GWeakRef summary; /* CamelFolderSummary * */
+};
+
+enum {
+ PROP_0,
+ PROP_SUMMARY
+};
+
+G_DEFINE_TYPE (xCamelMessageInfo, xcamel_message_info, G_TYPE_OBJECT)
+
+static void
+message_info_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+
+ switch (property_id) {
+ case PROP_SUMMARY:
+ g_weak_ref_set (&mi->priv->summary, g_value_get_object (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+message_info_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SUMMARY:
+ g_value_take_object (
+ value,
+ xcamel_message_info_ref_summary (
+ XCAMEL_MESSAGE_INFO (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+message_info_dispose (GObject *object)
+{
+ xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+
+ g_weak_ref_set (&mi->priv->summary, NULL);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (xcamel_message_info_parent_class)->dispose (object);
+}
+
+static void
+message_info_finalize (GObject *object)
+{
+ xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+
+ g_weak_ref_clear (&mi->priv->summary);
+ g_mutex_clear (&mi->priv->property_lock);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (xcamel_message_info_parent_class)->finalize (object);
+}
+
+static void
+xcamel_message_info_class_init (xCamelMessageInfoClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (xCamelMessageInfoPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = message_info_set_property;
+ object_class->get_property = message_info_get_property;
+ object_class->dispose = message_info_dispose;
+ object_class->finalize = message_info_finalize;
+
+ /**
+ * xCamelMessageInfo:summary
+ *
+ * The #CamelFolderSummary to which the message info belongs, or %NULL.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_SUMMARY,
+ g_param_spec_object (
+ "summary",
+ "Summary",
+ "The summary to which the message info belongs",
+ CAMEL_TYPE_FOLDER_SUMMARY,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+xcamel_message_info_init (xCamelMessageInfo *mi)
+{
+ mi->priv = G_TYPE_INSTANCE_GET_PRIVATE (mi, XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoPrivate);
+
+ g_mutex_init (&mi->priv->property_lock);
+ g_weak_ref_init (&mi->priv->summary, NULL);
+}
+
+/**
+ * xcamel_message_info_new:
+ * @summary: (nullable): parent #CamelFolderSummary object, or %NULL
+ *
+ * Create a new #xCamelMessageInfo object, optionally for given @summary.
+ *
+ * Returns: (transfer-full): a new #xCamelMessageInfo object
+ *
+ * Since: 3.24
+ **/
+xCamelMessageInfo *
+xcamel_message_info_new (CamelFolderSummary *summary)
+{
+ return g_object_new (XCAMEL_TYPE_MESSAGE_INFO, "summary", summary, NULL);
+}
+
+/**
+ * xcamel_message_info_ref_summary:
+ * @mi: a #xCamelMessageInfo
+ *
+ * Returns: (transfer-full): Referenced #CamelFolderSummary to which the @mi belongs, or %NULL,
+ * if there is none. Use g_object_unref() for non-NULL returned values when done with it.
+ *
+ * Since: 3.24
+ **/
+CamelFolderSummary *
+xcamel_message_info_ref_summary (xCamelMessageInfo *mi)
+{
+ g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+
+ return g_weak_ref_get (&mi->priv->summary);
+}
diff --git a/camel/camel-message-info.h b/camel/camel-message-info.h
new file mode 100644
index 0000000..2fc20cf
--- /dev/null
+++ b/camel/camel-message-info.h
@@ -0,0 +1,72 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
+#error "Only <camel/camel.h> can be included directly."
+#endif
+
+#ifndef XCAMEL_MESSAGE_INFO_H
+#define XCAMEL_MESSAGE_INFO_H
+
+#include <glib-object.h>
+
+/* Standard GObject macros */
+#define XCAMEL_TYPE_MESSAGE_INFO \
+ (xcamel_message_info_get_type ())
+#define XCAMEL_MESSAGE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfo))
+#define XCAMEL_MESSAGE_INFO_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoClass))
+#define XCAMEL_IS_MESSAGE_INFO(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), XCAMEL_TYPE_MESSAGE_INFO))
+#define XCAMEL_IS_MESSAGE_INFO_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), XCAMEL_TYPE_MESSAGE_INFO))
+#define XCAMEL_MESSAGE_INFO_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoClass))
+
+G_BEGIN_DECLS
+
+/* Forward declarations */
+struct _CamelFolderSummary;
+
+typedef struct _xCamelMessageInfo xCamelMessageInfo;
+typedef struct _xCamelMessageInfoClass xCamelMessageInfoClass;
+typedef struct _xCamelMessageInfoPrivate xCamelMessageInfoPrivate;
+
+struct _xCamelMessageInfo {
+ GObject parent;
+ xCamelMessageInfoPrivate *priv;
+};
+
+struct _xCamelMessageInfoClass {
+ GObjectClass parent_class;
+};
+
+GType xcamel_message_info_get_type (void);
+xCamelMessageInfo *
+ xcamel_message_info_new (struct _CamelFolderSummary *summary);
+struct _CamelFolderSummary *
+ xcamel_message_info_ref_summary (xCamelMessageInfo *mi);
+
+G_END_DECLS
+
+#endif /* XCAMEL_MESSAGE_INFO_H */
diff --git a/camel/camel.h b/camel/camel.h
index 5710717..1c6eead 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -56,6 +56,8 @@
#include <camel/camel-medium.h>
#include <camel/camel-memchunk.h>
#include <camel/camel-mempool.h>
+#include <camel/camel-message-info.h>
+#include <camel/camel-message-content-info.h>
#include <camel/camel-mime-filter.h>
#include <camel/camel-mime-filter-basic.h>
#include <camel/camel-mime-filter-bestenc.h>
diff --git a/configure.ac b/configure.ac
index f6f8ac3..c73b7cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,7 +136,7 @@ LIBEBOOK_CONTACTS_CURRENT=2
LIBEBOOK_CONTACTS_REVISION=0
LIBEBOOK_CONTACTS_AGE=0
-LIBCAMEL_CURRENT=59
+LIBCAMEL_CURRENT=60
LIBCAMEL_REVISION=0
LIBCAMEL_AGE=0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]