ECalConfigMeetingStore: Use G_DEFINE_DYNAMIC_TYPE.

Follow the usual GObject conventions.
This commit is contained in:
Matthew Barnes
2012-10-09 13:20:44 -04:00
parent 6fd48fd4df
commit 27e8442447
3 changed files with 75 additions and 27 deletions

View File

@ -22,12 +22,21 @@
#include "e-cal-config-meeting-store.h"
#include <libebackend/libebackend.h>
#include <shell/e-shell.h>
#include <calendar/gui/e-meeting-store.h>
static gpointer parent_class;
#define E_CAL_CONFIG_MEETING_STORE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_CONFIG_MEETING_STORE, ECalConfigMeetingStorePrivate))
struct _ECalConfigMeetingStorePrivate {
gint placeholder;
};
G_DEFINE_DYNAMIC_TYPE (
ECalConfigMeetingStore,
e_cal_config_meeting_store,
E_TYPE_EXTENSION)
static void
cal_config_meeting_store_constructed (GObject *object)
@ -69,39 +78,43 @@ cal_config_meeting_store_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_meeting_store_parent_class)->
constructed (object);
}
static void
cal_config_meeting_store_class_init (EExtensionClass *class)
e_cal_config_meeting_store_class_init (ECalConfigMeetingStoreClass *class)
{
GObjectClass *object_class;
EExtensionClass *extension_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (
class, sizeof (ECalConfigMeetingStorePrivate));
object_class = G_OBJECT_CLASS (class);
object_class->constructed = cal_config_meeting_store_constructed;
class->extensible_type = E_TYPE_MEETING_STORE;
extension_class = E_EXTENSION_CLASS (class);
extension_class->extensible_type = E_TYPE_MEETING_STORE;
}
static void
e_cal_config_meeting_store_class_finalize (ECalConfigMeetingStoreClass *class)
{
}
static void
e_cal_config_meeting_store_init (ECalConfigMeetingStore *extension)
{
extension->priv = E_CAL_CONFIG_MEETING_STORE_GET_PRIVATE (extension);
}
void
e_cal_config_meeting_store_register_type (GTypeModule *type_module)
e_cal_config_meeting_store_type_register (GTypeModule *type_module)
{
static const GTypeInfo type_info = {
sizeof (EExtensionClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cal_config_meeting_store_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,
"ECalConfigMeetingStore", &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_meeting_store_register_type (type_module);
}

View File

@ -19,11 +19,46 @@
#ifndef E_CAL_CONFIG_MEETING_STORE_H
#define E_CAL_CONFIG_MEETING_STORE_H
#include <glib-object.h>
#include <libebackend/libebackend.h>
/* Standard GObject macros */
#define E_TYPE_CAL_CONFIG_MEETING_STORE \
(e_cal_config_meeting_store_get_type ())
#define E_CAL_CONFIG_MEETING_STORE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_CAL_CONFIG_MEETING_STORE, ECalConfigMeetingStore))
#define E_CAL_CONFIG_MEETING_STORE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_CAL_CONFIG_MEETING_STORE, ECalConfigMeetingStoreClass))
#define E_IS_CAL_CONFIG_MEETING_STORE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_CAL_CONFIG_MEETING_STORE))
#define E_IS_CAL_CONFIG_MEETING_STORE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_CAL_CONFIG_MEETING_STORE))
#define E_CAL_CONFIG_MEETING_STORE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_CaL_CONFIG_MEETING_STORE, ECalConfigMeetingStoreClass))
G_BEGIN_DECLS
void e_cal_config_meeting_store_register_type (GTypeModule *type_module);
typedef struct _ECalConfigMeetingStore ECalConfigMeetingStore;
typedef struct _ECalConfigMeetingStoreClass ECalConfigMeetingStoreClass;
typedef struct _ECalConfigMeetingStorePrivate ECalConfigMeetingStorePrivate;
struct _ECalConfigMeetingStore {
EExtension parent;
ECalConfigMeetingStorePrivate *priv;
};
struct _ECalConfigMeetingStoreClass {
EExtensionClass parent_class;
};
GType e_cal_config_meeting_store_get_type
(void) G_GNUC_CONST;
void e_cal_config_meeting_store_type_register
(GTypeModule *type_module);
G_END_DECLS

View File

@ -85,7 +85,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_type_register (type_module);
e_cal_config_meeting_store_register_type (type_module);
e_cal_config_meeting_store_type_register (type_module);
e_cal_config_meeting_time_selector_register_type (type_module);
e_cal_config_model_register_type (type_module);
e_cal_config_view_register_type (type_module);