[evolution/webkit] EMEvent coding style cleanups.
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit] EMEvent coding style cleanups.
- Date: Mon, 11 Jul 2011 14:33:05 +0000 (UTC)
commit 69f92754feb26e6c22449033bd19739a4a9536ca
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon May 2 13:03:28 2011 -0400
EMEvent coding style cleanups.
mail/em-event.c | 108 +++++++++++++++++++++++++++++++------------------------
mail/em-event.h | 70 +++++++++++++++++++++++-------------
2 files changed, 106 insertions(+), 72 deletions(-)
---
diff --git a/mail/em-event.c b/mail/em-event.c
index 187a1cb..084c857 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -32,20 +32,9 @@
#include "em-event.h"
#include "composer/e-msg-composer.h"
-static GObjectClass *eme_parent;
static EMEvent *em_event;
-static void
-eme_init (GObject *o)
-{
- /*EMEvent *eme = (EMEvent *)o; */
-}
-
-static void
-eme_finalise (GObject *o)
-{
- ((GObjectClass *)eme_parent)->finalize (o);
-}
+G_DEFINE_TYPE (EMEvent, em_event, E_TYPE_EVENT)
static void
eme_target_free (EEvent *ep, EEventTarget *t)
@@ -78,35 +67,22 @@ eme_target_free (EEvent *ep, EEventTarget *t)
break; }
}
- ((EEventClass *)eme_parent)->target_free (ep, t);
+ /* Chain up to parent's target_free() method. */
+ E_EVENT_CLASS (em_event_parent_class)->target_free (ep, t);
}
static void
-eme_class_init (GObjectClass *klass)
+em_event_class_init (EMEventClass *class)
{
- klass->finalize = eme_finalise;
- ((EEventClass *)klass)->target_free = eme_target_free;
+ EEventClass *event_class;
+
+ event_class = E_EVENT_CLASS (class);
+ event_class->target_free = eme_target_free;
}
-GType
-em_event_get_type (void)
+static void
+em_event_init (EMEvent *event)
{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof (EMEventClass),
- NULL, NULL,
- (GClassInitFunc)eme_class_init,
- NULL, NULL,
- sizeof (EMEvent), 0,
- (GInstanceInitFunc)eme_init
- };
- eme_parent = g_type_class_ref (e_event_get_type ());
- type = g_type_register_static(e_event_get_type(), "EMEvent", &info, 0);
- }
-
- return type;
}
/**
@@ -117,22 +93,33 @@ em_event_get_type (void)
*
* Return value:
**/
-EMEvent *em_event_peek (void)
+EMEvent *
+em_event_peek (void)
{
if (em_event == NULL) {
em_event = g_object_new (em_event_get_type (), NULL);
- e_event_construct(&em_event->popup, "org.gnome.evolution.mail.events");
+ e_event_construct (
+ &em_event->popup,
+ "org.gnome.evolution.mail.events");
}
return em_event;
}
EMEventTargetFolder *
-em_event_target_new_folder (EMEvent *eme, const gchar *uri, guint new, const gchar *msg_uid, const gchar *msg_sender, const gchar *msg_subject)
+em_event_target_new_folder (EMEvent *eme,
+ const gchar *uri,
+ guint new,
+ const gchar *msg_uid,
+ const gchar *msg_sender,
+ const gchar *msg_subject)
{
- EMEventTargetFolder *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_FOLDER, sizeof (*t));
+ EMEventTargetFolder *t;
guint32 flags = new ? EM_EVENT_FOLDER_NEWMAIL : 0;
+ t = e_event_target_new (
+ &eme->popup, EM_EVENT_TARGET_FOLDER, sizeof (*t));
+
t->uri = g_strdup (uri);
t->target.mask = ~flags;
t->new = new;
@@ -144,20 +131,33 @@ em_event_target_new_folder (EMEvent *eme, const gchar *uri, guint new, const gch
}
EMEventTargetComposer *
-em_event_target_new_composer (EMEvent *eme, const EMsgComposer *composer, guint32 flags)
+em_event_target_new_composer (EMEvent *eme,
+ EMsgComposer *composer,
+ guint32 flags)
{
- EMEventTargetComposer *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_COMPOSER, sizeof (*t));
+ EMEventTargetComposer *t;
- t->composer = g_object_ref (G_OBJECT (composer));
+ t = e_event_target_new (
+ &eme->popup, EM_EVENT_TARGET_COMPOSER, sizeof (*t));
+
+ t->composer = g_object_ref (composer);
t->target.mask = ~flags;
return t;
}
EMEventTargetMessage *
-em_event_target_new_message (EMEvent *eme, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags, EMsgComposer *composer)
+em_event_target_new_message (EMEvent *eme,
+ CamelFolder *folder,
+ CamelMimeMessage *message,
+ const gchar *uid,
+ guint32 flags,
+ EMsgComposer *composer)
{
- EMEventTargetMessage *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_MESSAGE, sizeof (*t));
+ EMEventTargetMessage *t;
+
+ t = e_event_target_new (
+ &eme->popup, EM_EVENT_TARGET_MESSAGE, sizeof (*t));
t->uid = g_strdup (uid);
t->folder = folder;
@@ -174,9 +174,16 @@ em_event_target_new_message (EMEvent *eme, CamelFolder *folder, CamelMimeMessage
}
EMEventTargetSendReceive *
-em_event_target_new_send_receive (EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags)
+em_event_target_new_send_receive (EMEvent *eme,
+ GtkWidget *table,
+ gpointer data,
+ gint row,
+ guint32 flags)
{
- EMEventTargetSendReceive *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_SEND_RECEIVE, sizeof (*t));
+ EMEventTargetSendReceive *t;
+
+ t = e_event_target_new (
+ &eme->popup, EM_EVENT_TARGET_SEND_RECEIVE, sizeof (*t));
t->table = table;
t->data = data;
@@ -187,9 +194,16 @@ em_event_target_new_send_receive (EMEvent *eme, GtkWidget *table, gpointer data,
}
EMEventTargetCustomIcon *
-em_event_target_new_custom_icon (EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *folder_name, guint32 flags)
+em_event_target_new_custom_icon (EMEvent *eme,
+ GtkTreeStore *store,
+ GtkTreeIter *iter,
+ const gchar *folder_name,
+ guint32 flags)
{
- EMEventTargetCustomIcon *t = e_event_target_new (&eme->popup, EM_EVENT_TARGET_CUSTOM_ICON, sizeof (*t));
+ EMEventTargetCustomIcon *t;
+
+ t = e_event_target_new (
+ &eme->popup, EM_EVENT_TARGET_CUSTOM_ICON, sizeof (*t));
t->store = store;
t->iter = iter;
diff --git a/mail/em-event.h b/mail/em-event.h
index 8f5a87f..34441c5 100644
--- a/mail/em-event.h
+++ b/mail/em-event.h
@@ -21,8 +21,8 @@
*
*/
-#ifndef __EM_EVENT_H__
-#define __EM_EVENT_H__
+#ifndef EM_EVENT_H
+#define EM_EVENT_H
#include <glib-object.h>
@@ -33,6 +33,7 @@ G_BEGIN_DECLS
typedef struct _EMEvent EMEvent;
typedef struct _EMEventClass EMEventClass;
+typedef struct _EMEventPrivate EMEventPrivate;
/* Current target description */
enum _em_event_target_t {
@@ -74,7 +75,7 @@ typedef struct _EMEventTargetFolder EMEventTargetFolder;
struct _EMEventTargetFolder {
EEventTarget target;
gchar *uri;
- guint new;
+ guint new;
gboolean is_inbox;
gchar *name;
@@ -87,9 +88,9 @@ struct _EMEventTargetFolder {
typedef struct _EMEventTargetMessage EMEventTargetMessage;
struct _EMEventTargetMessage {
- EEventTarget target;
- CamelFolder *folder;
- gchar *uid;
+ EEventTarget target;
+ CamelFolder *folder;
+ gchar *uid;
CamelMimeMessage *message;
EMsgComposer *composer;
};
@@ -98,7 +99,6 @@ typedef struct _EMEventTargetComposer EMEventTargetComposer;
struct _EMEventTargetComposer {
EEventTarget target;
-
EMsgComposer *composer;
};
@@ -106,7 +106,6 @@ typedef struct _EMEventTargetSendReceive EMEventTargetSendReceive;
struct _EMEventTargetSendReceive {
EEventTarget target;
-
GtkWidget *table;
gpointer data;
gint row;
@@ -116,10 +115,9 @@ typedef struct _EMEventTargetCustomIcon EMEventTargetCustomIcon;
struct _EMEventTargetCustomIcon {
EEventTarget target;
-
- GtkTreeStore *store;
- GtkTreeIter *iter;
- const gchar *folder_name;
+ GtkTreeStore *store;
+ GtkTreeIter *iter;
+ const gchar *folder_name;
};
typedef struct _EEventItem EMEventItem;
@@ -127,25 +125,47 @@ typedef struct _EEventItem EMEventItem;
/* The object */
struct _EMEvent {
EEvent popup;
-
- struct _EMEventPrivate *priv;
+ EMEventPrivate *priv;
};
struct _EMEventClass {
EEventClass popup_class;
};
-GType em_event_get_type (void);
-
-EMEvent *em_event_peek (void);
-
-EMEventTargetFolder *em_event_target_new_folder (EMEvent *emp, const gchar *uri, guint32 count_new_msgs, const gchar *msg_uid, const gchar *msg_sender, const gchar *msg_subject);
-EMEventTargetComposer *em_event_target_new_composer (EMEvent *emp, const EMsgComposer *composer, guint32 flags);
-EMEventTargetMessage *em_event_target_new_message (EMEvent *emp, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags,
- EMsgComposer *composer);
-EMEventTargetSendReceive * em_event_target_new_send_receive (EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags);
-EMEventTargetCustomIcon * em_event_target_new_custom_icon (EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *uri, guint32 flags);
+GType em_event_get_type (void);
+EMEvent * em_event_peek (void);
+EMEventTargetFolder *
+ em_event_target_new_folder (EMEvent *emp,
+ const gchar *uri,
+ guint32 count_new_msgs,
+ const gchar *msg_uid,
+ const gchar *msg_sender,
+ const gchar *msg_subject);
+EMEventTargetComposer *
+ em_event_target_new_composer (EMEvent *emp,
+ EMsgComposer *composer,
+ guint32 flags);
+EMEventTargetMessage *
+ em_event_target_new_message (EMEvent *emp,
+ CamelFolder *folder,
+ CamelMimeMessage *message,
+ const gchar *uid,
+ guint32 flags,
+ EMsgComposer *composer);
+EMEventTargetSendReceive *
+ em_event_target_new_send_receive
+ (EMEvent *eme,
+ GtkWidget *table,
+ gpointer data,
+ gint row,
+ guint32 flags);
+EMEventTargetCustomIcon *
+ em_event_target_new_custom_icon (EMEvent *eme,
+ GtkTreeStore *store,
+ GtkTreeIter *iter,
+ const gchar *uri,
+ guint32 flags);
G_END_DECLS
-#endif /* __EM_EVENT_H__ */
+#endif /* EM_EVENT_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]