[evolution-data-server] CamelMultipartEncrypted cleanups.



commit 953207d16da6cb235841bdfcec52eed0199ee233
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Oct 2 12:11:59 2013 -0400

    CamelMultipartEncrypted cleanups.
    
    Turns out this class is trivial; just sets the internal MIME type to
    "multipart/encrypted", the rest of it was unused cruft.  Debated if
    this class is even worth keeping, but I'll leave it for now.

 camel/camel-gpg-context.c               |    2 -
 camel/camel-multipart-encrypted.c       |   80 ++-----------------------------
 camel/camel-multipart-encrypted.h       |   14 ++----
 docs/reference/camel/camel-sections.txt |    2 +
 4 files changed, 11 insertions(+), 87 deletions(-)
---
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 052255d..fbb73b9 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -2055,8 +2055,6 @@ gpg_encrypt_sync (CamelCipherContext *context,
        camel_content_type_unref (ct);
        camel_multipart_set_boundary ((CamelMultipart *) mpe, NULL);
 
-       mpe->decrypted = g_object_ref (ipart);
-
        camel_multipart_add_part ((CamelMultipart *) mpe, verpart);
        g_object_unref (verpart);
        camel_multipart_add_part ((CamelMultipart *) mpe, encpart);
diff --git a/camel/camel-multipart-encrypted.c b/camel/camel-multipart-encrypted.c
index 825f394..73e9d20 100644
--- a/camel/camel-multipart-encrypted.c
+++ b/camel/camel-multipart-encrypted.c
@@ -24,86 +24,16 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
-#include <string.h>
-
-#include <glib/gi18n-lib.h>
-
-#include "camel-mime-filter-crlf.h"
-#include "camel-mime-part.h"
-#include "camel-mime-utils.h"
 #include "camel-multipart-encrypted.h"
-#include "camel-stream-filter.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-mem.h"
-
-G_DEFINE_TYPE (CamelMultipartEncrypted, camel_multipart_encrypted, CAMEL_TYPE_MULTIPART)
-
-static void
-multipart_encrypted_dispose (GObject *object)
-{
-       CamelMultipartEncrypted *multipart;
-
-       multipart = CAMEL_MULTIPART_ENCRYPTED (object);
 
-       if (multipart->decrypted) {
-               g_object_unref (multipart->decrypted);
-               multipart->decrypted = NULL;
-       }
-
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (camel_multipart_encrypted_parent_class)->dispose (object);
-}
-
-static void
-multipart_encrypted_finalize (GObject *object)
-{
-       CamelMultipartEncrypted *multipart;
-
-       multipart = CAMEL_MULTIPART_ENCRYPTED (object);
-
-       g_free (multipart->protocol);
-
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (camel_multipart_encrypted_parent_class)->finalize (object);
-}
-
-/* we snoop the mime type to get the protocol */
-static void
-multipart_encrypted_set_mime_type_field (CamelDataWrapper *data_wrapper,
-                                         CamelContentType *mime_type)
-{
-       CamelMultipartEncrypted *multipart;
-       CamelDataWrapperClass *data_wrapper_class;
-
-       multipart = CAMEL_MULTIPART_ENCRYPTED (data_wrapper);
-
-       if (mime_type != NULL) {
-               const gchar *protocol;
-
-               protocol = camel_content_type_param (mime_type, "protocol");
-               g_free (multipart->protocol);
-               multipart->protocol = g_strdup (protocol);
-       }
-
-       /* Chain up to parent's set_mime_type_field() method. */
-       data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_multipart_encrypted_parent_class);
-       data_wrapper_class->set_mime_type_field (data_wrapper, mime_type);
-}
+G_DEFINE_TYPE (
+       CamelMultipartEncrypted,
+       camel_multipart_encrypted,
+       CAMEL_TYPE_MULTIPART)
 
 static void
 camel_multipart_encrypted_class_init (CamelMultipartEncryptedClass *class)
 {
-       GObjectClass *object_class;
-       CamelDataWrapperClass *data_wrapper_class;
-
-       object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = multipart_encrypted_dispose;
-       object_class->finalize = multipart_encrypted_finalize;
-
-       data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (class);
-       data_wrapper_class->set_mime_type_field =
-               multipart_encrypted_set_mime_type_field;
 }
 
 static void
@@ -111,8 +41,6 @@ camel_multipart_encrypted_init (CamelMultipartEncrypted *multipart)
 {
        camel_data_wrapper_set_mime_type (
                CAMEL_DATA_WRAPPER (multipart), "multipart/encrypted");
-
-       multipart->decrypted = NULL;
 }
 
 /**
diff --git a/camel/camel-multipart-encrypted.h b/camel/camel-multipart-encrypted.h
index 8c66588..148e9d7 100644
--- a/camel/camel-multipart-encrypted.h
+++ b/camel/camel-multipart-encrypted.h
@@ -52,6 +52,7 @@ G_BEGIN_DECLS
 
 typedef struct _CamelMultipartEncrypted CamelMultipartEncrypted;
 typedef struct _CamelMultipartEncryptedClass CamelMultipartEncryptedClass;
+typedef struct _CamelMultipartEncryptedPrivate CamelMultipartEncryptedPrivate;
 
 /* 'handy' enums for getting the internal parts of the multipart */
 enum {
@@ -61,12 +62,7 @@ enum {
 
 struct _CamelMultipartEncrypted {
        CamelMultipart parent;
-
-       CamelMimePart *version;
-       CamelMimePart *content;
-       CamelMimePart *decrypted;
-
-       gchar *protocol;
+       CamelMultipartEncryptedPrivate *priv;
 };
 
 struct _CamelMultipartEncryptedClass {
@@ -74,9 +70,9 @@ struct _CamelMultipartEncryptedClass {
 
 };
 
-GType camel_multipart_encrypted_get_type (void);
-
-CamelMultipartEncrypted *camel_multipart_encrypted_new (void);
+GType          camel_multipart_encrypted_get_type      (void) G_GNUC_CONST;
+CamelMultipartEncrypted *
+               camel_multipart_encrypted_new           (void);
 
 G_END_DECLS
 
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 76855a0..01401fc 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1766,6 +1766,8 @@ CAMEL_IS_MULTIPART_ENCRYPTED_CLASS
 CAMEL_MULTIPART_ENCRYPTED_GET_CLASS
 CamelMultipartEncryptedClass
 camel_multipart_encrypted_get_type
+<SUBSECTION Private>
+CamelMultipartEncryptedPrivate
 </SECTION>
 
 <SECTION>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]