aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail/em-mailer-prefs.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-24 23:21:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-25 02:37:02 +0800
commitecf3434da05b1f39f793c24b38bfd278e10b5786 (patch)
tree485ed2399920ecb10dbee2b4db4c437c22574a20 /modules/mail/em-mailer-prefs.c
parentf1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff)
downloadgsoc2013-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 'modules/mail/em-mailer-prefs.c')
-rw-r--r--modules/mail/em-mailer-prefs.c62
1 files changed, 19 insertions, 43 deletions
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 7a6b86da18..751c395223 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -52,12 +52,6 @@
#include "em-config.h"
#include "mail-session.h"
-static void em_mailer_prefs_class_init (EMMailerPrefsClass *class);
-static void em_mailer_prefs_init (EMMailerPrefs *dialog);
-static void em_mailer_prefs_finalize (GObject *object);
-
-static GtkVBoxClass *parent_class = NULL;
-
enum {
HEADER_LIST_NAME_COLUMN, /* displayable name of the header (may be a translation) */
HEADER_LIST_ENABLED_COLUMN, /* is the header enabled? */
@@ -100,36 +94,34 @@ static const struct {
{ N_("Once per month"), 30 },
};
-GType
-em_mailer_prefs_get_type (void)
+G_DEFINE_TYPE (
+ EMMailerPrefs,
+ em_mailer_prefs,
+ GTK_TYPE_VBOX)
+
+static void
+em_mailer_prefs_finalize (GObject *object)
{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo type_info = {
- sizeof (EMMailerPrefsClass),
- NULL, NULL,
- (GClassInitFunc) em_mailer_prefs_class_init,
- NULL, NULL,
- sizeof (EMMailerPrefs),
- 0,
- (GInstanceInitFunc) em_mailer_prefs_init,
- };
-
- type = g_type_register_static (gtk_vbox_get_type (), "EMMailerPrefs", &type_info, 0);
+ EMMailerPrefs *prefs = (EMMailerPrefs *) object;
+
+ g_object_unref (prefs->builder);
+
+ if (prefs->labels_change_notify_id) {
+ gconf_client_notify_remove (prefs->gconf, prefs->labels_change_notify_id);
+
+ prefs->labels_change_notify_id = 0;
}
- return type;
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (em_mailer_prefs_parent_class)->finalize (object);
}
static void
-em_mailer_prefs_class_init (EMMailerPrefsClass *klass)
+em_mailer_prefs_class_init (EMMailerPrefsClass *class)
{
GObjectClass *object_class;
- object_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref (gtk_vbox_get_type ());
-
+ object_class = G_OBJECT_CLASS (class);
object_class->finalize = em_mailer_prefs_finalize;
}
@@ -139,22 +131,6 @@ em_mailer_prefs_init (EMMailerPrefs *preferences)
preferences->gconf = mail_config_get_gconf_client ();
}
-static void
-em_mailer_prefs_finalize (GObject *obj)
-{
- EMMailerPrefs *prefs = (EMMailerPrefs *) obj;
-
- g_object_unref (prefs->builder);
-
- if (prefs->labels_change_notify_id) {
- gconf_client_notify_remove (prefs->gconf, prefs->labels_change_notify_id);
-
- prefs->labels_change_notify_id = 0;
- }
-
- ((GObjectClass *)(parent_class))->finalize (obj);
-}
-
static gboolean
mark_seen_timeout_transform (const GValue *src_value,
GValue *dst_value,