aboutsummaryrefslogtreecommitdiffstats
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
parentd629e6850a64b826fad60857a6b6945149ca8214 (diff)
downloadgsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.gz
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.bz2
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.lz
gsoc2013-evolution-7bb795b299758e6a81536b81c19693f353106105.tar.xz
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.
-rw-r--r--doc/reference/evolution-util/evolution-util-sections.txt1
-rw-r--r--e-util/gal-view-collection.c31
-rw-r--r--e-util/gal-view-collection.h4
-rw-r--r--modules/addressbook/e-book-shell-view-private.c23
-rw-r--r--modules/addressbook/e-book-shell-view.c6
-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
-rw-r--r--modules/mail/e-mail-shell-view-private.c17
-rw-r--r--modules/mail/e-mail-shell-view.c3
13 files changed, 30 insertions, 139 deletions
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt
index d82ba7d1d0..23253e90e5 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -4593,7 +4593,6 @@ gal_view_collection_new
gal_view_collection_get_system_directory
gal_view_collection_get_user_directory
gal_view_collection_set_storage_directories
-gal_view_collection_add_factory
gal_view_collection_get_count
gal_view_collection_get_view
gal_view_collection_get_view_item
diff --git a/e-util/gal-view-collection.c b/e-util/gal-view-collection.c
index 617eaad2ad..badd81bf9f 100644
--- a/e-util/gal-view-collection.c
+++ b/e-util/gal-view-collection.c
@@ -38,8 +38,6 @@ struct _GalViewCollectionPrivate {
GalViewCollectionItem **view_data;
gint view_count;
- GList *factory_list;
-
GalViewCollectionItem **removed_view_data;
gint removed_view_count;
@@ -185,12 +183,6 @@ gal_view_collection_dispose (GObject *object)
priv->view_data = NULL;
priv->view_count = 0;
- g_list_foreach (
- priv->factory_list,
- (GFunc) g_object_unref, NULL);
- g_list_free (priv->factory_list);
- priv->factory_list = NULL;
-
for (ii = 0; ii < priv->removed_view_count; ii++)
gal_view_collection_item_free (priv->removed_view_data[ii]);
g_free (priv->removed_view_data);
@@ -338,29 +330,6 @@ gal_view_collection_set_storage_directories (GalViewCollection *collection,
g_object_notify (G_OBJECT (collection), "user-directory");
}
-/**
- * gal_view_collection_add_factory
- * @collection: The view collection to add a factory to
- * @factory: The factory to add. The @collection will add a reference
- * to the factory object, so you should unref it after calling this
- * function if you no longer need it.
- *
- * Adds the given factory to this collection. This list is used both
- * when loading views from their xml description as well as when the
- * user tries to create a new view.
- */
-void
-gal_view_collection_add_factory (GalViewCollection *collection,
- GalViewFactory *factory)
-{
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (GAL_IS_VIEW_FACTORY (factory));
-
- collection->priv->factory_list = g_list_prepend (
- collection->priv->factory_list,
- g_object_ref (factory));
-}
-
static void
view_changed (GalView *view,
GalViewCollectionItem *item)
diff --git a/e-util/gal-view-collection.h b/e-util/gal-view-collection.h
index 5cc355410e..700262e6ce 100644
--- a/e-util/gal-view-collection.h
+++ b/e-util/gal-view-collection.h
@@ -23,7 +23,7 @@
#ifndef GAL_VIEW_COLLECTION_H
#define GAL_VIEW_COLLECTION_H
-#include <e-util/gal-view-factory.h>
+#include <e-util/gal-view.h>
/* Standard GObject macros */
#define GAL_TYPE_VIEW_COLLECTION \
@@ -91,8 +91,6 @@ void gal_view_collection_set_storage_directories
(GalViewCollection *collection,
const gchar *system_dir,
const gchar *local_dir);
-void gal_view_collection_add_factory (GalViewCollection *collection,
- GalViewFactory *factory);
/* Query the view collection. */
gint gal_view_collection_get_count (GalViewCollection *collection);
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 79112202f2..cfb8213ae0 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -27,8 +27,6 @@
#include "e-book-shell-view-private.h"
-#include "addressbook/gui/widgets/gal-view-factory-minicard.h"
-
static void
open_contact (EBookShellView *book_shell_view,
EContact *contact,
@@ -456,25 +454,6 @@ book_shell_view_source_removed_cb (ESourceRegistry *registry,
}
static void
-book_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);
-
- factory = gal_view_factory_minicard_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- gal_view_collection_load (collection);
-}
-
-static void
book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
{
EBookShellContent *book_shell_content;
@@ -514,7 +493,7 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view,
priv->preview_index = -1;
if (!gal_view_collection_loaded (shell_view_class->view_collection))
- book_shell_view_load_view_collection (shell_view_class);
+ gal_view_collection_load (shell_view_class->view_collection);
g_signal_connect (
book_shell_view, "notify::view-id",
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index 1f76cad705..c36d200438 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -25,6 +25,8 @@
#include "e-book-shell-view-private.h"
+#include "addressbook/gui/widgets/gal-view-minicard.h"
+
static gpointer parent_class;
static GType book_shell_view_type;
@@ -370,6 +372,10 @@ book_shell_view_class_init (EBookShellViewClass *class)
shell_view_class->new_shell_sidebar = e_book_shell_sidebar_new;
shell_view_class->execute_search = book_shell_view_execute_search;
shell_view_class->update_actions = book_shell_view_update_actions;
+
+ /* Ensure the GalView types we need are registered. */
+ g_type_ensure (GAL_TYPE_VIEW_ETABLE);
+ g_type_ensure (GAL_TYPE_VIEW_MINICARD);
}
static void
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
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 7bb3043aae..9c0132aa26 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -538,21 +538,6 @@ mail_shell_view_prepare_for_quit_cb (EMailShellView *mail_shell_view,
}
static void
-mail_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
mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view)
{
EMailShellContent *mail_shell_content;
@@ -600,7 +585,7 @@ e_mail_shell_view_private_init (EMailShellView *mail_shell_view,
EShellViewClass *shell_view_class)
{
if (!gal_view_collection_loaded (shell_view_class->view_collection))
- mail_shell_view_load_view_collection (shell_view_class);
+ gal_view_collection_load (shell_view_class->view_collection);
g_signal_connect (
mail_shell_view, "notify::view-id",
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index a4d5e9987c..b294a5476b 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -1082,6 +1082,9 @@ mail_shell_view_class_init (EMailShellViewClass *class,
shell_view_class->toggled = mail_shell_view_toggled;
shell_view_class->execute_search = mail_shell_view_execute_search;
shell_view_class->update_actions = mail_shell_view_update_actions;
+
+ /* Ensure the GalView types we need are registered. */
+ g_type_ensure (GAL_TYPE_VIEW_ETABLE);
}
static void