aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-06 00:34:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:50 +0800
commit7bb795b299758e6a81536b81c19693f353106105 (patch)
tree35937e1022645939bf0f3635848b7f86e03fb19b /modules/calendar
parentd629e6850a64b826fad60857a6b6945149ca8214 (diff)
downloadgsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.gz
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.zst
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.zip
Remove gal_view_collection_add_factory().
No longer needed. Instead, use g_type_ensure() to ensure the necessary GalView subclasses are registered in the GType system before loading a GalViewCollection. Best place to ensure types is from GClassInitFunc.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-view-private.c35
-rw-r--r--modules/calendar/e-cal-shell-view.c9
-rw-r--r--modules/calendar/e-memo-shell-view-private.c17
-rw-r--r--modules/calendar/e-memo-shell-view.c3
-rw-r--r--modules/calendar/e-task-shell-view-private.c17
-rw-r--r--modules/calendar/e-task-shell-view.c3
6 files changed, 18 insertions, 66 deletions
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index b4ed297ea0..f559241138 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -27,8 +27,6 @@
#include "e-cal-shell-view-private.h"
-#include "calendar/gui/calendar-view-factory.h"
-
#define CHECK_NB 5
/* be compatible with older e-d-s for MeeGo */
@@ -412,37 +410,6 @@ cal_shell_view_backend_error_cb (EClientCache *client_cache,
}
static void
-cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
-{
- GalViewCollection *collection;
- GalViewFactory *factory;
-
- collection = shell_view_class->view_collection;
-
- factory = g_object_new (GAL_TYPE_VIEW_FACTORY_CALENDAR_DAY, NULL);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = g_object_new (GAL_TYPE_VIEW_FACTORY_CALENDAR_WORK_WEEK, NULL);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = g_object_new (GAL_TYPE_VIEW_FACTORY_CALENDAR_WEEK, NULL);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = g_object_new (GAL_TYPE_VIEW_FACTORY_CALENDAR_MONTH, NULL);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = gal_view_factory_etable_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load (collection);
-}
-
-static void
cal_shell_view_notify_view_id_cb (EShellView *shell_view)
{
GalViewInstance *view_instance;
@@ -467,7 +434,7 @@ e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
EShellViewClass *shell_view_class)
{
if (!gal_view_collection_loaded (shell_view_class->view_collection))
- cal_shell_view_load_view_collection (shell_view_class);
+ gal_view_collection_load (shell_view_class->view_collection);
g_signal_connect (
cal_shell_view, "notify::view-id",
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index bacf4f4ec2..5350265cae 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -25,6 +25,8 @@
#include "e-cal-shell-view-private.h"
+#include "calendar/gui/calendar-view.h"
+
static gpointer parent_class;
static GType cal_shell_view_type;
@@ -595,6 +597,13 @@ cal_shell_view_class_init (ECalShellViewClass *class,
shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new;
shell_view_class->execute_search = cal_shell_view_execute_search;
shell_view_class->update_actions = cal_shell_view_update_actions;
+
+ /* Ensure the GalView types we need are registered. */
+ g_type_ensure (GAL_TYPE_VIEW_CALENDAR_DAY);
+ g_type_ensure (GAL_TYPE_VIEW_CALENDAR_WORK_WEEK);
+ g_type_ensure (GAL_TYPE_VIEW_CALENDAR_WEEK);
+ g_type_ensure (GAL_TYPE_VIEW_CALENDAR_MONTH);
+ g_type_ensure (GAL_TYPE_VIEW_ETABLE);
}
static void
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 26c43e1450..264a1753f1 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -122,21 +122,6 @@ memo_shell_view_backend_error_cb (EClientCache *client_cache,
}
static void
-memo_shell_view_load_view_collection (EShellViewClass *shell_view_class)
-{
- GalViewCollection *collection;
- GalViewFactory *factory;
-
- collection = shell_view_class->view_collection;
-
- factory = gal_view_factory_etable_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load (collection);
-}
-
-static void
memo_shell_view_notify_view_id_cb (EShellView *shell_view)
{
GalViewInstance *view_instance;
@@ -161,7 +146,7 @@ e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
EShellViewClass *shell_view_class)
{
if (!gal_view_collection_loaded (shell_view_class->view_collection))
- memo_shell_view_load_view_collection (shell_view_class);
+ gal_view_collection_load (shell_view_class->view_collection);
g_signal_connect (
memo_shell_view, "notify::view-id",
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index c271f9b773..65ddf411fd 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -313,6 +313,9 @@ memo_shell_view_class_init (EMemoShellViewClass *class,
shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new;
shell_view_class->execute_search = memo_shell_view_execute_search;
shell_view_class->update_actions = memo_shell_view_update_actions;
+
+ /* Ensure the GalView types we need are registered. */
+ g_type_ensure (GAL_TYPE_VIEW_ETABLE);
}
static void
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index ff42581cac..9fec6f507b 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -187,21 +187,6 @@ task_shell_view_backend_error_cb (EClientCache *client_cache,
}
static void
-task_shell_view_load_view_collection (EShellViewClass *shell_view_class)
-{
- GalViewCollection *collection;
- GalViewFactory *factory;
-
- collection = shell_view_class->view_collection;
-
- factory = gal_view_factory_etable_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load (collection);
-}
-
-static void
task_shell_view_notify_view_id_cb (EShellView *shell_view)
{
GalViewInstance *view_instance;
@@ -226,7 +211,7 @@ e_task_shell_view_private_init (ETaskShellView *task_shell_view,
EShellViewClass *shell_view_class)
{
if (!gal_view_collection_loaded (shell_view_class->view_collection))
- task_shell_view_load_view_collection (shell_view_class);
+ gal_view_collection_load (shell_view_class->view_collection);
g_signal_connect (
task_shell_view, "notify::view-id",
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index b7684a30d8..c081bbadd1 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -478,6 +478,9 @@ task_shell_view_class_init (ETaskShellViewClass *class,
NULL,
TRUE,
G_PARAM_READWRITE));
+
+ /* Ensure the GalView types we need are registered. */
+ g_type_ensure (GAL_TYPE_VIEW_ETABLE);
}
static void