evolution r37522 - branches/kill-bonobo/mail
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r37522 - branches/kill-bonobo/mail
- Date: Tue, 14 Apr 2009 18:32:57 +0000 (UTC)
Author: mbarnes
Date: Tue Apr 14 18:32:57 2009
New Revision: 37522
URL: http://svn.gnome.org/viewvc/evolution?rev=37522&view=rev
Log:
Commit some code cleanups that I want to keep separate.
Modified:
branches/kill-bonobo/mail/em-format-html-print.c
branches/kill-bonobo/mail/em-format-html-print.h
branches/kill-bonobo/mail/em-format-quote.c
branches/kill-bonobo/mail/em-format-quote.h
branches/kill-bonobo/mail/em-format.c
Modified: branches/kill-bonobo/mail/em-format-html-print.c
==============================================================================
--- branches/kill-bonobo/mail/em-format-html-print.c (original)
+++ branches/kill-bonobo/mail/em-format-html-print.c Tue Apr 14 18:32:57 2009
@@ -38,22 +38,27 @@
static gpointer parent_class = NULL;
static void
-efhp_finalize (GObject *o)
+efhp_finalize (GObject *object)
{
- EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *)o;
+ EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *)object;
gtk_widget_destroy (efhp->window);
if (efhp->source != NULL)
g_object_unref (efhp->source);
- ((GObjectClass *) parent_class)->finalize (o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-efhp_class_init (GObjectClass *class)
+efhp_class_init (EMFormatHTMLPrintClass *class)
{
+ GObjectClass *object_class;
+
parent_class = g_type_class_peek_parent (class);
- class->finalize = efhp_finalize;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = efhp_finalize;
}
static void
@@ -93,7 +98,7 @@
};
type = g_type_register_static (
- em_format_html_get_type (), "EMFormatHTMLPrint",
+ EM_TYPE_FORMAT_HTML, "EMFormatHTMLPrint",
&type_info, 0);
}
@@ -101,7 +106,8 @@
}
EMFormatHTMLPrint *
-em_format_html_print_new (EMFormatHTML *source, GtkPrintOperationAction action)
+em_format_html_print_new (EMFormatHTML *source,
+ GtkPrintOperationAction action)
{
EMFormatHTMLPrint *efhp;
Modified: branches/kill-bonobo/mail/em-format-html-print.h
==============================================================================
--- branches/kill-bonobo/mail/em-format-html-print.h (original)
+++ branches/kill-bonobo/mail/em-format-html-print.h Tue Apr 14 18:32:57 2009
@@ -16,13 +16,32 @@
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*/
-#ifndef _EM_FORMAT_HTML_PRINT_H
-#define _EM_FORMAT_HTML_PRINT_H
+
+#ifndef EM_FORMAT_HTML_PRINT_H
+#define EM_FORMAT_HTML_PRINT_H
#include "mail/em-format-html.h"
+/* Standard GObject macros */
#define EM_TYPE_FORMAT_HTML_PRINT \
(em_format_html_print_get_type ())
+#define EM_FORMAT_HTML_PRINT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FORMAT_HTML_PRINT, EMFormatHTMLPrint))
+#define EM_FORMAT_HTML_PRINT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FORMAT_HTML_PRINT, EMFormatHTMLPrintClass))
+#define EM_IS_FORMAT_HTML_PRINT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FORMAT_HTML_PRINT))
+#define EM_IS_FORMAT_HTML_PRINT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FORMAT_HTML_PRINT))
+#define EM_FORMAT_HTML_PRINT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FORMAT_HTML_PRINT, EMFormatHTMLPrintClass))
+
+G_BEGIN_DECLS
typedef struct _EMFormatHTMLPrint EMFormatHTMLPrint;
typedef struct _EMFormatHTMLPrintClass EMFormatHTMLPrintClass;
@@ -40,13 +59,16 @@
EMFormatHTMLClass parent_class;
};
-GType em_format_html_print_get_type (void);
-EMFormatHTMLPrint * em_format_html_print_new (EMFormatHTML *source,
- GtkPrintOperationAction action);
-void em_format_html_print_message (EMFormatHTMLPrint *efhp,
- CamelFolder *folder,
- const char *uid);
-void em_format_html_print_raw_message (EMFormatHTMLPrint *efhp,
- CamelMimeMessage *msg);
+GType em_format_html_print_get_type (void);
+EMFormatHTMLPrint *
+ em_format_html_print_new (EMFormatHTML *source,
+ GtkPrintOperationAction action);
+void em_format_html_print_message (EMFormatHTMLPrint *efhp,
+ CamelFolder *folder,
+ const gchar *uid);
+void em_format_html_print_raw_message(EMFormatHTMLPrint *efhp,
+ CamelMimeMessage *msg);
+
+G_END_DECLS
-#endif /* ! _EM_FORMAT_HTML_PRINT_H */
+#endif /* EM_FORMAT_HTML_PRINT_H */
Modified: branches/kill-bonobo/mail/em-format-quote.c
==============================================================================
--- branches/kill-bonobo/mail/em-format-quote.c (original)
+++ branches/kill-bonobo/mail/em-format-quote.c Tue Apr 14 18:32:57 2009
@@ -28,7 +28,6 @@
#include <string.h>
#include <camel/camel-iconv.h>
-#include <camel/camel-stream.h>
#include <camel/camel-stream-filter.h>
#include <camel/camel-mime-filter-tohtml.h>
#include <camel/camel-mime-filter-enriched.h>
@@ -55,82 +54,94 @@
static void emfq_builtin_init(EMFormatQuoteClass *efhc);
-static EMFormatClass *emfq_parent;
+static gpointer parent_class;
static void
emfq_init(GObject *o)
{
EMFormatQuote *emfq =(EMFormatQuote *) o;
- emfq->priv = g_malloc0(sizeof(*emfq->priv));
-
/* we want to convert url's etc */
emfq->text_html_flags = CAMEL_MIME_FILTER_TOHTML_PRE | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS
| CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
}
static void
-emfq_finalise(GObject *o)
+emfq_finalize (GObject *object)
{
- EMFormatQuote *emfq =(EMFormatQuote *) o;
+ EMFormatQuote *emfq =(EMFormatQuote *) object;
if (emfq->stream)
camel_object_unref(emfq->stream);
g_free(emfq->credits);
- g_free(emfq->priv);
- ((GObjectClass *) emfq_parent)->finalize(o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-emfq_base_init(EMFormatQuoteClass *emfqklass)
+emfq_base_init(EMFormatQuoteClass *emfqclass)
{
- emfq_builtin_init(emfqklass);
+ emfq_builtin_init(emfqclass);
}
static void
-emfq_class_init(GObjectClass *klass)
+emfq_class_init (EMFormatQuoteClass *class)
{
- ((EMFormatClass *) klass)->format_clone = emfq_format_clone;
- ((EMFormatClass *) klass)->format_error = emfq_format_error;
- ((EMFormatClass *) klass)->format_source = emfq_format_source;
- ((EMFormatClass *) klass)->format_attachment = emfq_format_attachment;
+ GObjectClass *object_class;
+ EMFormatClass *format_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMFormatQuotePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = emfq_finalize;
- klass->finalize = emfq_finalise;
+ format_class = EM_FORMAT_CLASS (class);
+ format_class->format_clone = emfq_format_clone;
+ format_class->format_error = emfq_format_error;
+ format_class->format_source = emfq_format_source;
+ format_class->format_attachment = emfq_format_attachment;
}
GType
-em_format_quote_get_type(void)
+em_format_quote_get_type (void)
{
static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EMFormatQuoteClass),
- (GBaseInitFunc)emfq_base_init, NULL,
- (GClassInitFunc)emfq_class_init,
- NULL, NULL,
- sizeof(EMFormatQuote), 0,
- (GInstanceInitFunc) emfq_init
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMFormatQuoteClass),
+ (GBaseInitFunc) emfq_base_init,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) emfq_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMFormatQuote),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) emfq_init,
+ NULL /* value_table */
};
- emfq_parent = g_type_class_ref(em_format_get_type());
- type = g_type_register_static(em_format_get_type(), "EMFormatQuote", &info, 0);
+ type = g_type_register_static (
+ EM_TYPE_FORMAT, "EMFormatQuote", &type_info, 0);
}
return type;
}
EMFormatQuote *
-em_format_quote_new(const char *credits, CamelStream *stream, guint32 flags)
+em_format_quote_new (const gchar *credits,
+ CamelStream *stream,
+ guint32 flags)
{
EMFormatQuote *emfq;
- emfq = (EMFormatQuote *)g_object_new(em_format_quote_get_type(), NULL);
+ emfq = g_object_new (EM_TYPE_FORMAT_QUOTE, NULL);
- emfq->credits = g_strdup(credits);
+ emfq->credits = g_strdup (credits);
emfq->stream = stream;
- camel_object_ref(stream);
+ camel_object_ref (stream);
emfq->flags = flags;
return emfq;
@@ -148,7 +159,8 @@
EMFormatQuote *emfq = (EMFormatQuote *) emf;
const EMFormatHandler *handle;
- ((EMFormatClass *)emfq_parent)->format_clone(emf, folder, uid, msg, src);
+ /* Chain up to parent's format_clone() method. */
+ EM_FORMAT_CLASS (parent_class)->format_clone (emf, folder, uid, msg, src);
camel_stream_reset(emfq->stream);
if (gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/composer/top_signature", NULL))
Modified: branches/kill-bonobo/mail/em-format-quote.h
==============================================================================
--- branches/kill-bonobo/mail/em-format-quote.h (original)
+++ branches/kill-bonobo/mail/em-format-quote.h Tue Apr 14 18:32:57 2009
@@ -20,24 +20,47 @@
*
*/
-#ifndef _EM_FORMAT_QUOTE_H
-#define _EM_FORMAT_QUOTE_H
+#ifndef EM_FORMAT_QUOTE_H
+#define EM_FORMAT_QUOTE_H
+#include <camel/camel-stream.h>
#include "mail/em-format.h"
-typedef struct _EMFormatQuote EMFormatQuote;
-typedef struct _EMFormatQuoteClass EMFormatQuoteClass;
+/* Standard GObject macros */
+#define EM_TYPE_FORMAT_QUOTE \
+ (em_format_quote_get_type ())
+#define EM_FORMAT_QUOTE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FORMAT_QUOTE, EMFormatQuote))
+#define EM_FORMAT_QUOTE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FORMAT_QUOTE, EMFormatQuoteClass))
+#define EM_IS_FORMAT_QUOTE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FORMAT_QUOTE))
+#define EM_IS_FORMAT_QUOTE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FORMAT_QUOTE))
+#define EM_FORMAT_QUOTE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FORMAT_QUOTE, EMFormatQuoteClass))
#define EM_FORMAT_QUOTE_CITE (1<<0)
#define EM_FORMAT_QUOTE_HEADERS (1<<1)
+G_BEGIN_DECLS
+
+typedef struct _EMFormatQuote EMFormatQuote;
+typedef struct _EMFormatQuoteClass EMFormatQuoteClass;
+typedef struct _EMFormatQuotePrivate EMFormatQuotePrivate;
+
struct _EMFormatQuote {
EMFormat format;
- struct _EMFormatQuotePrivate *priv;
+ EMFormatQuotePrivate *priv;
char *credits;
- struct _CamelStream *stream;
+ CamelStream *stream;
guint32 flags;
guint32 text_html_flags;
@@ -48,8 +71,11 @@
EMFormatClass format_class;
};
-GType em_format_quote_get_type (void);
+GType em_format_quote_get_type (void);
+EMFormatQuote * em_format_quote_new (const gchar *credits,
+ CamelStream *stream,
+ guint32 flags);
-EMFormatQuote *em_format_quote_new (const char *credits, struct _CamelStream *stream, guint32 flags);
+G_END_DECLS
-#endif /* !_EM_FORMAT_QUOTE_H */
+#endif /* EM_FORMAT_QUOTE_H */
Modified: branches/kill-bonobo/mail/em-format.c
==============================================================================
--- branches/kill-bonobo/mail/em-format.c (original)
+++ branches/kill-bonobo/mail/em-format.c Tue Apr 14 18:32:57 2009
@@ -111,23 +111,6 @@
}
static void
-emf_init (EMFormat *emf)
-{
- emf->inline_table = g_hash_table_new_full (
- g_str_hash, g_str_equal,
- (GDestroyNotify) NULL,
- (GDestroyNotify) emf_free_cache);
- emf->composer = FALSE;
- emf->print = FALSE;
- e_dlist_init(&emf->header_list);
- em_format_default_headers(emf);
- emf->part_id = g_string_new("");
-
- emf->session = session;
- camel_object_ref (emf->session);
-}
-
-static void
emf_finalize (GObject *object)
{
EMFormat *emf = EM_FORMAT (object);
@@ -184,6 +167,23 @@
emf_builtin_init (class);
}
+static void
+emf_init (EMFormat *emf)
+{
+ emf->inline_table = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) emf_free_cache);
+ emf->composer = FALSE;
+ emf->print = FALSE;
+ e_dlist_init(&emf->header_list);
+ em_format_default_headers(emf);
+ emf->part_id = g_string_new("");
+
+ emf->session = session;
+ camel_object_ref (emf->session);
+}
+
GType
em_format_get_type (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]