aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-06 01:26:43 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:50 +0800
commitdf1dc37704daf3b1f20d1632b1cef1ea0a2181ad (patch)
tree18f00ac12457a5e1f9a5cf2bb2b9db482a150d96 /modules/calendar
parent7bb795b299758e6a81536b81c19693f353106105 (diff)
downloadgsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.gz
gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.zst
gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.zip
EShellView can load the GalViewCollection itself now.
EShellView no longer needs help from subclasses other than getting the needed GalView subclasses registered. A nice side-effect of this is EShellView subclasses can now use the G_DEFINE_DYNAMIC_TYPE macro.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-view-private.c6
-rw-r--r--modules/calendar/e-cal-shell-view-private.h3
-rw-r--r--modules/calendar/e-cal-shell-view.c58
-rw-r--r--modules/calendar/e-cal-shell-view.h2
-rw-r--r--modules/calendar/e-memo-shell-view-private.c6
-rw-r--r--modules/calendar/e-memo-shell-view-private.h3
-rw-r--r--modules/calendar/e-memo-shell-view.c58
-rw-r--r--modules/calendar/e-memo-shell-view.h2
-rw-r--r--modules/calendar/e-task-shell-view-private.c6
-rw-r--r--modules/calendar/e-task-shell-view-private.h3
-rw-r--r--modules/calendar/e-task-shell-view.c57
-rw-r--r--modules/calendar/e-task-shell-view.h2
-rw-r--r--modules/calendar/evolution-module-calendar.c6
13 files changed, 80 insertions, 132 deletions
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index f559241138..6c32136d2e 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -430,12 +430,8 @@ cal_shell_view_notify_view_id_cb (EShellView *shell_view)
}
void
-e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
- EShellViewClass *shell_view_class)
+e_cal_shell_view_private_init (ECalShellView *cal_shell_view)
{
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
cal_shell_view, "notify::view-id",
G_CALLBACK (cal_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 30962d841b..9f16116fa6 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -119,8 +119,7 @@ struct _ECalShellViewPrivate {
};
void e_cal_shell_view_private_init
- (ECalShellView *cal_shell_view,
- EShellViewClass *shell_view_class);
+ (ECalShellView *cal_shell_view);
void e_cal_shell_view_private_constructed
(ECalShellView *cal_shell_view);
void e_cal_shell_view_private_dispose
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 5350265cae..624647bafb 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -27,8 +27,10 @@
#include "calendar/gui/calendar-view.h"
-static gpointer parent_class;
-static GType cal_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ ECalShellView,
+ e_cal_shell_view,
+ E_TYPE_SHELL_VIEW)
static void
cal_shell_view_add_action_button (GtkBox *box,
@@ -80,7 +82,7 @@ cal_shell_view_dispose (GObject *object)
e_cal_shell_view_private_dispose (E_CAL_SHELL_VIEW (object));
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_cal_shell_view_parent_class)->dispose (object);
}
static void
@@ -89,7 +91,7 @@ cal_shell_view_finalize (GObject *object)
e_cal_shell_view_private_finalize (E_CAL_SHELL_VIEW (object));
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_cal_shell_view_parent_class)->finalize (object);
}
static void
@@ -106,7 +108,7 @@ cal_shell_view_constructed (GObject *object)
gulong handler_id;
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_cal_shell_view_parent_class)->constructed (object);
cal_shell_view = E_CAL_SHELL_VIEW (object);
e_cal_shell_view_private_constructed (cal_shell_view);
@@ -370,7 +372,8 @@ cal_shell_view_update_actions (EShellView *shell_view)
gboolean refresh_supported;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_cal_shell_view_parent_class)->
+ update_actions (shell_view);
priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -572,13 +575,11 @@ cal_shell_view_update_actions (EShellView *shell_view)
}
static void
-cal_shell_view_class_init (ECalShellViewClass *class,
- GTypeModule *type_module)
+e_cal_shell_view_class_init (ECalShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ECalShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -607,38 +608,25 @@ cal_shell_view_class_init (ECalShellViewClass *class,
}
static void
-cal_shell_view_init (ECalShellView *cal_shell_view,
- EShellViewClass *shell_view_class)
+e_cal_shell_view_class_finalize (ECalShellViewClass *class)
{
- cal_shell_view->priv =
- E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view);
-
- e_cal_shell_view_private_init (cal_shell_view, shell_view_class);
}
-GType
-e_cal_shell_view_get_type (void)
+static void
+e_cal_shell_view_init (ECalShellView *cal_shell_view)
{
- return cal_shell_view_type;
+ cal_shell_view->priv =
+ E_CAL_SHELL_VIEW_GET_PRIVATE (cal_shell_view);
+
+ e_cal_shell_view_private_init (cal_shell_view);
}
void
-e_cal_shell_view_register_type (GTypeModule *type_module)
+e_cal_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (ECalShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- type_module,
- sizeof (ECalShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) cal_shell_view_init,
- NULL /* value_table */
- };
-
- cal_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "ECalShellView", &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_shell_view_register_type (type_module);
}
+
diff --git a/modules/calendar/e-cal-shell-view.h b/modules/calendar/e-cal-shell-view.h
index 0cd7382012..312033221e 100644
--- a/modules/calendar/e-cal-shell-view.h
+++ b/modules/calendar/e-cal-shell-view.h
@@ -59,7 +59,7 @@ struct _ECalShellViewClass {
};
GType e_cal_shell_view_get_type (void);
-void e_cal_shell_view_register_type (GTypeModule *type_module);
+void e_cal_shell_view_type_register (GTypeModule *type_module);
G_END_DECLS
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 264a1753f1..c049f44a52 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -142,12 +142,8 @@ memo_shell_view_notify_view_id_cb (EShellView *shell_view)
}
void
-e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
- EShellViewClass *shell_view_class)
+e_memo_shell_view_private_init (EMemoShellView *memo_shell_view)
{
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
memo_shell_view, "notify::view-id",
G_CALLBACK (memo_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index 8996151874..29f5a6333a 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -85,8 +85,7 @@ struct _EMemoShellViewPrivate {
};
void e_memo_shell_view_private_init
- (EMemoShellView *memo_shell_view,
- EShellViewClass *shell_view_class);
+ (EMemoShellView *memo_shell_view);
void e_memo_shell_view_private_constructed
(EMemoShellView *memo_shell_view);
void e_memo_shell_view_private_dispose
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 65ddf411fd..5e4e48fe30 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -25,8 +25,10 @@
#include "e-memo-shell-view-private.h"
-static gpointer parent_class;
-static GType memo_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ EMemoShellView,
+ e_memo_shell_view,
+ E_TYPE_SHELL_VIEW)
static void
memo_shell_view_dispose (GObject *object)
@@ -34,7 +36,7 @@ memo_shell_view_dispose (GObject *object)
e_memo_shell_view_private_dispose (E_MEMO_SHELL_VIEW (object));
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_memo_shell_view_parent_class)->dispose (object);
}
static void
@@ -43,14 +45,14 @@ memo_shell_view_finalize (GObject *object)
e_memo_shell_view_private_finalize (E_MEMO_SHELL_VIEW (object));
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_memo_shell_view_parent_class)->finalize (object);
}
static void
memo_shell_view_constructed (GObject *object)
{
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_memo_shell_view_parent_class)->constructed (object);
e_memo_shell_view_private_constructed (E_MEMO_SHELL_VIEW (object));
}
@@ -194,7 +196,8 @@ memo_shell_view_update_actions (EShellView *shell_view)
gboolean refresh_supported;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_memo_shell_view_parent_class)->
+ update_actions (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -288,13 +291,11 @@ memo_shell_view_update_actions (EShellView *shell_view)
}
static void
-memo_shell_view_class_init (EMemoShellViewClass *class,
- GTypeModule *type_module)
+e_memo_shell_view_class_init (EMemoShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMemoShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -319,38 +320,25 @@ memo_shell_view_class_init (EMemoShellViewClass *class,
}
static void
-memo_shell_view_init (EMemoShellView *memo_shell_view,
- EShellViewClass *shell_view_class)
+e_memo_shell_view_class_finalize (EMemoShellViewClass *class)
{
- memo_shell_view->priv =
- E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view);
-
- e_memo_shell_view_private_init (memo_shell_view, shell_view_class);
}
-GType
-e_memo_shell_view_get_type (void)
+static void
+e_memo_shell_view_init (EMemoShellView *memo_shell_view)
{
- return memo_shell_view_type;
+ memo_shell_view->priv =
+ E_MEMO_SHELL_VIEW_GET_PRIVATE (memo_shell_view);
+
+ e_memo_shell_view_private_init (memo_shell_view);
}
void
-e_memo_shell_view_register_type (GTypeModule *type_module)
+e_memo_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (EMemoShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) memo_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- type_module,
- sizeof (EMemoShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) memo_shell_view_init,
- NULL /* value_table */
- };
-
- memo_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "EMemoShellView", &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_memo_shell_view_register_type (type_module);
}
+
diff --git a/modules/calendar/e-memo-shell-view.h b/modules/calendar/e-memo-shell-view.h
index 753836858d..52af4761f2 100644
--- a/modules/calendar/e-memo-shell-view.h
+++ b/modules/calendar/e-memo-shell-view.h
@@ -59,7 +59,7 @@ struct _EMemoShellViewClass {
};
GType e_memo_shell_view_get_type (void);
-void e_memo_shell_view_register_type (GTypeModule *type_module);
+void e_memo_shell_view_type_register (GTypeModule *type_module);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 9fec6f507b..842873285e 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -207,12 +207,8 @@ task_shell_view_notify_view_id_cb (EShellView *shell_view)
}
void
-e_task_shell_view_private_init (ETaskShellView *task_shell_view,
- EShellViewClass *shell_view_class)
+e_task_shell_view_private_init (ETaskShellView *task_shell_view)
{
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
task_shell_view, "notify::view-id",
G_CALLBACK (task_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index 3360928864..fa9f045387 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -103,8 +103,7 @@ struct _ETaskShellViewPrivate {
};
void e_task_shell_view_private_init
- (ETaskShellView *task_shell_view,
- EShellViewClass *shell_view_class);
+ (ETaskShellView *task_shell_view);
void e_task_shell_view_private_constructed
(ETaskShellView *task_shell_view);
void e_task_shell_view_private_dispose
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index c081bbadd1..14dbfd5b24 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -30,8 +30,10 @@ enum {
PROP_CONFIRM_PURGE
};
-static gpointer parent_class;
-static GType task_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ ETaskShellView,
+ e_task_shell_view,
+ E_TYPE_SHELL_VIEW)
static void
task_shell_view_set_property (GObject *object,
@@ -73,7 +75,7 @@ task_shell_view_dispose (GObject *object)
e_task_shell_view_private_dispose (E_TASK_SHELL_VIEW (object));
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_task_shell_view_parent_class)->dispose (object);
}
static void
@@ -82,14 +84,14 @@ task_shell_view_finalize (GObject *object)
e_task_shell_view_private_finalize (E_TASK_SHELL_VIEW (object));
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_task_shell_view_parent_class)->finalize (object);
}
static void
task_shell_view_constructed (GObject *object)
{
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_task_shell_view_parent_class)->constructed (object);
e_task_shell_view_private_constructed (E_TASK_SHELL_VIEW (object));
}
@@ -317,7 +319,8 @@ task_shell_view_update_actions (EShellView *shell_view)
gboolean refresh_supported;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_task_shell_view_parent_class)->
+ update_actions (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -441,13 +444,11 @@ task_shell_view_update_actions (EShellView *shell_view)
}
static void
-task_shell_view_class_init (ETaskShellViewClass *class,
- GTypeModule *type_module)
+e_task_shell_view_class_init (ETaskShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ETaskShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -484,40 +485,26 @@ task_shell_view_class_init (ETaskShellViewClass *class,
}
static void
-task_shell_view_init (ETaskShellView *task_shell_view,
- EShellViewClass *shell_view_class)
+e_task_shell_view_class_finalize (ETaskShellViewClass *class)
{
- task_shell_view->priv =
- E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view);
-
- e_task_shell_view_private_init (task_shell_view, shell_view_class);
}
-GType
-e_task_shell_view_get_type (void)
+static void
+e_task_shell_view_init (ETaskShellView *task_shell_view)
{
- return task_shell_view_type;
+ task_shell_view->priv =
+ E_TASK_SHELL_VIEW_GET_PRIVATE (task_shell_view);
+
+ e_task_shell_view_private_init (task_shell_view);
}
void
-e_task_shell_view_register_type (GTypeModule *type_module)
+e_task_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (ETaskShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) task_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- type_module,
- sizeof (ETaskShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) task_shell_view_init,
- NULL /* value_table */
- };
-
- task_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "ETaskShellView", &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_task_shell_view_register_type (type_module);
}
gboolean
diff --git a/modules/calendar/e-task-shell-view.h b/modules/calendar/e-task-shell-view.h
index d756c10345..97f07edff7 100644
--- a/modules/calendar/e-task-shell-view.h
+++ b/modules/calendar/e-task-shell-view.h
@@ -59,7 +59,7 @@ struct _ETaskShellViewClass {
};
GType e_task_shell_view_get_type (void);
-void e_task_shell_view_register_type (GTypeModule *type_module);
+void e_task_shell_view_type_register (GTypeModule *type_module);
gboolean e_task_shell_view_get_confirm_purge
(ETaskShellView *task_shell_view);
void e_task_shell_view_set_confirm_purge
diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c
index 86cfa1f729..fabe410271 100644
--- a/modules/calendar/evolution-module-calendar.c
+++ b/modules/calendar/evolution-module-calendar.c
@@ -59,20 +59,20 @@ e_module_load (GTypeModule *type_module)
e_cal_config_hook_register_type (type_module);
e_cal_event_hook_register_type (type_module);
+ e_cal_shell_view_type_register (type_module);
e_cal_shell_backend_type_register (type_module);
e_cal_shell_content_type_register (type_module);
e_cal_shell_sidebar_type_register (type_module);
- e_cal_shell_view_register_type (type_module);
+ e_memo_shell_view_type_register (type_module);
e_memo_shell_backend_type_register (type_module);
e_memo_shell_content_type_register (type_module);
e_memo_shell_sidebar_type_register (type_module);
- e_memo_shell_view_register_type (type_module);
+ e_task_shell_view_type_register (type_module);
e_task_shell_backend_type_register (type_module);
e_task_shell_content_type_register (type_module);
e_task_shell_sidebar_type_register (type_module);
- e_task_shell_view_register_type (type_module);
e_calendar_preferences_type_register (type_module);
}