aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
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 /e-util
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 'e-util')
-rw-r--r--e-util/e-activity.c39
-rw-r--r--e-util/e-alert-activity.c43
-rw-r--r--e-util/e-alert-dialog.c5
-rw-r--r--e-util/e-alert.c5
-rw-r--r--e-util/e-bit-array.c5
-rw-r--r--e-util/e-config.c102
-rw-r--r--e-util/e-event.c83
-rw-r--r--e-util/e-extensible.c35
-rw-r--r--e-util/e-extension.c5
-rw-r--r--e-util/e-import.c80
-rw-r--r--e-util/e-io-activity.c42
-rw-r--r--e-util/e-logger.c38
-rw-r--r--e-util/e-module.c38
-rw-r--r--e-util/e-plugin-ui.c41
-rw-r--r--e-util/e-plugin.c129
-rw-r--r--e-util/e-profile-event.c83
-rw-r--r--e-util/e-signature-list.c39
-rw-r--r--e-util/e-signature.c34
-rw-r--r--e-util/e-sorter-array.c5
-rw-r--r--e-util/e-sorter.c5
-rw-r--r--e-util/e-text-event-processor-emacs-like.c3
-rw-r--r--e-util/e-text-event-processor.c5
-rw-r--r--e-util/e-timeout-activity.c43
-rw-r--r--e-util/e-ui-manager.c36
24 files changed, 228 insertions, 715 deletions
diff --git a/e-util/e-activity.c b/e-util/e-activity.c
index f8a3510049..631915db89 100644
--- a/e-util/e-activity.c
+++ b/e-util/e-activity.c
@@ -60,9 +60,13 @@ enum {
LAST_SIGNAL
};
-static gpointer parent_class;
static gulong signals[LAST_SIGNAL];
+G_DEFINE_TYPE (
+ EActivity,
+ e_activity,
+ G_TYPE_OBJECT)
+
static gboolean
activity_describe_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
@@ -183,7 +187,7 @@ activity_finalize (GObject *object)
g_free (priv->secondary_text);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_activity_parent_class)->finalize (object);
}
static void
@@ -241,11 +245,10 @@ activity_describe (EActivity *activity)
}
static void
-activity_class_init (EActivityClass *class)
+e_activity_class_init (EActivityClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EActivityPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -364,37 +367,11 @@ activity_class_init (EActivityClass *class)
}
static void
-activity_init (EActivity *activity)
+e_activity_init (EActivity *activity)
{
activity->priv = E_ACTIVITY_GET_PRIVATE (activity);
}
-GType
-e_activity_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EActivityClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) activity_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EActivity),
- 0, /* n_preallocs */
- (GInstanceInitFunc) activity_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EActivity", &type_info, 0);
- }
-
- return type;
-}
-
EActivity *
e_activity_new (const gchar *primary_text)
{
diff --git a/e-util/e-alert-activity.c b/e-util/e-alert-activity.c
index d27a400206..8e6a6f78e5 100644
--- a/e-util/e-alert-activity.c
+++ b/e-util/e-alert-activity.c
@@ -38,7 +38,10 @@ enum {
PROP_MESSAGE_DIALOG
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EAlertActivity,
+ e_alert_activity,
+ E_TYPE_TIMEOUT_ACTIVITY)
static void
alert_activity_set_message_dialog (EAlertActivity *alert_activity,
@@ -96,7 +99,7 @@ alert_activity_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_alert_activity_parent_class)->dispose (object);
}
static void
@@ -144,7 +147,7 @@ alert_activity_clicked (EActivity *activity)
gtk_widget_hide (message_dialog);
/* Chain up to parent's clicked() method. */
- E_ACTIVITY_CLASS (parent_class)->clicked (activity);
+ E_ACTIVITY_CLASS (e_alert_activity_parent_class)->clicked (activity);
}
static void
@@ -153,17 +156,16 @@ alert_activity_timeout (ETimeoutActivity *activity)
e_activity_complete (E_ACTIVITY (activity));
/* Chain up to parent's timeout() method. */
- E_TIMEOUT_ACTIVITY_CLASS (parent_class)->timeout (activity);
+ E_TIMEOUT_ACTIVITY_CLASS (e_alert_activity_parent_class)->timeout (activity);
}
static void
-alert_activity_class_init (EAlertActivityClass *class)
+e_alert_activity_class_init (EAlertActivityClass *class)
{
GObjectClass *object_class;
EActivityClass *activity_class;
ETimeoutActivityClass *timeout_activity_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EAlertActivityPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -191,40 +193,13 @@ alert_activity_class_init (EAlertActivityClass *class)
}
static void
-alert_activity_init (EAlertActivity *alert_activity)
+e_alert_activity_init (EAlertActivity *alert_activity)
{
alert_activity->priv = E_ALERT_ACTIVITY_GET_PRIVATE (alert_activity);
e_timeout_activity_set_timeout (E_TIMEOUT_ACTIVITY (alert_activity), 60);
}
-GType
-e_alert_activity_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EAlertActivityClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) alert_activity_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EAlertActivity),
- 0, /* n_preallocs */
- (GInstanceInitFunc) alert_activity_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_TIMEOUT_ACTIVITY, "EAlertActivity",
- &type_info, 0);
- }
-
- return type;
-}
-
EActivity *
e_alert_activity_new_info (GtkWidget *message_dialog)
{
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 6f96116c61..cb2dabf74e 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -24,7 +24,10 @@
#include "e-alert-dialog.h"
#include "e-util.h"
-G_DEFINE_TYPE (EAlertDialog, e_alert_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (
+ EAlertDialog,
+ e_alert_dialog,
+ GTK_TYPE_DIALOG)
#define ALERT_DIALOG_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_ALERT_DIALOG, EAlertDialogPrivate))
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index c6b5357923..9ca0c02df3 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -136,7 +136,10 @@ map_type(const gchar *name)
return 3;
}
-G_DEFINE_TYPE (EAlert, e_alert, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+ EAlert,
+ e_alert,
+ G_TYPE_OBJECT)
#define ALERT_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_ALERT, EAlertPrivate))
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
index 1e2635a9e3..785ee45273 100644
--- a/e-util/e-bit-array.c
+++ b/e-util/e-bit-array.c
@@ -36,7 +36,10 @@
#define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32))))
#define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32)))
-G_DEFINE_TYPE (EBitArray, e_bit_array, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+ EBitArray,
+ e_bit_array,
+ G_TYPE_OBJECT)
static void
e_bit_array_insert_real(EBitArray *eba, gint row)
diff --git a/e-util/e-config.c b/e-util/e-config.c
index 44e55a182f..2b8d948fe5 100644
--- a/e-util/e-config.c
+++ b/e-util/e-config.c
@@ -88,10 +88,13 @@ struct _EConfigPrivate {
GList *finish_pages;
};
-static gpointer parent_class;
-
static GtkWidget *ech_config_section_factory (EConfig *config, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data, GtkWidget **real_frame);
+G_DEFINE_TYPE (
+ EConfig,
+ e_config,
+ G_TYPE_OBJECT)
+
static void
config_finalize (GObject *object)
{
@@ -151,7 +154,7 @@ config_finalize (GObject *object)
}
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_config_parent_class)->finalize (object);
}
static void
@@ -173,11 +176,10 @@ config_set_target (EConfig *config,
}
static void
-config_class_init (EConfigClass *class)
+e_config_class_init (EConfigClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EConfigPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -188,46 +190,12 @@ config_class_init (EConfigClass *class)
}
static void
-config_init (EConfig *config)
+e_config_init (EConfig *config)
{
config->priv = E_CONFIG_GET_PRIVATE (config);
}
/**
- * e_config_get_type:
- *
- * Standard GObject method. Used to subclass for the concrete
- * implementations.
- *
- * Return value: EConfig type.
- **/
-GType
-e_config_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EConfigClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) config_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EConfig),
- 0, /* n_preallocs */
- (GInstanceInitFunc) config_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EConfig", &type_info, 0);
- }
-
- return type;
-}
-
-/**
* e_config_construct:
* @ep: The instance to initialise.
* @type: The type of configuration manager, @E_CONFIG_BOOK or
@@ -1585,7 +1553,6 @@ e_config_target_free(EConfig *ep, gpointer o)
*/
-static gpointer emph_parent_class;
#define emph ((EConfigHook *)eph)
static const EPluginHookTargetKey ech_item_types[] = {
@@ -1602,6 +1569,11 @@ static const EPluginHookTargetKey ech_item_types[] = {
{ NULL },
};
+G_DEFINE_TYPE (
+ EConfigHook,
+ e_config_hook,
+ E_TYPE_PLUGIN_HOOK)
+
static void
ech_commit(EConfig *ec, GSList *items, gpointer data)
{
@@ -1854,7 +1826,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
d(printf("loading config hook\n"));
- if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1)
+ if (((EPluginHookClass *)e_config_hook_parent_class)->construct(eph, ep, root) == -1)
return -1;
class = ((EConfigHookClass *)G_OBJECT_GET_CLASS(eph))->config_class;
@@ -1886,47 +1858,31 @@ emph_finalize(GObject *o)
g_slist_foreach(emph->groups, (GFunc)emph_free_group, NULL);
g_slist_free(emph->groups);
- ((GObjectClass *)emph_parent_class)->finalize(o);
+ ((GObjectClass *)e_config_hook_parent_class)->finalize(o);
}
static void
-emph_class_init(EPluginHookClass *class)
+e_config_hook_class_init (EConfigHookClass *class)
{
- ((GObjectClass *)class)->finalize = emph_finalize;
- class->construct = emph_construct;
+ GObjectClass *object_class;
+ EPluginHookClass *plugin_hook_class;
- /* this is actually an abstract implementation but list it anyway */
- class->id = "org.gnome.evolution.config:1.0";
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = emph_finalize;
- d(printf("EConfigHook: init class %p '%s'\n", class, g_type_name(((GObjectClass *)class)->g_type_class.g_type)));
+ plugin_hook_class = E_PLUGIN_HOOK_CLASS (class);
+ plugin_hook_class->construct = emph_construct;
+
+ /* this is actually an abstract implementation but list it anyway */
+ plugin_hook_class->id = "org.gnome.evolution.config:1.0";
- ((EConfigHookClass *)class)->target_map = g_hash_table_new(g_str_hash, g_str_equal);
- ((EConfigHookClass *)class)->config_class = g_type_class_ref(e_config_get_type());
+ class->target_map = g_hash_table_new (g_str_hash, g_str_equal);
+ class->config_class = g_type_class_ref (e_config_get_type());
}
-/**
- * e_config_hook_get_type:
- *
- * Standard GObject function to get the object type.
- *
- * Return value: The EConfigHook class type.
- **/
-GType
-e_config_hook_get_type(void)
+static void
+e_config_hook_init (EConfigHook *hook)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(EConfigHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL,
- sizeof(EConfigHook), 0, (GInstanceInitFunc) NULL,
- };
-
- emph_parent_class = g_type_class_ref(e_plugin_hook_get_type());
- type = g_type_register_static(e_plugin_hook_get_type(), "EConfigHook", &info, 0);
- }
-
- return type;
}
/**
diff --git a/e-util/e-event.c b/e-util/e-event.c
index 81b58e8a04..9edde9c196 100644
--- a/e-util/e-event.c
+++ b/e-util/e-event.c
@@ -55,7 +55,10 @@ struct _EEventPrivate {
GSList *sorted; /* sorted list of struct _event_info's */
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EEvent,
+ e_event,
+ G_TYPE_OBJECT)
static void
event_finalize (GObject *object)
@@ -83,7 +86,7 @@ event_finalize (GObject *object)
g_slist_free(p->sorted);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_event_parent_class)->finalize (object);
}
static void
@@ -95,11 +98,10 @@ event_target_free (EEvent *event,
}
static void
-event_class_init (EEventClass *class)
+e_event_class_init (EEventClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EEventPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -109,39 +111,13 @@ event_class_init (EEventClass *class)
}
static void
-event_init (EEvent *event)
+e_event_init (EEvent *event)
{
event->priv = E_EVENT_GET_PRIVATE (event);
g_queue_init (&event->priv->events);
}
-GType
-e_event_get_type(void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EEventClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) event_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EEvent),
- 0, /* n_preallocs */
- (GInstanceInitFunc) event_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EEvent", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_event_construct:
* @ep: An instantiated but uninitialised EEvent.
@@ -389,7 +365,6 @@ e_event_target_free (EEvent *event,
*/
-static gpointer emph_parent_class;
#define emph ((EEventHook *)eph)
/* must have 1:1 correspondence with e-event types in order */
@@ -399,6 +374,11 @@ static const EPluginHookTargetKey emph_item_types[] = {
{ NULL }
};
+G_DEFINE_TYPE (
+ EEventHook,
+ e_event_hook,
+ E_TYPE_PLUGIN_HOOK)
+
static void
emph_event_handle(EEvent *ee, EEventItem *item, gpointer data)
{
@@ -475,7 +455,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
d(printf("loading event hook\n"));
- if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1)
+ if (((EPluginHookClass *)e_event_hook_parent_class)->construct(eph, ep, root) == -1)
return -1;
class = (EEventHookClass *)G_OBJECT_GET_CLASS(eph);
@@ -501,12 +481,10 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
}
static void
-emph_class_init (EEventHookClass *class)
+e_event_hook_class_init (EEventHookClass *class)
{
EPluginHookClass *plugin_hook_class;
- emph_parent_class = g_type_class_peek_parent (class);
-
plugin_hook_class = E_PLUGIN_HOOK_CLASS (class);
plugin_hook_class->id = "org.gnome.evolution.event:1.0";
plugin_hook_class->construct = emph_construct;
@@ -514,38 +492,9 @@ emph_class_init (EEventHookClass *class)
class->target_map = g_hash_table_new (g_str_hash, g_str_equal);
}
-/**
- * e_event_hook_get_type:
- *
- * Standard GObject function to get the EEvent object type. Used to
- * subclass EEventHook.
- *
- * Return value: The type of the event hook class.
- **/
-GType
-e_event_hook_get_type(void)
+static void
+e_event_hook_init (EEventHook *hook)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EEventHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emph_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EEventHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_PLUGIN_HOOK, "EEventHook", &type_info, 0);
- }
-
- return type;
}
/**
diff --git a/e-util/e-extensible.c b/e-util/e-extensible.c
index b718fc59bf..909003f580 100644
--- a/e-util/e-extensible.c
+++ b/e-util/e-extensible.c
@@ -66,6 +66,11 @@
static GQuark extensible_quark;
+G_DEFINE_INTERFACE (
+ EExtensible,
+ e_extensible,
+ G_TYPE_OBJECT)
+
static GPtrArray *
extensible_get_extensions (EExtensible *extensible)
{
@@ -99,39 +104,11 @@ exit:
}
static void
-extensible_interface_init (EExtensibleInterface *interface)
+e_extensible_default_init (EExtensibleInterface *interface)
{
extensible_quark = g_quark_from_static_string ("e-extensible-quark");
}
-GType
-e_extensible_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EExtensibleInterface),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) extensible_interface_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- 0, /* instance_size */
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_INTERFACE, "EExtensible", &type_info, 0);
-
- g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
- }
-
- return type;
-}
-
/**
* e_extensible_load_extensions:
* @extensible: an #EExtensible
diff --git a/e-util/e-extension.c b/e-util/e-extension.c
index 59eab840c9..75caf5adf4 100644
--- a/e-util/e-extension.c
+++ b/e-util/e-extension.c
@@ -54,7 +54,10 @@ enum {
PROP_EXTENSIBLE
};
-G_DEFINE_ABSTRACT_TYPE (EExtension, e_extension, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (
+ EExtension,
+ e_extension,
+ G_TYPE_OBJECT)
static void
extension_set_extensible (EExtension *extension,
diff --git a/e-util/e-import.c b/e-util/e-import.c
index 14485633c1..700d4b885c 100644
--- a/e-util/e-import.c
+++ b/e-util/e-import.c
@@ -43,7 +43,10 @@ struct _EImportImporters {
gpointer data;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EImport,
+ e_import,
+ G_TYPE_OBJECT)
static void
import_finalize (GObject *object)
@@ -53,7 +56,7 @@ import_finalize (GObject *object)
g_free (import->id);
/* Chain up to parent's finalize () method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_import_parent_class)->finalize (object);
}
static void
@@ -77,50 +80,19 @@ import_target_free (EImport *import,
}
static void
-import_class_init (EImportClass *class)
+e_import_class_init (EImportClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
-
object_class = G_OBJECT_CLASS (class);
object_class->finalize = import_finalize;
class->target_free = import_target_free;
}
-/**
- * e_import_get_type:
- *
- * Standard GObject method. Used to subclass for the concrete
- * implementations.
- *
- * Return value: EImport type.
- **/
-GType
-e_import_get_type (void)
+static void
+e_import_init (EImport *import)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EImportClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) import_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EImport),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EImport", &type_info, 0);
- }
-
- return type;
}
/**
@@ -434,7 +406,6 @@ e_import_target_new_home (EImport *import)
*/
-static gpointer emph_parent_class;
#define emph ((EImportHook *)eph)
static const EImportHookTargetMask eih_no_masks[] = {
@@ -447,6 +418,11 @@ static const EImportHookTargetMap eih_targets[] = {
{ NULL }
};
+G_DEFINE_TYPE (
+ EImportHook,
+ e_import_hook,
+ E_TYPE_PLUGIN_HOOK)
+
static gboolean
eih_supported (EImport *ei,
EImportTarget *target,
@@ -557,7 +533,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
d (printf ("loading import hook\n"));
- if (E_PLUGIN_HOOK_CLASS (emph_parent_class)->construct (eph, ep, root) == -1)
+ if (E_PLUGIN_HOOK_CLASS (e_import_hook_parent_class)->construct (eph, ep, root) == -1)
return -1;
class = E_IMPORT_HOOK_GET_CLASS (eph)->import_class;
@@ -585,7 +561,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
}
static void
-emph_class_init (EImportHookClass *class)
+e_import_hook_class_init (EImportHookClass *class)
{
EPluginHookClass *plugin_hook_class;
gint ii;
@@ -608,31 +584,9 @@ emph_class_init (EImportHookClass *class)
e_import_hook_class_add_target_map (class, &eih_targets[ii]);
}
-GType
-e_import_hook_get_type (void)
+static void
+e_import_hook_init (EImportHook *hook)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EImportHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emph_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EImportHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- emph_parent_class = g_type_class_ref (e_plugin_hook_get_type ());
- type = g_type_register_static (
- E_TYPE_PLUGIN_HOOK, "EImportHook", &type_info, 0);
- }
-
- return type;
}
/**
diff --git a/e-util/e-io-activity.c b/e-util/e-io-activity.c
index 9569e42914..c8eb761708 100644
--- a/e-util/e-io-activity.c
+++ b/e-util/e-io-activity.c
@@ -36,7 +36,10 @@ enum {
PROP_CANCELLABLE
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EIOActivity,
+ e_io_activity,
+ E_TYPE_ACTIVITY)
static void
io_activity_set_property (GObject *object,
@@ -102,7 +105,7 @@ io_activity_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_io_activity_parent_class)->dispose (object);
}
static void
@@ -112,7 +115,7 @@ io_activity_cancelled (EActivity *activity)
GCancellable *cancellable;
/* Chain up to parent's cancelled() method. */
- E_ACTIVITY_CLASS (parent_class)->cancelled (activity);
+ E_ACTIVITY_CLASS (e_io_activity_parent_class)->cancelled (activity);
io_activity = E_IO_ACTIVITY (activity);
cancellable = e_io_activity_get_cancellable (io_activity);
@@ -128,7 +131,7 @@ io_activity_completed (EActivity *activity)
GAsyncResult *async_result;
/* Chain up to parent's completed() method. */
- E_ACTIVITY_CLASS (parent_class)->completed (activity);
+ E_ACTIVITY_CLASS (e_io_activity_parent_class)->completed (activity);
io_activity = E_IO_ACTIVITY (activity);
async_result = e_io_activity_get_async_result (io_activity);
@@ -142,12 +145,11 @@ io_activity_completed (EActivity *activity)
}
static void
-io_activity_class_init (EIOActivityClass *class)
+e_io_activity_class_init (EIOActivityClass *class)
{
GObjectClass *object_class;
EActivityClass *activity_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EIOActivityPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -183,37 +185,11 @@ io_activity_class_init (EIOActivityClass *class)
}
static void
-io_activity_init (EIOActivity *io_activity)
+e_io_activity_init (EIOActivity *io_activity)
{
io_activity->priv = E_IO_ACTIVITY_GET_PRIVATE (io_activity);
}
-GType
-e_io_activity_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EIOActivityClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) io_activity_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EIOActivity),
- 0, /* n_preallocs */
- (GInstanceInitFunc) io_activity_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_ACTIVITY, "EIOActivity", &type_info, 0);
- }
-
- return type;
-}
-
EActivity *
e_io_activity_new (const gchar *primary_text,
GAsyncResult *async_result,
diff --git a/e-util/e-logger.c b/e-util/e-logger.c
index fa2d548b23..6dd08c722d 100644
--- a/e-util/e-logger.c
+++ b/e-util/e-logger.c
@@ -55,7 +55,10 @@ enum {
PROP_NAME
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ ELogger,
+ e_logger,
+ G_TYPE_OBJECT)
static gboolean
logger_flush (ELogger *logger)
@@ -150,15 +153,14 @@ logger_finalize (GObject *object)
g_free (logger->priv->logfile);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_logger_parent_class)->finalize (object);
}
static void
-logger_class_init (ELoggerClass *class)
+e_logger_class_init (ELoggerClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ELoggerPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -179,37 +181,11 @@ logger_class_init (ELoggerClass *class)
}
static void
-logger_init (ELogger *logger)
+e_logger_init (ELogger *logger)
{
logger->priv = E_LOGGER_GET_PRIVATE (logger);
}
-GType
-e_logger_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (ELoggerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) logger_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ELogger),
- 0, /* n_preallocs */
- (GInstanceInitFunc) logger_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "ELogger", &type_info, 0);
- }
-
- return type;
-}
-
ELogger *
e_logger_new (const gchar *name)
{
diff --git a/e-util/e-module.c b/e-util/e-module.c
index 17c048e2d3..7b4801df47 100644
--- a/e-util/e-module.c
+++ b/e-util/e-module.c
@@ -52,7 +52,10 @@ enum {
PROP_FILENAME
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EModule,
+ e_module,
+ G_TYPE_TYPE_MODULE)
static void
module_set_filename (EModule *module,
@@ -107,7 +110,7 @@ module_finalize (GObject *object)
g_free (priv->filename);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_module_parent_class)->finalize (object);
}
static gboolean
@@ -164,12 +167,11 @@ module_unload (GTypeModule *type_module)
}
static void
-module_class_init (EModuleClass *class)
+e_module_class_init (EModuleClass *class)
{
GObjectClass *object_class;
GTypeModuleClass *type_module_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EModulePrivate));
object_class = G_OBJECT_CLASS (class);
@@ -199,37 +201,11 @@ module_class_init (EModuleClass *class)
}
static void
-module_init (EModule *module)
+e_module_init (EModule *module)
{
module->priv = E_MODULE_GET_PRIVATE (module);
}
-GType
-e_module_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EModuleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) module_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EModule),
- 0, /* n_preallocs */
- (GInstanceInitFunc) module_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_TYPE_MODULE, "EModule", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_module_new:
* @filename: filename of the shared library module
diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c
index 999b1e82d2..a03c6193ef 100644
--- a/e-util/e-plugin-ui.c
+++ b/e-util/e-plugin-ui.c
@@ -163,7 +163,10 @@ struct _EPluginUIHookPrivate {
GHashTable *registry;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EPluginUIHook,
+ e_plugin_ui_hook,
+ E_TYPE_PLUGIN_HOOK)
static void
plugin_ui_hook_unregister_manager (EPluginUIHook *hook,
@@ -408,7 +411,7 @@ plugin_ui_hook_finalize (GObject *object)
g_hash_table_destroy (priv->registry);
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_plugin_ui_hook_parent_class)->dispose (object);
}
static gint
@@ -425,7 +428,8 @@ plugin_ui_hook_construct (EPluginHook *hook,
* we wouldn't have to chain up here. */
/* Chain up to parent's construct() method. */
- E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node);
+ E_PLUGIN_HOOK_CLASS (e_plugin_ui_hook_parent_class)->
+ construct (hook, plugin, node);
for (node = xmlFirstElementChild (node); node != NULL;
node = xmlNextElementSibling (node)) {
@@ -483,12 +487,11 @@ plugin_ui_hook_enable (EPluginHook *hook,
}
static void
-plugin_ui_hook_class_init (EPluginUIHookClass *class)
+e_plugin_ui_hook_class_init (EPluginUIHookClass *class)
{
GObjectClass *object_class;
EPluginHookClass *plugin_hook_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EPluginUIHookPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -501,7 +504,7 @@ plugin_ui_hook_class_init (EPluginUIHookClass *class)
}
static void
-plugin_ui_hook_init (EPluginUIHook *hook)
+e_plugin_ui_hook_init (EPluginUIHook *hook)
{
GHashTable *ui_definitions;
GHashTable *callbacks;
@@ -525,32 +528,6 @@ plugin_ui_hook_init (EPluginUIHook *hook)
hook->priv->registry = registry;
}
-GType
-e_plugin_ui_hook_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EPluginUIHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) plugin_ui_hook_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EPluginUIHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) plugin_ui_hook_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_PLUGIN_HOOK, "EPluginUIHook", &type_info, 0);
- }
-
- return type;
-}
-
void
e_plugin_ui_register_manager (GtkUIManager *ui_manager,
const gchar *id,
diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c
index 2b85f61c84..a1906d7f3f 100644
--- a/e-util/e-plugin.c
+++ b/e-util/e-plugin.c
@@ -64,7 +64,6 @@
*/
/* EPlugin stuff */
-static gpointer ep_parent_class;
/* global table of plugin types by pluginclass.type */
static GHashTable *ep_types;
@@ -94,6 +93,11 @@ enum {
EP_PROP_ENABLED
};
+G_DEFINE_TYPE (
+ EPlugin,
+ e_plugin,
+ G_TYPE_OBJECT)
+
static gboolean
ep_check_enabled (const gchar *id)
{
@@ -269,15 +273,14 @@ ep_finalize (GObject *object)
g_slist_free (ep->hooks);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (ep_parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_plugin_parent_class)->finalize (object);
}
static void
-ep_class_init (EPluginClass *class)
+e_plugin_class_init (EPluginClass *class)
{
GObjectClass *object_class;
-
- ep_parent_class = g_type_class_peek_parent (class);
+ gchar *path, *col, *p;
object_class = G_OBJECT_CLASS (class);
object_class->set_property = ep_set_property;
@@ -296,67 +299,31 @@ ep_class_init (EPluginClass *class)
"Whether the plugin is enabled",
TRUE,
G_PARAM_READWRITE));
-}
-static void
-ep_init (EPlugin *ep)
-{
- ep->enabled = TRUE;
-}
+ /* Add paths in the environment variable or default global
+ * and user specific paths */
+ path = g_strdup(g_getenv("EVOLUTION_PLUGIN_PATH"));
+ if (path == NULL) {
+ /* Add the global path */
+ e_plugin_add_load_path(EVOLUTION_PLUGINDIR);
-/**
- * e_plugin_get_type:
- *
- * Standard GObject type function. This is only an abstract class, so
- * you can only use this to subclass EPlugin.
- *
- * Return value: The type.
- **/
-GType
-e_plugin_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- gchar *path, *col, *p;
-
- static const GTypeInfo type_info = {
- sizeof (EPluginClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ep_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EPlugin),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ep_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EPlugin", &type_info, 0);
-
- /* Add paths in the environment variable or default global
- * and user specific paths */
- path = g_strdup(g_getenv("EVOLUTION_PLUGIN_PATH"));
- if (path == NULL) {
- /* Add the global path */
- e_plugin_add_load_path(EVOLUTION_PLUGINDIR);
-
- path = g_build_filename(g_get_home_dir(), ".eplugins", NULL);
- }
+ path = g_build_filename(g_get_home_dir(), ".eplugins", NULL);
+ }
- p = path;
- while ((col = strchr(p, G_SEARCHPATH_SEPARATOR))) {
- *col++ = 0;
- e_plugin_add_load_path(p);
- p = col;
- }
+ p = path;
+ while ((col = strchr(p, G_SEARCHPATH_SEPARATOR))) {
+ *col++ = 0;
e_plugin_add_load_path(p);
- g_free(path);
+ p = col;
}
+ e_plugin_add_load_path(p);
+ g_free(path);
+}
- return type;
+static void
+e_plugin_init (EPlugin *ep)
+{
+ ep->enabled = TRUE;
}
static EPlugin *
@@ -897,7 +864,10 @@ e_plugin_xml_content_domain(xmlNodePtr node, const gchar *domain)
/* ********************************************************************** */
-static gpointer eph_parent_class;
+G_DEFINE_TYPE (
+ EPluginHook,
+ e_plugin_hook,
+ G_TYPE_OBJECT)
static gint
eph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
@@ -914,46 +884,15 @@ eph_enable(EPluginHook *eph, gint state)
}
static void
-eph_class_init(EPluginHookClass *class)
+e_plugin_hook_class_init (EPluginHookClass *class)
{
- eph_parent_class = g_type_class_peek_parent (class);
-
class->construct = eph_construct;
class->enable = eph_enable;
}
-/**
- * e_plugin_hook_get_type:
- *
- * Standard GObject function to retrieve the EPluginHook type. Since
- * EPluginHook is an abstract class, this is only used to subclass it.
- *
- * Return value: The EPluginHook type.
- **/
-GType
-e_plugin_hook_get_type(void)
+static void
+e_plugin_hook_init (EPluginHook *hook)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EPluginHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eph_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EPluginHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EPluginHook", &type_info, 0);
- }
-
- return type;
}
/**
diff --git a/e-util/e-profile-event.c b/e-util/e-profile-event.c
index 33d7dfbdf7..fc2a609b26 100644
--- a/e-util/e-profile-event.c
+++ b/e-util/e-profile-event.c
@@ -31,20 +31,12 @@
#include "e-profile-event.h"
-static GObjectClass *eme_parent;
static EProfileEvent *e_profile_event;
-static void
-eme_init(GObject *o)
-{
- /*EProfileEvent *eme = (EProfileEvent *)o; */
-}
-
-static void
-eme_finalise(GObject *o)
-{
- ((GObjectClass *)eme_parent)->finalize(o);
-}
+G_DEFINE_TYPE (
+ EProfileEvent,
+ e_profile_event,
+ E_TYPE_EVENT)
static void
eme_target_free(EEvent *ep, EEventTarget *t)
@@ -58,35 +50,18 @@ eme_target_free(EEvent *ep, EEventTarget *t)
break; }
}
- ((EEventClass *)eme_parent)->target_free(ep, t);
+ ((EEventClass *)e_profile_event_parent_class)->target_free(ep, t);
}
static void
-eme_class_init(GObjectClass *klass)
+e_profile_event_class_init (EProfileEventClass *class)
{
- klass->finalize = eme_finalise;
- ((EEventClass *)klass)->target_free = eme_target_free;
+ ((EEventClass *)class)->target_free = eme_target_free;
}
-GType
-e_profile_event_get_type(void)
+static void
+e_profile_event_init (EProfileEvent *event)
{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(EProfileEventClass),
- NULL, NULL,
- (GClassInitFunc)eme_class_init,
- NULL, NULL,
- sizeof(EProfileEvent), 0,
- (GInstanceInitFunc)eme_init
- };
- eme_parent = g_type_class_ref(e_event_get_type());
- type = g_type_register_static(e_event_get_type(), "EProfileEvent", &info, 0);
- }
-
- return type;
}
EProfileEvent *
@@ -136,9 +111,6 @@ e_profile_event_emit(const gchar *id, const gchar *uid, guint32 flags)
/* ********************************************************************** */
-static gpointer emeh_parent_class;
-#define emeh ((EProfileEventHook *)eph)
-
static const EEventHookTargetMask emeh_profile_masks[] = {
{ "start", E_PROFILE_EVENT_START },
{ "end", E_PROFILE_EVENT_END },
@@ -151,42 +123,25 @@ static const EEventHookTargetMap emeh_targets[] = {
{ NULL }
};
-static void
-emeh_finalise(GObject *o)
-{
- /*EPluginHook *eph = (EPluginHook *)o;*/
-
- ((GObjectClass *)emeh_parent_class)->finalize(o);
-}
+G_DEFINE_TYPE (
+ EProfileEventHook,
+ e_profile_event_hook,
+ E_TYPE_EVENT_HOOK)
static void
-emeh_class_init(EPluginHookClass *klass)
+e_profile_event_hook_class_init (EProfileEventHookClass *class)
{
gint i;
- ((GObjectClass *)klass)->finalize = emeh_finalise;
- ((EPluginHookClass *)klass)->id = "org.gnome.evolution.profile.events:1.0";
+ ((EPluginHookClass *)class)->id = "org.gnome.evolution.profile.events:1.0";
for (i=0;emeh_targets[i].type;i++)
- e_event_hook_class_add_target_map((EEventHookClass *)klass, &emeh_targets[i]);
+ e_event_hook_class_add_target_map((EEventHookClass *)class, &emeh_targets[i]);
- ((EEventHookClass *)klass)->event = (EEvent *)e_profile_event_peek();
+ ((EEventHookClass *)class)->event = (EEvent *)e_profile_event_peek();
}
-GType
-e_profile_event_hook_get_type(void)
+static void
+e_profile_event_hook_init (EProfileEventHook *hook)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof(EProfileEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL,
- sizeof(EProfileEventHook), 0, (GInstanceInitFunc) NULL,
- };
-
- emeh_parent_class = g_type_class_ref(e_event_hook_get_type());
- type = g_type_register_static(e_event_hook_get_type(), "EProfileEventHook", &info, 0);
- }
-
- return type;
}
diff --git a/e-util/e-signature-list.c b/e-util/e-signature-list.c
index 449d2bbd9d..2c8fb5160d 100644
--- a/e-util/e-signature-list.c
+++ b/e-util/e-signature-list.c
@@ -46,47 +46,22 @@ enum {
static guint signals [LAST_SIGNAL] = { 0 };
-static void e_signature_list_class_init (ESignatureListClass *klass);
-static void e_signature_list_init (ESignatureList *list, ESignatureListClass *klass);
static void e_signature_list_finalize (GObject *object);
static void e_signature_list_dispose (GObject *object);
-static EListClass *parent_class = NULL;
-
-GType
-e_signature_list_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo type_info = {
- sizeof (ESignatureListClass),
- NULL, NULL,
- (GClassInitFunc) e_signature_list_class_init,
- NULL, NULL,
- sizeof (ESignatureList),
- 0,
- (GInstanceInitFunc) e_signature_list_init,
- };
-
- type = g_type_register_static (E_TYPE_LIST, "ESignatureList", &type_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (
+ ESignatureList,
+ e_signature_list,
+ E_TYPE_LIST)
static void
e_signature_list_class_init (ESignatureListClass *klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref (E_TYPE_LIST);
-
- /* virtual method override */
object_class->dispose = e_signature_list_dispose;
object_class->finalize = e_signature_list_finalize;
- /* signals */
signals[SIGNATURE_ADDED] =
g_signal_new ("signature-added",
G_OBJECT_CLASS_TYPE (object_class),
@@ -117,7 +92,7 @@ e_signature_list_class_init (ESignatureListClass *klass)
}
static void
-e_signature_list_init (ESignatureList *list, ESignatureListClass *klass)
+e_signature_list_init (ESignatureList *list)
{
list->priv = g_new0 (struct _ESignatureListPrivate, 1);
}
@@ -134,7 +109,7 @@ e_signature_list_dispose (GObject *object)
list->priv->gconf = NULL;
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_signature_list_parent_class)->dispose (object);
}
static void
@@ -144,7 +119,7 @@ e_signature_list_finalize (GObject *object)
g_free (list->priv);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_signature_list_parent_class)->finalize (object);
}
static GSList *
diff --git a/e-util/e-signature.c b/e-util/e-signature.c
index 6b9c1abdbe..1ac5616eef 100644
--- a/e-util/e-signature.c
+++ b/e-util/e-signature.c
@@ -60,7 +60,10 @@ enum {
PROP_UID
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ ESignature,
+ e_signature,
+ G_TYPE_OBJECT)
static gboolean
xml_set_bool (xmlNodePtr node,
@@ -235,7 +238,7 @@ signature_finalize (GObject *object)
g_free (priv->uid);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_signature_parent_class)->finalize (object);
}
static void
@@ -243,7 +246,6 @@ e_signature_class_init (ESignatureClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ESignaturePrivate));
object_class = G_OBJECT_CLASS (class);
@@ -324,32 +326,6 @@ e_signature_init (ESignature *signature)
signature->priv = E_SIGNATURE_GET_PRIVATE (signature);
}
-GType
-e_signature_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- GTypeInfo type_info = {
- sizeof (ESignatureClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) e_signature_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ESignature),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_signature_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "ESignature", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_signature_new:
*
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
index c427df65dd..16971ffbe8 100644
--- a/e-util/e-sorter-array.c
+++ b/e-util/e-sorter-array.c
@@ -32,7 +32,10 @@
#define INCREMENT_AMOUNT 100
-G_DEFINE_TYPE (ESorterArray, e_sorter_array, E_SORTER_TYPE)
+G_DEFINE_TYPE (
+ ESorterArray,
+ e_sorter_array,
+ E_SORTER_TYPE)
static void esa_sort (ESorterArray *esa);
static void esa_backsort (ESorterArray *esa);
diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c
index 14b469b734..a2ff83f53d 100644
--- a/e-util/e-sorter.c
+++ b/e-util/e-sorter.c
@@ -32,7 +32,10 @@
#define PARENT_TYPE G_TYPE_OBJECT
-G_DEFINE_TYPE (ESorter, e_sorter, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+ ESorter,
+ e_sorter,
+ G_TYPE_OBJECT)
static gint es_model_to_sorted (ESorter *es, gint row);
static gint es_sorted_to_model (ESorter *es, gint row);
diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c
index c69b79c6a3..bb8f7b6630 100644
--- a/e-util/e-text-event-processor-emacs-like.c
+++ b/e-util/e-text-event-processor-emacs-like.c
@@ -35,7 +35,8 @@ static gint e_text_event_processor_emacs_like_event
G_DEFINE_TYPE (
ETextEventProcessorEmacsLike,
- e_text_event_processor_emacs_like, E_TEXT_EVENT_PROCESSOR_TYPE)
+ e_text_event_processor_emacs_like,
+ E_TEXT_EVENT_PROCESSOR_TYPE)
/* The arguments we take */
enum {
diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c
index 090b7e6b0e..c79033d702 100644
--- a/e-util/e-text-event-processor.c
+++ b/e-util/e-text-event-processor.c
@@ -49,7 +49,10 @@ enum {
static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (ETextEventProcessor, e_text_event_processor, G_TYPE_OBJECT)
+G_DEFINE_TYPE (
+ ETextEventProcessor,
+ e_text_event_processor,
+ G_TYPE_OBJECT)
static void
e_text_event_processor_class_init (ETextEventProcessorClass *klass)
diff --git a/e-util/e-timeout-activity.c b/e-util/e-timeout-activity.c
index aa57960fe0..4ddf39f89c 100644
--- a/e-util/e-timeout-activity.c
+++ b/e-util/e-timeout-activity.c
@@ -36,9 +36,13 @@ enum {
LAST_SIGNAL
};
-static gpointer parent_class;
static gulong signals[LAST_SIGNAL];
+G_DEFINE_TYPE (
+ ETimeoutActivity,
+ e_timeout_activity,
+ E_TYPE_ACTIVITY)
+
static gboolean
timeout_activity_cb (ETimeoutActivity *timeout_activity)
{
@@ -58,7 +62,7 @@ timeout_activity_finalize (GObject *object)
g_source_remove (priv->timeout_id);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_timeout_activity_parent_class)->finalize (object);
}
static void
@@ -74,7 +78,7 @@ timeout_activity_cancelled (EActivity *activity)
}
/* Chain up to parent's cancelled() method. */
- E_ACTIVITY_CLASS (parent_class)->cancelled (activity);
+ E_ACTIVITY_CLASS (e_timeout_activity_parent_class)->cancelled (activity);
}
static void
@@ -90,7 +94,7 @@ timeout_activity_completed (EActivity *activity)
}
/* Chain up to parent's completed() method. */
- E_ACTIVITY_CLASS (parent_class)->completed (activity);
+ E_ACTIVITY_CLASS (e_timeout_activity_parent_class)->completed (activity);
}
static void
@@ -100,12 +104,11 @@ timeout_activity_timeout (ETimeoutActivity *timeout_activity)
}
static void
-timeout_activity_class_init (ETimeoutActivityClass *class)
+e_timeout_activity_class_init (ETimeoutActivityClass *class)
{
GObjectClass *object_class;
EActivityClass *activity_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ETimeoutActivityPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -128,38 +131,12 @@ timeout_activity_class_init (ETimeoutActivityClass *class)
}
static void
-timeout_activity_init (ETimeoutActivity *timeout_activity)
+e_timeout_activity_init (ETimeoutActivity *timeout_activity)
{
timeout_activity->priv =
E_TIMEOUT_ACTIVITY_GET_PRIVATE (timeout_activity);
}
-GType
-e_timeout_activity_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (ETimeoutActivityClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) timeout_activity_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ETimeoutActivity),
- 0, /* n_preallocs */
- (GInstanceInitFunc) timeout_activity_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_ACTIVITY, "ETimeoutActivity", &type_info, 0);
- }
-
- return type;
-}
-
EActivity *
e_timeout_activity_new (const gchar *primary_text)
{
diff --git a/e-util/e-ui-manager.c b/e-util/e-ui-manager.c
index f108cd37c5..ef004b4da6 100644
--- a/e-util/e-ui-manager.c
+++ b/e-util/e-ui-manager.c
@@ -56,7 +56,10 @@ enum {
PROP_EXPRESS_MODE
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EUIManager,
+ e_ui_manager,
+ GTK_TYPE_UI_MANAGER)
static void
ui_manager_set_property (GObject *object,
@@ -136,11 +139,10 @@ ui_manager_filter_ui (EUIManager *ui_manager,
}
static void
-ui_manager_class_init (EUIManagerClass *class)
+e_ui_manager_class_init (EUIManagerClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EUIManagerPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -162,37 +164,11 @@ ui_manager_class_init (EUIManagerClass *class)
}
static void
-ui_manager_init (EUIManager *ui_manager)
+e_ui_manager_init (EUIManager *ui_manager)
{
ui_manager->priv = E_UI_MANAGER_GET_PRIVATE (ui_manager);
}
-GType
-e_ui_manager_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EUIManagerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ui_manager_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EUIManager),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ui_manager_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_UI_MANAGER, "EUIManager", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_ui_manager_new:
*