aboutsummaryrefslogtreecommitdiffstats
path: root/modules
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 /modules
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 'modules')
-rw-r--r--modules/calendar/e-cal-shell-content.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 5c91354d51..cccc9993e8 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -78,15 +78,12 @@ cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
{
GnomeCalendar *calendar;
GnomeCalendarViewType view_type;
+ GType gal_view_type;
- /* XXX This is confusing: we have CalendarView and ECalendarView.
- * ECalendarView is an abstract base class for calendar view
- * widgets (day view, week view, etc). CalendarView is a
- * simple GalView subclass that represents a calendar view. */
-
+ gal_view_type = G_OBJECT_TYPE (gal_view);
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- if (GAL_IS_VIEW_ETABLE (gal_view)) {
+ if (gal_view_type == GAL_TYPE_VIEW_ETABLE) {
ECalendarView *calendar_view;
view_type = GNOME_CAL_LIST_VIEW;
@@ -95,9 +92,21 @@ cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
gal_view_etable_attach_table (
GAL_VIEW_ETABLE (gal_view),
E_CAL_LIST_VIEW (calendar_view)->table);
+
+ } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_DAY) {
+ view_type = GNOME_CAL_DAY_VIEW;
+
+ } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WORK_WEEK) {
+ view_type = GNOME_CAL_WORK_WEEK_VIEW;
+
+ } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WEEK) {
+ view_type = GNOME_CAL_WEEK_VIEW;
+
+ } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_MONTH) {
+ view_type = GNOME_CAL_MONTH_VIEW;
+
} else {
- view_type = calendar_view_get_view_type (
- CALENDAR_VIEW (gal_view));
+ g_return_if_reached ();
}
gnome_calendar_display_view (calendar, view_type);