aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-view-factory.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-03 02:44:14 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:49 +0800
commit3f5f362e0df717f2aaca8d21c3b3e180904a6897 (patch)
tree777bb5c4b968e627e893afd04d66b9189aef6f5f /calendar/gui/calendar-view-factory.c
parent2b9713656b939ec657b8d77932a2a7d147aa1f23 (diff)
downloadgsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar.gz
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar.bz2
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar.lz
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar.xz
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.tar.zst
gsoc2013-evolution-3f5f362e0df717f2aaca8d21c3b3e180904a6897.zip
Split CalendarView into separate classes by view type.
It's better to have separate classes each with a fixed type code, than one class with a variable type code. You'll see why in the next commit.
Diffstat (limited to 'calendar/gui/calendar-view-factory.c')
-rw-r--r--calendar/gui/calendar-view-factory.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c
index d84f770141..d975e491de 100644
--- a/calendar/gui/calendar-view-factory.c
+++ b/calendar/gui/calendar-view-factory.c
@@ -101,17 +101,31 @@ calendar_view_factory_get_type_code (GalViewFactory *factory)
/* new_view method for the calendar view factory */
static GalView *
calendar_view_factory_new_view (GalViewFactory *factory,
- const gchar *name)
+ const gchar *title)
{
CalendarViewFactory *cal_view_factory;
- CalendarViewFactoryPrivate *priv;
- CalendarView *cal_view;
+ GType type;
cal_view_factory = CALENDAR_VIEW_FACTORY (factory);
- priv = cal_view_factory->priv;
- cal_view = calendar_view_new (priv->view_type, name);
- return GAL_VIEW (cal_view);
+ switch (cal_view_factory->priv->view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ type = GAL_TYPE_VIEW_CALENDAR_DAY;
+ break;
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ type = GAL_TYPE_VIEW_CALENDAR_WORK_WEEK;
+ break;
+ case GNOME_CAL_WEEK_VIEW:
+ type = GAL_TYPE_VIEW_CALENDAR_WEEK;
+ break;
+ case GNOME_CAL_MONTH_VIEW:
+ type = GAL_TYPE_VIEW_CALENDAR_MONTH;
+ break;
+ default:
+ g_return_val_if_reached (NULL);
+ }
+
+ return g_object_new (type, "title", title, NULL);
}
/**