diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-10 02:00:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-10 02:00:00 +0800 |
commit | 55d5344510bd2991259d9b202988024b00c957d8 (patch) | |
tree | 85f55738517429ec505a2eddfe31efb969c081f3 /modules | |
parent | 09438389c17a2b542d3c055e287f22fa3a1b6513 (diff) | |
download | gsoc2013-evolution-55d5344510bd2991259d9b202988024b00c957d8.tar.gz gsoc2013-evolution-55d5344510bd2991259d9b202988024b00c957d8.tar.zst gsoc2013-evolution-55d5344510bd2991259d9b202988024b00c957d8.zip |
ECalConfigView: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/calendar/e-cal-config-view.c | 59 | ||||
-rw-r--r-- | modules/calendar/e-cal-config-view.h | 37 | ||||
-rw-r--r-- | modules/calendar/evolution-module-calendar.c | 2 |
3 files changed, 71 insertions, 27 deletions
diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c index 8883f4fadf..38651bd390 100644 --- a/modules/calendar/e-cal-config-view.c +++ b/modules/calendar/e-cal-config-view.c @@ -22,13 +22,22 @@ #include "e-cal-config-view.h" -#include <libebackend/libebackend.h> - #include <shell/e-shell.h> #include <calendar/gui/e-day-view.h> #include <calendar/gui/e-week-view.h> -static gpointer parent_class; +#define E_CAL_CONFIG_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_CONFIG_VIEW, ECalConfigViewPrivate)) + +struct _ECalConfigViewPrivate { + gint placeholder; +}; + +G_DEFINE_DYNAMIC_TYPE ( + ECalConfigView, + e_cal_config_view, + E_TYPE_EXTENSION) static void cal_config_view_constructed (GObject *object) @@ -96,39 +105,41 @@ cal_config_view_constructed (GObject *object) } /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_cal_config_view_parent_class)->constructed (object); } static void -cal_config_view_class_init (EExtensionClass *class) +e_cal_config_view_class_init (ECalConfigViewClass *class) { GObjectClass *object_class; + EExtensionClass *extension_class; - parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (ECalConfigViewPrivate)); object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_view_constructed; - class->extensible_type = E_TYPE_CALENDAR_VIEW; + extension_class = E_EXTENSION_CLASS (class); + extension_class->extensible_type = E_TYPE_CALENDAR_VIEW; +} + +static void +e_cal_config_view_class_finalize (ECalConfigViewClass *class) +{ +} + +static void +e_cal_config_view_init (ECalConfigView *extension) +{ + extension->priv = E_CAL_CONFIG_VIEW_GET_PRIVATE (extension); } void -e_cal_config_view_register_type (GTypeModule *type_module) +e_cal_config_view_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EExtensionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_config_view_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, - "ECalConfigView", &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_view_register_type (type_module); } + diff --git a/modules/calendar/e-cal-config-view.h b/modules/calendar/e-cal-config-view.h index e36acddf0c..3c9f1dbe02 100644 --- a/modules/calendar/e-cal-config-view.h +++ b/modules/calendar/e-cal-config-view.h @@ -19,11 +19,44 @@ #ifndef E_CAL_CONFIG_VIEW_H #define E_CAL_CONFIG_VIEW_H -#include <glib-object.h> +#include <libebackend/libebackend.h> + +/* Standard GObject macros */ +#define E_TYPE_CAL_CONFIG_VIEW \ + (e_cal_config_view_get_type ()) +#define E_CAL_CONFIG_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CAL_CONFIG_VIEW, ECalConfigView)) +#define E_CAL_CONFIG_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CAL_CONFIG_VIEW, ECalConfigViewClass)) +#define E_IS_CAL_CONFIG_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CAL_CONFIG_VIEW)) +#define E_IS_CAL_CONFIG_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CAL_CONFIG_VIEW)) +#define E_CAL_CONFIG_VIEW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CAL_CONFIG_VIEW, ECalConfigViewClass)) G_BEGIN_DECLS -void e_cal_config_view_register_type (GTypeModule *type_module); +typedef struct _ECalConfigView ECalConfigView; +typedef struct _ECalConfigViewClass ECalConfigViewClass; +typedef struct _ECalConfigViewPrivate ECalConfigViewPrivate; + +struct _ECalConfigView { + EExtension parent; + ECalConfigViewPrivate *priv; +}; + +struct _ECalConfigViewClass { + EExtensionClass parent_class; +}; + +GType e_cal_config_view_get_type (void) G_GNUC_CONST; +void e_cal_config_view_type_register (GTypeModule *type_module); G_END_DECLS diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c index 50144ca59d..f3ac75b038 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -88,7 +88,7 @@ e_module_load (GTypeModule *type_module) e_cal_config_meeting_store_type_register (type_module); e_cal_config_meeting_time_selector_type_register (type_module); e_cal_config_model_type_register (type_module); - e_cal_config_view_register_type (type_module); + e_cal_config_view_type_register (type_module); e_calendar_preferences_type_register (type_module); } |