[evolution] GalViewFactoryClass: Remove the new_view() method.



commit a2e20af49304296b3c2b10305cb1312031107d55
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Jul 2 17:36:01 2013 -0400

    GalViewFactoryClass: Remove the new_view() method.
    
    GalViewFactory can now use its "gal_view_type" class member to
    instantiate an appropriate GalView without help from subclasses.

 .../gui/widgets/gal-view-factory-minicard.c        |    8 ----
 calendar/gui/calendar-view-factory.c               |   40 --------------------
 e-util/gal-view-factory-etable.c                   |    8 ----
 e-util/gal-view-factory.c                          |    7 +--
 e-util/gal-view-factory.h                          |    6 +--
 5 files changed, 4 insertions(+), 65 deletions(-)
---
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.c 
b/addressbook/gui/widgets/gal-view-factory-minicard.c
index 915bc03..9c9a7b4 100644
--- a/addressbook/gui/widgets/gal-view-factory-minicard.c
+++ b/addressbook/gui/widgets/gal-view-factory-minicard.c
@@ -32,13 +32,6 @@ G_DEFINE_TYPE (
        GalViewFactoryMinicard,
        gal_view_factory_minicard, GAL_TYPE_VIEW_FACTORY)
 
-static GalView *
-gal_view_factory_minicard_new_view (GalViewFactory *factory,
-                                    const gchar *name)
-{
-       return gal_view_minicard_new (name);
-}
-
 static void
 gal_view_factory_minicard_class_init (GalViewFactoryMinicardClass *minicard_class)
 {
@@ -46,7 +39,6 @@ gal_view_factory_minicard_class_init (GalViewFactoryMinicardClass *minicard_clas
 
        view_factory_class = GAL_VIEW_FACTORY_CLASS (minicard_class);
        view_factory_class->gal_view_type = GAL_TYPE_VIEW_MINICARD;
-       view_factory_class->new_view = gal_view_factory_minicard_new_view;
 }
 
 static void
diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c
index 706f5ea..603bb0e 100644
--- a/calendar/gui/calendar-view-factory.c
+++ b/calendar/gui/calendar-view-factory.c
@@ -43,20 +43,10 @@ G_DEFINE_TYPE (
        gal_view_factory_calendar_month,
        GAL_TYPE_VIEW_FACTORY)
 
-static GalView *
-gal_view_factory_calendar_day_new_view (GalViewFactory *factory,
-                                        const gchar *title)
-{
-       return g_object_new (
-               GAL_TYPE_VIEW_CALENDAR_DAY,
-               "title", title, NULL);
-}
-
 static void
 gal_view_factory_calendar_day_class_init (GalViewFactoryClass *class)
 {
        class->gal_view_type = GAL_TYPE_VIEW_CALENDAR_DAY;
-       class->new_view = gal_view_factory_calendar_day_new_view;
 }
 
 static void
@@ -64,20 +54,10 @@ gal_view_factory_calendar_day_init (GalViewFactory *factory)
 {
 }
 
-static GalView *
-gal_view_factory_calendar_work_week_new_view (GalViewFactory *factory,
-                                              const gchar *title)
-{
-       return g_object_new (
-               GAL_TYPE_VIEW_CALENDAR_WORK_WEEK,
-               "title", title, NULL);
-}
-
 static void
 gal_view_factory_calendar_work_week_class_init (GalViewFactoryClass *class)
 {
        class->gal_view_type = GAL_TYPE_VIEW_CALENDAR_WORK_WEEK;
-       class->new_view = gal_view_factory_calendar_work_week_new_view;
 }
 
 static void
@@ -85,20 +65,10 @@ gal_view_factory_calendar_work_week_init (GalViewFactory *factory)
 {
 }
 
-static GalView *
-gal_view_factory_calendar_week_new_view (GalViewFactory *factory,
-                                         const gchar *title)
-{
-       return g_object_new (
-               GAL_TYPE_VIEW_CALENDAR_WEEK,
-               "title", title, NULL);
-}
-
 static void
 gal_view_factory_calendar_week_class_init (GalViewFactoryClass *class)
 {
        class->gal_view_type = GAL_TYPE_VIEW_CALENDAR_WEEK;
-       class->new_view = gal_view_factory_calendar_week_new_view;
 }
 
 static void
@@ -106,20 +76,10 @@ gal_view_factory_calendar_week_init (GalViewFactory *factory)
 {
 }
 
-static GalView *
-gal_view_factory_calendar_month_new_view (GalViewFactory *factory,
-                                          const gchar *title)
-{
-       return g_object_new (
-               GAL_TYPE_VIEW_CALENDAR_MONTH,
-               "title", title, NULL);
-}
-
 static void
 gal_view_factory_calendar_month_class_init (GalViewFactoryClass *class)
 {
        class->gal_view_type = GAL_TYPE_VIEW_CALENDAR_MONTH;
-       class->new_view = gal_view_factory_calendar_month_new_view;
 }
 
 static void
diff --git a/e-util/gal-view-factory-etable.c b/e-util/gal-view-factory-etable.c
index f9a6edd..08eb91a 100644
--- a/e-util/gal-view-factory-etable.c
+++ b/e-util/gal-view-factory-etable.c
@@ -32,13 +32,6 @@ G_DEFINE_TYPE (
        gal_view_factory_etable,
        GAL_TYPE_VIEW_FACTORY)
 
-static GalView *
-view_factory_etable_new_view (GalViewFactory *factory,
-                              const gchar *name)
-{
-       return gal_view_etable_new (name);
-}
-
 static void
 gal_view_factory_etable_class_init (GalViewFactoryEtableClass *class)
 {
@@ -46,7 +39,6 @@ gal_view_factory_etable_class_init (GalViewFactoryEtableClass *class)
 
        view_factory_class = GAL_VIEW_FACTORY_CLASS (class);
        view_factory_class->gal_view_type = GAL_TYPE_VIEW_ETABLE;
-       view_factory_class->new_view = view_factory_etable_new_view;
 }
 
 static void
diff --git a/e-util/gal-view-factory.c b/e-util/gal-view-factory.c
index d235a63..9d0ef75 100644
--- a/e-util/gal-view-factory.c
+++ b/e-util/gal-view-factory.c
@@ -68,21 +68,20 @@ gal_view_factory_get_type_code (GalViewFactory *factory)
 /**
  * gal_view_factory_new_view:
  * @factory: a #GalViewFactory
- * @name: the name for the view
+ * @title: the title for the view
  *
  * Returns: The new view
  */
 GalView *
 gal_view_factory_new_view (GalViewFactory *factory,
-                           const gchar *name)
+                           const gchar *title)
 {
        GalViewFactoryClass *class;
 
        g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
 
        class = GAL_VIEW_FACTORY_GET_CLASS (factory);
-       g_return_val_if_fail (class->new_view != NULL, NULL);
 
-       return class->new_view (factory, name);
+       return g_object_new (class->gal_view_type, "title", title, NULL);
 }
 
diff --git a/e-util/gal-view-factory.h b/e-util/gal-view-factory.h
index 73cc022..0eb4d00 100644
--- a/e-util/gal-view-factory.h
+++ b/e-util/gal-view-factory.h
@@ -62,10 +62,6 @@ struct _GalViewFactoryClass {
        GObjectClass parent_class;
 
        GType gal_view_type;
-
-       /* Methods */
-       GalView *       (*new_view)             (GalViewFactory *factory,
-                                                const gchar *name);
 };
 
 GType          gal_view_factory_get_type       (void);
@@ -77,7 +73,7 @@ GType         gal_view_factory_get_type       (void);
 const gchar *  gal_view_factory_get_type_code  (GalViewFactory *factory);
 
 GalView *      gal_view_factory_new_view       (GalViewFactory *factory,
-                                                const gchar *name);
+                                                const gchar *title);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]