diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-24 23:21:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-25 02:37:02 +0800 |
commit | ecf3434da05b1f39f793c24b38bfd278e10b5786 (patch) | |
tree | 485ed2399920ecb10dbee2b4db4c437c22574a20 /widgets/misc/e-attachment.c | |
parent | f1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff) | |
download | gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.bz2 gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.lz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.xz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.zst gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.zip |
GObject boilerplate cleanup.
Prefer thread-safe G_DEFINE_TYPE and G_DEFINE_INTERFACE macros over
manual GType registration.
This is just a start... lots more to do.
Diffstat (limited to 'widgets/misc/e-attachment.c')
-rw-r--r-- | widgets/misc/e-attachment.c | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index 56659ae01c..e8ba75abee 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -96,7 +96,10 @@ enum { PROP_SIGNED }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EAttachment, + e_attachment, + G_TYPE_OBJECT) static gboolean create_system_thumbnail (EAttachment *attachment, GIcon **icon) @@ -701,7 +704,7 @@ attachment_dispose (GObject *object) priv->reference = NULL; /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_attachment_parent_class)->dispose (object); } static void @@ -714,15 +717,14 @@ attachment_finalize (GObject *object) g_free (priv->disposition); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_attachment_parent_class)->finalize (object); } static void -attachment_class_init (EAttachmentClass *class) +e_attachment_class_init (EAttachmentClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EAttachmentPrivate)); object_class = G_OBJECT_CLASS (class); @@ -877,7 +879,7 @@ attachment_class_init (EAttachmentClass *class) } static void -attachment_init (EAttachment *attachment) +e_attachment_init (EAttachment *attachment) { attachment->priv = E_ATTACHMENT_GET_PRIVATE (attachment); attachment->priv->cancellable = g_cancellable_new (); @@ -937,32 +939,6 @@ attachment_init (EAttachment *attachment) G_CALLBACK (attachment_cancelled_cb), attachment); } -GType -e_attachment_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EAttachmentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) attachment_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EAttachment), - 0, /* n_preallocs */ - (GInstanceInitFunc) attachment_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "EAttachment", &type_info, 0); - } - - return type; -} - EAttachment * e_attachment_new (void) { |