aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--modules/addressbook/e-book-shell-view-private.c6
-rw-r--r--modules/addressbook/e-book-shell-view-private.h3
-rw-r--r--modules/addressbook/e-book-shell-view.c56
-rw-r--r--modules/addressbook/e-book-shell-view.h2
-rw-r--r--modules/addressbook/evolution-module-addressbook.c2
-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
-rw-r--r--modules/mail/e-mail-shell-view-private.c6
-rw-r--r--modules/mail/e-mail-shell-view-private.h3
-rw-r--r--modules/mail/e-mail-shell-view.c61
-rw-r--r--modules/mail/e-mail-shell-view.h3
-rw-r--r--modules/mail/evolution-module-mail.c2
-rw-r--r--shell/e-shell-view.c5
24 files changed, 137 insertions, 224 deletions
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index cfb8213ae0..b30ca5f04d 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -478,8 +478,7 @@ book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
}
void
-e_book_shell_view_private_init (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class)
+e_book_shell_view_private_init (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
GHashTable *uid_to_view;
@@ -492,9 +491,6 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view,
priv->uid_to_view = uid_to_view;
priv->preview_index = -1;
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
book_shell_view, "notify::view-id",
G_CALLBACK (book_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h
index a3fe09ac84..d5b6cc5c94 100644
--- a/modules/addressbook/e-book-shell-view-private.h
+++ b/modules/addressbook/e-book-shell-view-private.h
@@ -100,8 +100,7 @@ struct _EBookShellViewPrivate {
};
void e_book_shell_view_private_init
- (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class);
+ (EBookShellView *book_shell_view);
void e_book_shell_view_private_constructed
(EBookShellView *book_shell_view);
void e_book_shell_view_private_dispose
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index c36d200438..0c812413e2 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -27,8 +27,10 @@
#include "addressbook/gui/widgets/gal-view-minicard.h"
-static gpointer parent_class;
-static GType book_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ EBookShellView,
+ e_book_shell_view,
+ E_TYPE_SHELL_VIEW);
static void
book_shell_view_dispose (GObject *object)
@@ -39,7 +41,7 @@ book_shell_view_dispose (GObject *object)
e_book_shell_view_private_dispose (book_shell_view);
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->dispose (object);
}
static void
@@ -51,7 +53,7 @@ book_shell_view_finalize (GObject *object)
e_book_shell_view_private_finalize (book_shell_view);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->finalize (object);
}
static void
@@ -60,7 +62,7 @@ book_shell_view_constructed (GObject *object)
EBookShellView *book_shell_view;
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->constructed (object);
book_shell_view = E_BOOK_SHELL_VIEW (object);
e_book_shell_view_private_constructed (book_shell_view);
@@ -215,7 +217,8 @@ book_shell_view_update_actions (EShellView *shell_view)
gboolean source_is_editable;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_book_shell_view_parent_class)->
+ update_actions (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -348,12 +351,16 @@ book_shell_view_update_actions (EShellView *shell_view)
}
static void
-book_shell_view_class_init (EBookShellViewClass *class)
+e_book_shell_view_class_finalize (EBookShellViewClass *class)
+{
+}
+
+static void
+e_book_shell_view_class_init (EBookShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EBookShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -379,40 +386,21 @@ book_shell_view_class_init (EBookShellViewClass *class)
}
static void
-book_shell_view_init (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class)
+e_book_shell_view_init (EBookShellView *book_shell_view)
{
book_shell_view->priv =
E_BOOK_SHELL_VIEW_GET_PRIVATE (book_shell_view);
- e_book_shell_view_private_init (book_shell_view, shell_view_class);
-}
-
-GType
-e_book_shell_view_get_type (void)
-{
- return book_shell_view_type;
+ e_book_shell_view_private_init (book_shell_view);
}
void
-e_book_shell_view_register_type (GTypeModule *type_module)
+e_book_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (EBookShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) book_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EBookShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) book_shell_view_init,
- NULL /* value_table */
- };
-
- book_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "EBookShellView", &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_book_shell_view_register_type (type_module);
}
void
diff --git a/modules/addressbook/e-book-shell-view.h b/modules/addressbook/e-book-shell-view.h
index a5e726b422..144effebba 100644
--- a/modules/addressbook/e-book-shell-view.h
+++ b/modules/addressbook/e-book-shell-view.h
@@ -59,7 +59,7 @@ struct _EBookShellViewClass {
};
GType e_book_shell_view_get_type (void);
-void e_book_shell_view_register_type (GTypeModule *type_module);
+void e_book_shell_view_type_register (GTypeModule *type_module);
void e_book_shell_view_disable_searching (EBookShellView *book_shell_view);
void e_book_shell_view_enable_searching (EBookShellView *book_shell_view);
diff --git a/modules/addressbook/evolution-module-addressbook.c b/modules/addressbook/evolution-module-addressbook.c
index 1caf7ddf08..e8a6dafa39 100644
--- a/modules/addressbook/evolution-module-addressbook.c
+++ b/modules/addressbook/evolution-module-addressbook.c
@@ -41,7 +41,7 @@ e_module_load (GTypeModule *type_module)
e_book_config_hook_register_type (type_module);
- e_book_shell_view_register_type (type_module);
+ e_book_shell_view_type_register (type_module);
e_book_shell_backend_type_register (type_module);
e_book_shell_content_type_register (type_module);
e_book_shell_sidebar_type_register (type_module);
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);
}
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 9c0132aa26..aa75643f9f 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -581,12 +581,8 @@ mail_shell_view_search_filter_changed_cb (EMailShellView *mail_shell_view)
}
void
-e_mail_shell_view_private_init (EMailShellView *mail_shell_view,
- EShellViewClass *shell_view_class)
+e_mail_shell_view_private_init (EMailShellView *mail_shell_view)
{
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
mail_shell_view, "notify::view-id",
G_CALLBACK (mail_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 28d90d463b..9986feb17f 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -149,8 +149,7 @@ struct _EMailShellViewPrivate {
};
void e_mail_shell_view_private_init
- (EMailShellView *mail_shell_view,
- EShellViewClass *shell_view_class);
+ (EMailShellView *mail_shell_view);
void e_mail_shell_view_private_constructed
(EMailShellView *mail_shell_view);
void e_mail_shell_view_private_dispose
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index b294a5476b..b2bfbf1973 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -25,8 +25,10 @@
#include "e-mail-shell-view-private.h"
-static gpointer parent_class;
-static GType mail_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ EMailShellView,
+ e_mail_shell_view,
+ E_TYPE_SHELL_VIEW)
/* ETable spec for search results */
static const gchar *SEARCH_RESULTS_STATE =
@@ -223,7 +225,7 @@ mail_shell_view_dispose (GObject *object)
e_mail_shell_view_private_dispose (E_MAIL_SHELL_VIEW (object));
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_shell_view_parent_class)->dispose (object);
}
static void
@@ -232,14 +234,14 @@ mail_shell_view_finalize (GObject *object)
e_mail_shell_view_private_finalize (E_MAIL_SHELL_VIEW (object));
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_mail_shell_view_parent_class)->finalize (object);
}
static void
mail_shell_view_constructed (GObject *object)
{
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_mail_shell_view_parent_class)->constructed (object);
e_mail_shell_view_private_constructed (E_MAIL_SHELL_VIEW (object));
}
@@ -277,7 +279,8 @@ mail_shell_view_toggled (EShellView *shell_view)
}
/* Chain up to parent's toggled() method. */
- E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view);
+ E_SHELL_VIEW_CLASS (e_mail_shell_view_parent_class)->
+ toggled (shell_view);
}
static void
@@ -869,7 +872,8 @@ mail_shell_view_update_actions (EShellView *shell_view)
gboolean any_store_is_subscribable = FALSE;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_mail_shell_view_parent_class)->
+ update_actions (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -1055,13 +1059,11 @@ mail_shell_view_update_actions (EShellView *shell_view)
}
static void
-mail_shell_view_class_init (EMailShellViewClass *class,
- GTypeModule *type_module)
+e_mail_shell_view_class_init (EMailShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -1088,38 +1090,25 @@ mail_shell_view_class_init (EMailShellViewClass *class,
}
static void
-mail_shell_view_init (EMailShellView *mail_shell_view,
- EShellViewClass *shell_view_class)
+e_mail_shell_view_class_finalize (EMailShellViewClass *class)
{
- mail_shell_view->priv =
- E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
-
- e_mail_shell_view_private_init (mail_shell_view, shell_view_class);
}
-GType
-e_mail_shell_view_get_type (void)
+static void
+e_mail_shell_view_init (EMailShellView *mail_shell_view)
{
- return mail_shell_view_type;
+ mail_shell_view->priv =
+ E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
+
+ e_mail_shell_view_private_init (mail_shell_view);
}
void
-e_mail_shell_view_register_type (GTypeModule *type_module)
+e_mail_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (EMailShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_shell_view_init,
- NULL /* value_table */
- };
-
- mail_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "EMailShellView", &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_mail_shell_view_register_type (type_module);
}
+
diff --git a/modules/mail/e-mail-shell-view.h b/modules/mail/e-mail-shell-view.h
index b2478a56c8..5653f8085b 100644
--- a/modules/mail/e-mail-shell-view.h
+++ b/modules/mail/e-mail-shell-view.h
@@ -59,8 +59,7 @@ struct _EMailShellViewClass {
};
GType e_mail_shell_view_get_type (void);
-void e_mail_shell_view_register_type
- (GTypeModule *type_module);
+void e_mail_shell_view_type_register (GTypeModule *type_module);
G_END_DECLS
diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c
index 9cae40e09e..8135e7df1d 100644
--- a/modules/mail/evolution-module-mail.c
+++ b/modules/mail/evolution-module-mail.c
@@ -49,10 +49,10 @@ e_module_load (GTypeModule *type_module)
e_mail_config_hook_register_type (type_module);
e_mail_event_hook_register_type (type_module);
+ e_mail_shell_view_type_register (type_module);
e_mail_shell_backend_type_register (type_module);
e_mail_shell_content_type_register (type_module);
e_mail_shell_sidebar_type_register (type_module);
- e_mail_shell_view_register_type (type_module);
em_account_prefs_type_register (type_module);
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index b4ae29b6a7..253bae2e3f 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -174,11 +174,10 @@ shell_view_init_view_collection (EShellViewClass *class)
gal_view_collection_set_storage_directories (
class->view_collection, system_dir, local_dir);
+ gal_view_collection_load (class->view_collection);
+
g_free (system_dir);
g_free (local_dir);
-
- /* This is all we can do. It's up to the subclasses to
- * add the appropriate factories to the view collection. */
}
static void