[evolution-data-server/wip/camel-more-gobject] Seal CamelVeeFolder properties
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/camel-more-gobject] Seal CamelVeeFolder properties
- Date: Thu, 3 Nov 2016 14:45:08 +0000 (UTC)
commit 1996b4f39199b08d4f10d2abc81568067b902dea
Author: Milan Crha <mcrha redhat com>
Date: Thu Nov 3 15:45:14 2016 +0100
Seal CamelVeeFolder properties
src/camel/camel-vee-folder.c | 27 ++++++++++++++++++++++++++-
src/camel/camel-vee-folder.h | 4 +---
src/camel/camel-vee-store.c | 6 +++---
3 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/src/camel/camel-vee-folder.c b/src/camel/camel-vee-folder.c
index 9fbd480..91af03d 100644
--- a/src/camel/camel-vee-folder.c
+++ b/src/camel/camel-vee-folder.c
@@ -46,6 +46,7 @@ typedef struct _FolderChangedData FolderChangedData;
((obj), CAMEL_TYPE_VEE_FOLDER, CamelVeeFolderPrivate))
struct _CamelVeeFolderPrivate {
+ guint32 flags; /* folder open flags */
gboolean destroyed;
GList *subfolders; /* lock using subfolder_lock before changing/accessing */
GHashTable *ignore_changed; /* hash of subfolder pointers to ignore the next folder's 'changed'
signal */
@@ -1258,6 +1259,14 @@ camel_vee_folder_init (CamelVeeFolder *vee_folder)
(GDestroyNotify) vee_folder_changed_data_free);
}
+/**
+ * camel_vee_folder_construct:
+ * @vf: a #CamelVeeFolder
+ * @flags: flags for the @vf
+ *
+ * Initializes internal structures of the @vf. This is meant to be
+ * called by the descendants of #CamelVeeFolder.
+ **/
void
camel_vee_folder_construct (CamelVeeFolder *vf,
guint32 flags)
@@ -1265,7 +1274,7 @@ camel_vee_folder_construct (CamelVeeFolder *vf,
CamelFolder *folder = (CamelFolder *) vf;
CamelStore *parent_store;
- vf->flags = flags;
+ vf->priv->flags = flags;
parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (vf));
if (CAMEL_IS_VEE_STORE (parent_store))
@@ -1298,6 +1307,22 @@ camel_vee_folder_construct (CamelVeeFolder *vf,
}
/**
+ * camel_vee_folder_get_flags:
+ * @vf: a #CamelVeeFolder
+ *
+ * Returns: flags of @vf, as set by camel_vee_folder_construct()
+ *
+ * Since: 3.24
+ **/
+guint32
+camel_vee_folder_get_flags (CamelVeeFolder *vf)
+{
+ g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (vf), 0);
+
+ return vf->priv->flags;
+}
+
+/**
* camel_vee_folder_new:
* @parent_store: the parent CamelVeeStore
* @full: the full path to the vfolder.
diff --git a/src/camel/camel-vee-folder.h b/src/camel/camel-vee-folder.h
index 522afdf..bee2eed 100644
--- a/src/camel/camel-vee-folder.h
+++ b/src/camel/camel-vee-folder.h
@@ -57,8 +57,6 @@ typedef struct _CamelVeeFolderPrivate CamelVeeFolderPrivate;
struct _CamelVeeFolder {
CamelFolder parent;
CamelVeeFolderPrivate *priv;
-
- guint32 flags; /* folder open flags */
};
struct _CamelVeeFolderClass {
@@ -96,7 +94,7 @@ CamelFolder * camel_vee_folder_new (CamelStore *parent_store,
guint32 flags);
void camel_vee_folder_construct (CamelVeeFolder *vf,
guint32 flags);
-
+guint32 camel_vee_folder_get_flags (CamelVeeFolder *vf);
CamelFolder * camel_vee_folder_get_location (CamelVeeFolder *vf,
const CamelVeeMessageInfo *vinfo,
gchar **realuid);
diff --git a/src/camel/camel-vee-store.c b/src/camel/camel-vee-store.c
index 58bc973..0b5d31a 100644
--- a/src/camel/camel-vee-store.c
+++ b/src/camel/camel-vee-store.c
@@ -220,7 +220,7 @@ vee_store_get_folder_sync (CamelStore *store,
gsize name_len;
vf = (CamelVeeFolder *) camel_vee_folder_new (store, folder_name, flags);
- if (vf && ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0)) {
+ if (vf && ((camel_vee_folder_get_flags (vf) & CAMEL_STORE_FOLDER_PRIVATE) == 0)) {
const gchar *full_name;
full_name = camel_folder_get_full_name (CAMEL_FOLDER (vf));
@@ -433,7 +433,7 @@ vee_store_delete_folder_sync (CamelStore *store,
camel_object_set_state_filename (object, NULL);
}
- if ((((CamelVeeFolder *) folder)->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) {
+ if ((camel_vee_folder_get_flags (CAMEL_VEE_FOLDER (folder)) & CAMEL_STORE_FOLDER_PRIVATE) ==
0) {
/* what about now-empty parents? ignore? */
change_folder (store, folder_name, CHANGE_DELETE, -1);
}
@@ -493,7 +493,7 @@ vee_store_rename_folder_sync (CamelStore *store,
folder = camel_object_bag_reserve (camel_store_get_folders_bag (store), name);
if (folder == NULL) {
/* create a dummy vFolder for this, makes get_folder_info simpler */
- folder = camel_vee_folder_new (store, name, ((CamelVeeFolder *) oldfolder)->flags);
+ folder = camel_vee_folder_new (store, name, camel_vee_folder_get_flags
(CAMEL_VEE_FOLDER (oldfolder)));
camel_object_bag_add (camel_store_get_folders_bag (store), name, folder);
change_folder (store, name, CHANGE_ADD | CHANGE_NOSELECT, 0);
/* FIXME: this sort of leaks folder, nobody owns a ref to it but us */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]