diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-06 00:34:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-06 04:40:50 +0800 |
commit | 7bb795b299758e6a81536b81c19693f353106105 (patch) | |
tree | 35937e1022645939bf0f3635848b7f86e03fb19b /modules | |
parent | d629e6850a64b826fad60857a6b6945149ca8214 (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/addressbook/e-book-shell-view-private.c | 23 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view.c | 6 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-view-private.c | 35 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-view.c | 9 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-view-private.c | 17 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-view.c | 3 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-private.c | 17 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view.c | 3 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 17 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 3 |
10 files changed, 29 insertions, 104 deletions
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 |