diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-10 00:45:27 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-10 00:45:27 +0800 |
commit | 5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e (patch) | |
tree | 7e35229c149d7799b11df772a1a57ce1a386df82 /modules/calendar | |
parent | 8454897696ac622d8cf0a452a1b2b8fb20adedbf (diff) | |
download | gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar.gz gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar.bz2 gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar.lz gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar.xz gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.tar.zst gsoc2013-evolution-5938ad7e8f0b3cf223b41bf942d9d1a9a0a42d2e.zip |
ECalConfigCompEditor: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions.
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-cal-config-comp-editor.c | 60 | ||||
-rw-r--r-- | modules/calendar/e-cal-config-comp-editor.h | 39 | ||||
-rw-r--r-- | modules/calendar/evolution-module-calendar.c | 2 |
3 files changed, 74 insertions, 27 deletions
diff --git a/modules/calendar/e-cal-config-comp-editor.c b/modules/calendar/e-cal-config-comp-editor.c index c2d296cefc..98991b43b2 100644 --- a/modules/calendar/e-cal-config-comp-editor.c +++ b/modules/calendar/e-cal-config-comp-editor.c @@ -22,12 +22,21 @@ #include "e-cal-config-comp-editor.h" -#include <libebackend/libebackend.h> - #include <shell/e-shell.h> #include <calendar/gui/dialogs/comp-editor.h> -static gpointer parent_class; +#define E_CAL_CONFIG_COMP_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_CONFIG_COMP_EDITOR, ECalConfigCompEditorPrivate)) + +struct _ECalConfigCompEditorPrivate { + gint placeholder; +}; + +G_DEFINE_DYNAMIC_TYPE ( + ECalConfigCompEditor, + e_cal_config_comp_editor, + E_TYPE_EXTENSION) static void cal_config_comp_editor_constructed (GObject *object) @@ -74,39 +83,42 @@ cal_config_comp_editor_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_comp_editor_parent_class)-> + constructed (object); } static void -cal_config_comp_editor_class_init (EExtensionClass *class) +e_cal_config_comp_editor_class_init (ECalConfigCompEditorClass *class) { GObjectClass *object_class; + EExtensionClass *extension_class; - parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (ECalConfigCompEditorPrivate)); object_class = G_OBJECT_CLASS (class); object_class->constructed = cal_config_comp_editor_constructed; - class->extensible_type = TYPE_COMP_EDITOR; + extension_class = E_EXTENSION_CLASS (class); + extension_class->extensible_type = TYPE_COMP_EDITOR; +} + +static void +e_cal_config_comp_editor_class_finalize (ECalConfigCompEditorClass *class) +{ +} + +static void +e_cal_config_comp_editor_init (ECalConfigCompEditor *extension) +{ + extension->priv = E_CAL_CONFIG_COMP_EDITOR_GET_PRIVATE (extension); } void -e_cal_config_comp_editor_register_type (GTypeModule *type_module) +e_cal_config_comp_editor_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EExtensionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_config_comp_editor_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, - "ECalConfigCompEditor", &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_comp_editor_register_type (type_module); } + diff --git a/modules/calendar/e-cal-config-comp-editor.h b/modules/calendar/e-cal-config-comp-editor.h index 124547a4dd..ee75a46508 100644 --- a/modules/calendar/e-cal-config-comp-editor.h +++ b/modules/calendar/e-cal-config-comp-editor.h @@ -19,11 +19,46 @@ #ifndef E_CAL_CONFIG_COMP_EDITOR_H #define E_CAL_CONFIG_COMP_EDITOR_H -#include <glib-object.h> +#include <libebackend/libebackend.h> + +/* Standard GObject macros */ +#define E_TYPE_CAL_CONFIG_COMP_EDITOR \ + (e_cal_config_comp_editor_get_type ()) +#define E_CAL_CONFIG_COMP_EDITOR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CAL_CONFIG_COMP_EDITOR, ECalConfigCompEditor)) +#define E_CAL_CONFIG_COMP_EDITOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CAL_CONFIG_COMP_EDITOR, ECalConfigCompEditorClass)) +#define E_IS_CAL_CONFIG_COMP_EDITOR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CAL_CONFIG_COMP_EDITOR)) +#define E_IS_CAL_CONFIG_COMP_EDITOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CAL_CONFIG_COMP_EDITOR)) +#define E_CAL_CONFIG_COMP_EDITOR_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CAL_CONFIG_COMP_EDITOR, ECalConfigCompEditorClass)) G_BEGIN_DECLS -void e_cal_config_comp_editor_register_type (GTypeModule *type_module); +typedef struct _ECalConfigCompEditor ECalConfigCompEditor; +typedef struct _ECalConfigCompEditorClass ECalConfigCompEditorClass; +typedef struct _ECalConfigCompEditorPrivate ECalConfigCompEditorPrivate; + +struct _ECalConfigCompEditor { + EExtension parent; + ECalConfigCompEditorPrivate *priv; +}; + +struct _ECalConfigCompEditorClass { + EExtensionClass parent_class; +}; + +GType e_cal_config_comp_editor_get_type + (void) G_GNUC_CONST; +void e_cal_config_comp_editor_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 86a4d1a7af..37db46106f 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -83,7 +83,7 @@ e_module_load (GTypeModule *type_module) e_task_shell_view_register_type (type_module); e_cal_config_calendar_item_type_register (type_module); - e_cal_config_comp_editor_register_type (type_module); + e_cal_config_comp_editor_type_register (type_module); e_cal_config_date_edit_register_type (type_module); e_cal_config_meeting_store_register_type (type_module); e_cal_config_meeting_time_selector_register_type (type_module); |