From 3b74f2348e60711c0141ac9888efd9a9973db34b Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 21 Dec 2004 15:50:38 +0000 Subject: convert to G_DEFINE_TYPE 2004-12-21 JP Rosevear * e-account.c: convert to G_DEFINE_TYPE * e-account-list.c: ditto svn path=/trunk/; revision=28165 --- e-util/ChangeLog | 6 ++++++ e-util/e-account-list.c | 36 +++++++++++++++--------------------- e-util/e-account.c | 28 ++++++++++++---------------- 3 files changed, 33 insertions(+), 37 deletions(-) (limited to 'e-util') diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 038bee15f8..da69ed5fcf 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2004-12-21 JP Rosevear + + * e-account.c: convert to G_DEFINE_TYPE + + * e-account-list.c: ditto + 2004-12-08 Not Zed * e-plugin.c (e_plugin_load_plugins): kill warning if we can't diff --git a/e-util/e-account-list.c b/e-util/e-account-list.c index d0463a810b..c4968d82b3 100644 --- a/e-util/e-account-list.c +++ b/e-util/e-account-list.c @@ -18,7 +18,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "e-account-list.h" @@ -26,7 +26,6 @@ #include "e-util-marshal.h" #include -#include struct EAccountListPrivate { GConfClient *gconf; @@ -42,20 +41,20 @@ enum { static guint signals [LAST_SIGNAL] = { 0 }; -#define PARENT_TYPE E_TYPE_LIST -static EListClass *parent_class = NULL; +static void e_account_list_dispose (GObject *); +static void e_account_list_finalize (GObject *); -static void dispose (GObject *); -static void finalize (GObject *); +G_DEFINE_TYPE (EAccountList, e_account_list, E_TYPE_LIST) static void -class_init (GObjectClass *object_class) +e_account_list_class_init (EAccountListClass *klass) { - parent_class = g_type_class_ref (PARENT_TYPE); - + GObjectClass *object_class; + /* virtual method override */ - object_class->dispose = dispose; - object_class->finalize = finalize; + object_class = G_OBJECT_CLASS (klass); + object_class->dispose = e_account_list_dispose; + object_class->finalize = e_account_list_finalize; /* signals */ signals[ACCOUNT_ADDED] = @@ -88,15 +87,13 @@ class_init (GObjectClass *object_class) } static void -init (GObject *object) +e_account_list_init (EAccountList *account_list) { - EAccountList *account_list = E_ACCOUNT_LIST (object); - account_list->priv = g_new0 (EAccountListPrivate, 1); } static void -dispose (GObject *object) +e_account_list_dispose (GObject *object) { EAccountList *account_list = E_ACCOUNT_LIST (object); @@ -109,22 +106,19 @@ dispose (GObject *object) account_list->priv->gconf = NULL; } - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_account_list_parent_class)->dispose (object); } static void -finalize (GObject *object) +e_account_list_finalize (GObject *object) { EAccountList *account_list = E_ACCOUNT_LIST (object); g_free (account_list->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_account_list_parent_class)->finalize (object); } -E_MAKE_TYPE (e_account_list, "EAccountList", EAccountList, class_init, init, PARENT_TYPE) - - static void gconf_accounts_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) diff --git a/e-util/e-account.c b/e-util/e-account.c index c75c0cf7f8..b919a56cc2 100644 --- a/e-util/e-account.c +++ b/e-util/e-account.c @@ -18,7 +18,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "e-account.h" @@ -27,16 +27,12 @@ #include -#include #include #include #include #include -#define PARENT_TYPE G_TYPE_OBJECT -static GObjectClass *parent_class = NULL; - enum { CHANGED, LAST_SIGNAL @@ -44,6 +40,8 @@ enum { static guint signals[LAST_SIGNAL]; +G_DEFINE_TYPE (EAccount, e_account, G_TYPE_OBJECT) + /* lock mail accounts Relatively difficult -- involves redesign of the XML blobs which describe accounts disable adding mail accounts Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable @@ -79,15 +77,16 @@ set trash emptying frequency ** lock destination account/options */ -static void finalize (GObject *); +static void e_account_finalize (GObject *); static void -class_init (GObjectClass *object_class) +e_account_class_init (EAccountClass *klass) { - parent_class = g_type_class_ref (PARENT_TYPE); - + GObjectClass *object_class; + /* virtual method override */ - object_class->finalize = finalize; + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = e_account_finalize; signals[CHANGED] = g_signal_new("changed", @@ -101,7 +100,7 @@ class_init (GObjectClass *object_class) } static void -init (EAccount *account) +e_account_init (EAccount *account) { account->id = g_new0 (EAccountIdentity, 1); account->source = g_new0 (EAccountService, 1); @@ -138,7 +137,7 @@ service_destroy (EAccountService *service) } static void -finalize (GObject *object) +e_account_finalize (GObject *object) { EAccount *account = E_ACCOUNT (object); @@ -159,12 +158,9 @@ finalize (GObject *object) g_free (account->smime_sign_key); g_free (account->smime_encrypt_key); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_account_parent_class)->finalize (object); } -E_MAKE_TYPE (e_account, "EAccount", EAccount, class_init, init, PARENT_TYPE) - - /** * e_account_new: * -- cgit v1.2.3