From ce6939b848eb228ec705aac4c8de6cfec16ecd10 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 17 Jul 2003 12:00:40 +0000 Subject: new base class for calendar views. 2003-07-17 Rodrigo Moya * gui/e-cal-view.[ch]: new base class for calendar views. * gui/e-day-view.[ch]: * gui/e-week-view.[ch]: base these classes on ECalView. * gui/Makefile.am: added new files. svn path=/trunk/; revision=21854 --- calendar/ChangeLog | 9 ++++++ calendar/gui/e-cal-view.c | 70 ++++++++++++++++++++++++++++++++++++++++++ calendar/gui/e-cal-view.h | 55 +++++++++++++++++++++++++++++++++ calendar/gui/e-calendar-view.c | 70 ++++++++++++++++++++++++++++++++++++++++++ calendar/gui/e-calendar-view.h | 55 +++++++++++++++++++++++++++++++++ calendar/gui/e-day-view.c | 2 +- calendar/gui/e-day-view.h | 6 ++-- calendar/gui/e-week-view.c | 4 +-- calendar/gui/e-week-view.h | 5 +-- 9 files changed, 269 insertions(+), 7 deletions(-) create mode 100644 calendar/gui/e-cal-view.c create mode 100644 calendar/gui/e-cal-view.h create mode 100644 calendar/gui/e-calendar-view.c create mode 100644 calendar/gui/e-calendar-view.h diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 3994474253..5bb769a8b6 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2003-07-17 Rodrigo Moya + + * gui/e-cal-view.[ch]: new base class for calendar views. + + * gui/e-day-view.[ch]: + * gui/e-week-view.[ch]: base these classes on ECalView. + + * gui/Makefile.am: added new files. + 2003-07-17 Rodrigo Moya * gui/calendar-config.[ch]: diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c new file mode 100644 index 0000000000..af2223bbff --- /dev/null +++ b/calendar/gui/e-cal-view.c @@ -0,0 +1,70 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Author : + * Rodrigo Moya + * + * Copyright 2003, Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include +#include +#include "e-cal-view.h" + +struct _ECalViewPrivate { +}; + +static void e_cal_view_class_init (ECalViewClass *klass); +static void e_cal_view_init (ECalView *cal_view, ECalViewClass *klass); +static void e_cal_view_destroy (GtkObject *object); + +static GObjectClass *parent_class = NULL; + +static void +e_cal_view_class_init (ECalViewClass *klass) +{ + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->destroy = e_cal_view_destroy; +} + +static void +e_cal_view_init (ECalView *cal_view, ECalViewClass *klass) +{ + cal_view->priv = g_new0 (ECalViewPrivate, 1); +} + +static void +e_cal_view_destroy (GtkObject *object) +{ + ECalView *cal_view = (ECalView *) object; + + g_return_if_fail (E_IS_CAL_VIEW (cal_view)); + + if (cal_view->priv) { + g_free (cal_view->priv); + cal_view->priv = NULL; + } + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init, + e_cal_view_init, GTK_TYPE_TABLE); diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h new file mode 100644 index 0000000000..bbcfbc8990 --- /dev/null +++ b/calendar/gui/e-cal-view.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Author : + * Rodrigo Moya + * + * Copyright 2003, Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ +#ifndef _E_CAL_VIEW_H_ +#define _E_CAL_VIEW_H_ + +#include + +G_BEGIN_DECLS + +/* + * EView - base widget class for the calendar views. + */ + +#define E_CAL_VIEW(obj) GTK_CHECK_CAST (obj, e_cal_view_get_type (), ECalView) +#define E_CAL_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cal_view_get_type (), ECalViewClass) +#define E_IS_CAL_VIEW(obj) GTK_CHECK_TYPE (obj, e_cal_view_get_type ()) + +typedef struct _ECalView ECalView; +typedef struct _ECalViewClass ECalViewClass; +typedef struct _ECalViewPrivate ECalViewPrivate; + +struct _ECalView { + GtkTable table; + ECalViewPrivate *priv; +}; + +struct _ECalViewClass { + GtkTableClass parent_class; +}; + +GType e_cal_view_get_type (void); + +G_END_DECLS + +#endif diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c new file mode 100644 index 0000000000..af2223bbff --- /dev/null +++ b/calendar/gui/e-calendar-view.c @@ -0,0 +1,70 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Author : + * Rodrigo Moya + * + * Copyright 2003, Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include +#include +#include "e-cal-view.h" + +struct _ECalViewPrivate { +}; + +static void e_cal_view_class_init (ECalViewClass *klass); +static void e_cal_view_init (ECalView *cal_view, ECalViewClass *klass); +static void e_cal_view_destroy (GtkObject *object); + +static GObjectClass *parent_class = NULL; + +static void +e_cal_view_class_init (ECalViewClass *klass) +{ + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->destroy = e_cal_view_destroy; +} + +static void +e_cal_view_init (ECalView *cal_view, ECalViewClass *klass) +{ + cal_view->priv = g_new0 (ECalViewPrivate, 1); +} + +static void +e_cal_view_destroy (GtkObject *object) +{ + ECalView *cal_view = (ECalView *) object; + + g_return_if_fail (E_IS_CAL_VIEW (cal_view)); + + if (cal_view->priv) { + g_free (cal_view->priv); + cal_view->priv = NULL; + } + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init, + e_cal_view_init, GTK_TYPE_TABLE); diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h new file mode 100644 index 0000000000..bbcfbc8990 --- /dev/null +++ b/calendar/gui/e-calendar-view.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Author : + * Rodrigo Moya + * + * Copyright 2003, Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ +#ifndef _E_CAL_VIEW_H_ +#define _E_CAL_VIEW_H_ + +#include + +G_BEGIN_DECLS + +/* + * EView - base widget class for the calendar views. + */ + +#define E_CAL_VIEW(obj) GTK_CHECK_CAST (obj, e_cal_view_get_type (), ECalView) +#define E_CAL_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_cal_view_get_type (), ECalViewClass) +#define E_IS_CAL_VIEW(obj) GTK_CHECK_TYPE (obj, e_cal_view_get_type ()) + +typedef struct _ECalView ECalView; +typedef struct _ECalViewClass ECalViewClass; +typedef struct _ECalViewPrivate ECalViewPrivate; + +struct _ECalView { + GtkTable table; + ECalViewPrivate *priv; +}; + +struct _ECalViewClass { + GtkTableClass parent_class; +}; + +GType e_cal_view_get_type (void); + +G_END_DECLS + +#endif diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 223a2fe3bd..f40417ec50 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -500,7 +500,7 @@ static GtkTableClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init, - e_day_view_init, GTK_TYPE_TABLE); + e_day_view_init, e_cal_view_get_type ()); static void e_day_view_class_init (EDayViewClass *class) diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 6485102fc7..f8889ac26b 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -26,9 +26,11 @@ #include #include +#include #include #include +#include "e-cal-view.h" #include "gnome-cal.h" #include "evolution-activity-client.h" @@ -222,7 +224,7 @@ typedef struct _EDayViewClass EDayViewClass; struct _EDayView { - GtkTable table; + ECalView cal_view; /* The top canvas where the dates and long appointments are shown. */ GtkWidget *top_canvas; @@ -505,7 +507,7 @@ struct _EDayView struct _EDayViewClass { - GtkTableClass parent_class; + ECalViewClass parent_class; /* Notification signals */ void (* selection_changed) (EDayView *day_view); diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index ec2bf212f1..120c494583 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -250,11 +250,11 @@ static void e_week_view_queue_layout (EWeekView *week_view); static void e_week_view_cancel_layout (EWeekView *week_view); static gboolean e_week_view_layout_timeout_cb (gpointer data); -static GtkTableClass *parent_class; +static ECalViewClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; E_MAKE_TYPE (e_week_view, "EWeekView", EWeekView, e_week_view_class_init, - e_week_view_init, GTK_TYPE_TABLE); + e_week_view_init, e_cal_view_get_type ()); static void e_week_view_class_init (EWeekViewClass *class) diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index fe535c5335..c1379f6728 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -28,6 +28,7 @@ #include #include +#include "e-cal-view.h" #include "gnome-cal.h" #include "evolution-activity-client.h" @@ -178,7 +179,7 @@ typedef struct _EWeekViewClass EWeekViewClass; struct _EWeekView { - GtkTable table; + ECalView cal_view; /* The top canvas where the dates are shown. */ GtkWidget *titles_canvas; @@ -374,7 +375,7 @@ struct _EWeekView struct _EWeekViewClass { - GtkTableClass parent_class; + ECalViewClass parent_class; /* Notification signals */ void (* selection_changed) (EWeekView *week_view); -- cgit