aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-10-10 00:22:09 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-10-10 00:22:09 +0800
commit8454897696ac622d8cf0a452a1b2b8fb20adedbf (patch)
tree70551025cb20453158e9d7aa43122b351c60c85c
parent9cee475a1a6579e0816d5ad36eca9ba9a29f9353 (diff)
downloadgsoc2013-evolution-8454897696ac622d8cf0a452a1b2b8fb20adedbf.tar.gz
gsoc2013-evolution-8454897696ac622d8cf0a452a1b2b8fb20adedbf.tar.zst
gsoc2013-evolution-8454897696ac622d8cf0a452a1b2b8fb20adedbf.zip
ECalConfigCalendarItem: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions.
-rw-r--r--modules/calendar/e-cal-config-calendar-item.c61
-rw-r--r--modules/calendar/e-cal-config-calendar-item.h40
-rw-r--r--modules/calendar/evolution-module-calendar.c2
3 files changed, 76 insertions, 27 deletions
diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c
index 56fa6e5133..1efc8a91cd 100644
--- a/modules/calendar/e-cal-config-calendar-item.c
+++ b/modules/calendar/e-cal-config-calendar-item.c
@@ -22,12 +22,21 @@
#include "e-cal-config-calendar-item.h"
-#include <libebackend/libebackend.h>
-
#include <shell/e-shell.h>
#include <misc/e-calendar-item.h>
-static gpointer parent_class;
+#define E_CAL_CONFIG_CALENDAR_ITEM_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_CONFIG_CALENDAR_ITEM, ECalConfigCalendarItemPrivate))
+
+struct _ECalConfigCalendarItemPrivate {
+ gint placeholder;
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ ECalConfigCalendarItem,
+ e_cal_config_calendar_item,
+ E_TYPE_EXTENSION)
static void
cal_config_calendar_item_constructed (GObject *object)
@@ -54,39 +63,43 @@ cal_config_calendar_item_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_calendar_item_parent_class)->
+ constructed (object);
}
static void
-cal_config_calendar_item_class_init (EExtensionClass *class)
+e_cal_config_calendar_item_class_init (ECalConfigCalendarItemClass *class)
{
GObjectClass *object_class;
+ EExtensionClass *extension_class;
- parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (
+ class, sizeof (ECalConfigCalendarItemPrivate));
object_class = G_OBJECT_CLASS (class);
object_class->constructed = cal_config_calendar_item_constructed;
- class->extensible_type = E_TYPE_CALENDAR_ITEM;
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_CALENDAR_ITEM;
+}
+
+static void
+e_cal_config_calendar_item_class_finalize (ECalConfigCalendarItemClass *class)
+{
+}
+
+static void
+e_cal_config_calendar_item_init (ECalConfigCalendarItem *extension)
+{
+ extension->priv = E_CAL_CONFIG_CALENDAR_ITEM_GET_PRIVATE (extension);
}
void
-e_cal_config_calendar_item_register_type (GTypeModule *type_module)
+e_cal_config_calendar_item_type_register (GTypeModule *type_module)
{
- static const GTypeInfo type_info = {
- sizeof (EExtensionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_config_calendar_item_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,
- "ECalConfigCalendarItem", &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_calendar_item_register_type (type_module);
}
+
diff --git a/modules/calendar/e-cal-config-calendar-item.h b/modules/calendar/e-cal-config-calendar-item.h
index af12eb244a..83bc7149f3 100644
--- a/modules/calendar/e-cal-config-calendar-item.h
+++ b/modules/calendar/e-cal-config-calendar-item.h
@@ -19,12 +19,48 @@
#ifndef E_CAL_CONFIG_CALENDAR_ITEM_H
#define E_CAL_CONFIG_CALENDAR_ITEM_H
-#include <glib-object.h>
+#include <libebackend/libebackend.h>
+
+/* Standard GObject macros */
+#define E_TYPE_CAL_CONFIG_CALENDAR_ITEM \
+ (e_cal_config_calendar_item_get_type ())
+#define E_CAL_CONFIG_CALENDAR_ITEM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_CONFIG_CALENDAR_ITEM, ECalConfigCalendarItem))
+#define E_CAL_CONFIG_CALENDAR_ITEM_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_CONFIG_CALENDAR_ITEM, ECalConfigCalendarItemClass))
+#define E_IS_CAL_CONFIG_CALENDAR_ITEM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_CONFIG_CALENDAR_ITEM))
+#define E_IS_CAL_CONFIG_CALENDAR_ITEM_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_CONFIG_CALENDAR_ITEM))
+#define E_CAL_CONFIG_CALENDAR_ITEM_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_CONFIG_CALENDAR_ITEM, ECalConfigCalendarItemClass))
G_BEGIN_DECLS
-void e_cal_config_calendar_item_register_type (GTypeModule *type_module);
+typedef struct _ECalConfigCalendarItem ECalConfigCalendarItem;
+typedef struct _ECalConfigCalendarItemClass ECalConfigCalendarItemClass;
+typedef struct _ECalConfigCalendarItemPrivate ECalConfigCalendarItemPrivate;
+
+struct _ECalConfigCalendarItem {
+ EExtension parent;
+ ECalConfigCalendarItemPrivate *priv;
+};
+
+struct _ECalConfigCalendarItemClass {
+ EExtensionClass parent_class;
+};
+
+GType e_cal_config_calendar_item_get_type
+ (void) G_GNUC_CONST;
+void e_cal_config_calendar_item_type_register
+ (GTypeModule *type_module);
G_END_DECLS
#endif /* E_CAL_CONFIG_CALENDAR_ITEM_H */
+
diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c
index 9b24bf3854..86a4d1a7af 100644
--- a/modules/calendar/evolution-module-calendar.c
+++ b/modules/calendar/evolution-module-calendar.c
@@ -82,7 +82,7 @@ e_module_load (GTypeModule *type_module)
e_task_shell_sidebar_type_register (type_module);
e_task_shell_view_register_type (type_module);
- e_cal_config_calendar_item_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_date_edit_register_type (type_module);
e_cal_config_meeting_store_register_type (type_module);