aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-10-10 01:03:47 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-10-10 03:30:44 +0800
commit3964b272b70e87bf93bd26a1d2303496ea0b2b6c (patch)
tree2cfe27ef58ea53db1b90f65d87b7fdf04767c8f1
parentd7d55d68842fa62bc2740dc9d8ae53f435ea9c81 (diff)
downloadgsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar.gz
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar.bz2
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar.lz
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar.xz
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.tar.zst
gsoc2013-evolution-3964b272b70e87bf93bd26a1d2303496ea0b2b6c.zip
ECalConfigDateEdit: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions. (cherry picked from commit 6fd48fd4df20ebf76382ebb441e81e85be7e3719)
-rw-r--r--modules/calendar/e-cal-config-date-edit.c60
-rw-r--r--modules/calendar/e-cal-config-date-edit.h39
-rw-r--r--modules/calendar/evolution-module-calendar.c2
3 files changed, 74 insertions, 27 deletions
diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c
index f936a0b182..3f28520bb0 100644
--- a/modules/calendar/e-cal-config-date-edit.c
+++ b/modules/calendar/e-cal-config-date-edit.c
@@ -22,12 +22,21 @@
#include "e-cal-config-date-edit.h"
-#include <libebackend/libebackend.h>
-
#include <shell/e-shell.h>
#include <misc/e-dateedit.h>
-static gpointer parent_class;
+#define E_CAL_CONFIG_DATE_EDIT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_CONFIG_DATE_EDIT, ECalConfigDateEditPrivate))
+
+struct _ECalConfigDateEditPrivate {
+ gint placeholder;
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ ECalConfigDateEdit,
+ e_cal_config_date_edit,
+ E_TYPE_EXTENSION)
static void
cal_config_date_edit_constructed (GObject *object)
@@ -54,39 +63,42 @@ cal_config_date_edit_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_cal_config_date_edit_parent_class)->
+ constructed (object);
}
static void
-cal_config_date_edit_class_init (EExtensionClass *class)
+e_cal_config_date_edit_class_init (ECalConfigDateEditClass *class)
{
GObjectClass *object_class;
+ EExtensionClass *extension_class;
- parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECalConfigDateEditPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->constructed = cal_config_date_edit_constructed;
- class->extensible_type = E_TYPE_DATE_EDIT;
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_DATE_EDIT;
+}
+
+static void
+e_cal_config_date_edit_class_finalize (ECalConfigDateEditClass *class)
+{
+}
+
+static void
+e_cal_config_date_edit_init (ECalConfigDateEdit *extension)
+{
+ extension->priv = E_CAL_CONFIG_DATE_EDIT_GET_PRIVATE (extension);
}
void
-e_cal_config_date_edit_register_type (GTypeModule *type_module)
+e_cal_config_date_edit_type_register (GTypeModule *type_module)
{
- static const GTypeInfo type_info = {
- sizeof (EExtensionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_config_date_edit_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EExtension),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- g_type_module_register_type (
- type_module, E_TYPE_EXTENSION,
- "ECalConfigDateEdit", &type_info, 0);
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_cal_config_date_edit_register_type (type_module);
}
+
diff --git a/modules/calendar/e-cal-config-date-edit.h b/modules/calendar/e-cal-config-date-edit.h
index 33291201dc..eacccba0e4 100644
--- a/modules/calendar/e-cal-config-date-edit.h
+++ b/modules/calendar/e-cal-config-date-edit.h
@@ -19,12 +19,47 @@
#ifndef E_CAL_CONFIG_DATE_EDIT_H
#define E_CAL_CONFIG_DATE_EDIT_H
-#include <glib-object.h>
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_CONFIG_DATE_EDIT \
+ (e_cal_config_date_edit_get_type ())
+#define E_CAL_CONFIG_DATE_EDIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_CONFIG_DATE_EDIT, ECalConfigDateEdit))
+#define E_CAL_CONFIG_DATE_EDIT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_CONFIG_DATE_EDIT, ECalConfigDateEditClass))
+#define E_IS_CAL_CONFIG_DATE_EDIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_CONFIG_DATE_EDIT))
+#define E_IS_CAL_CONFIG_DATE_EDIT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_CONFIG_DATE_EDIT))
+#define E_CAL_CONFIG_DATE_EDIT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_CONFIG_DATE_EDIT, ECalConfigDateEditClass))
G_BEGIN_DECLS
-void e_cal_config_date_edit_register_type (GTypeModule *type_module);
+typedef struct _ECalConfigDateEdit ECalConfigDateEdit;
+typedef struct _ECalConfigDateEditClass ECalConfigDateEditClass;
+typedef struct _ECalConfigDateEditPrivate ECalConfigDateEditPrivate;
+
+struct _ECalConfigDateEdit {
+ EExtension parent;
+ ECalConfigDateEditPrivate *priv;
+};
+
+struct _ECalConfigDateEditClass {
+ EExtensionClass parent_class;
+};
+
+GType e_cal_config_date_edit_get_type (void) G_GNUC_CONST;
+void e_cal_config_date_edit_type_register
+ (GTypeModule *type_module);
G_END_DECLS
#endif /* E_CAL_CONFIG_DATE_EDIT_H */
+
diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c
index 37db46106f..b6d77c4395 100644
--- a/modules/calendar/evolution-module-calendar.c
+++ b/modules/calendar/evolution-module-calendar.c
@@ -84,7 +84,7 @@ e_module_load (GTypeModule *type_module)
e_cal_config_calendar_item_type_register (type_module);
e_cal_config_comp_editor_type_register (type_module);
- e_cal_config_date_edit_register_type (type_module);
+ e_cal_config_date_edit_type_register (type_module);
e_cal_config_meeting_store_register_type (type_module);
e_cal_config_meeting_time_selector_register_type (type_module);
e_cal_config_model_register_type (type_module);