aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-26 03:26:03 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-26 03:26:03 +0800
commitad465a7c1fbea59767741ae5e56a94b5f5f7c6a1 (patch)
tree94dcd12b95734f19931042ef8129f105a7cca9af
parenta1e1732de6b64e68c6a30bd097485c00e36a8bec (diff)
downloadgsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar.gz
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar.bz2
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar.lz
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar.xz
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.tar.zst
gsoc2013-evolution-ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1.zip
Re-enable building GnomeCalendar, except it doesn't yet.
Also, start trimming the API down a bit. Lots of redundancy there.
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/ea-gnome-calendar.c6
-rw-r--r--calendar/gui/gnome-cal.c143
-rw-r--r--calendar/gui/gnome-cal.h13
-rw-r--r--modules/calendar/e-cal-shell-content.c187
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c28
-rw-r--r--modules/calendar/e-cal-shell-view.c10
7 files changed, 145 insertions, 244 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 0cf9c99aa8..30a0c33c05 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -49,7 +49,6 @@ noinst_LTLIBRARIES = libcal-gui.la
# Removed from SOURCES
# cal-search-bar.c
# cal-search-bar.h
-# gnome-cal.c
libcal_gui_la_SOURCES = \
e-attachment-handler-calendar.c \
@@ -165,6 +164,7 @@ libcal_gui_la_SOURCES = \
e-timezone-entry.h \
goto.c \
goto.h \
+ gnome-cal.c \
gnome-cal.h \
itip-utils.c \
itip-utils.h \
diff --git a/calendar/gui/ea-gnome-calendar.c b/calendar/gui/ea-gnome-calendar.c
index e5d9654c1a..1cc75e5538 100644
--- a/calendar/gui/ea-gnome-calendar.c
+++ b/calendar/gui/ea-gnome-calendar.c
@@ -268,6 +268,8 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
{
AtkObject * child = NULL;
GnomeCalendar * calendarWidget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
GtkWidget *childWidget;
g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
@@ -290,7 +292,9 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
break;
case 1:
/* for the day/week view */
- childWidget = gnome_calendar_get_current_view_widget (calendarWidget);
+ view_type = gnome_calendar_get_view (calendarWidget);
+ view = gnome_calendar_get_calendar_view (calendarWidget, view_type);
+ childWidget = GTK_WIDGET (view);
child = gtk_widget_get_accessible (childWidget);
atk_object_set_parent (child, obj);
break;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index b4eacf8a07..b848d8b4bf 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -41,12 +41,10 @@
#include <libedataserver/e-url.h>
#include <libedataserverui/e-passwords.h>
-#include "shell/e-user-creatable-items-handler.h"
#include <libecal/e-cal-time-util.h>
#include <widgets/menus/gal-view-factory-etable.h>
#include <widgets/menus/gal-view-etable.h>
#include <widgets/menus/gal-define-views-dialog.h>
-#include "widgets/menus/gal-view-menus.h"
#include "e-util/e-util.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
@@ -64,17 +62,14 @@
#include "e-cal-list-view-config.h"
#include "e-mini-calendar-config.h"
#include "e-calendar-table-config.h"
-#include "evolution-calendar.h"
#include "gnome-cal.h"
-#include "calendar-component.h"
-#include "cal-search-bar.h"
#include "calendar-commands.h"
#include "calendar-config.h"
#include "calendar-view.h"
#include "calendar-view-factory.h"
#include "tag-calendar.h"
#include "misc.h"
-#include "a11y/ea-calendar.h"
+/*#include "a11y/ea-calendar.h" KILL-BONOBO */
#include "common/authentication.h"
#include "e-cal-popup.h"
#include "e-cal-menu.h"
@@ -116,9 +111,6 @@ struct _GnomeCalendarPrivate {
GtkWidget *month_view;
GtkWidget *list_view;
- /* Activity */
- EActivityHandler *activity_handler;
-
/* plugin menu managers */
ECalMenu *calendar_menu;
@@ -523,15 +515,15 @@ dn_e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer data)
g_warning (G_STRLOC ": Query did not successfully complete");
}
-/* Returns the current view widget, an EDayView, EWeekView or ECalListView. */
-GtkWidget*
-gnome_calendar_get_current_view_widget (GnomeCalendar *gcal)
+ECalendarView *
+gnome_calendar_get_calendar_view (GnomeCalendar *gcal,
+ GnomeCalendarViewType view_type)
{
- GnomeCalendarPrivate *priv;
-
- priv = gcal->priv;
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+ g_return_val_if_fail (view_type >= 0, NULL);
+ g_return_val_if_fail (view_type < GNOME_CAL_LAST_VIEW, NULL);
- return GTK_WIDGET (priv->views[priv->current_view_type]);
+ return gcal->priv->views[view_type];
}
static void
@@ -1125,21 +1117,23 @@ static gboolean
update_marcus_bains_line_cb (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
time_t now, day_begin;
priv = gcal->priv;
- if ((priv->current_view_type == GNOME_CAL_DAY_VIEW) ||
- (priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW)) {
- e_day_view_update_marcus_bains (E_DAY_VIEW (gnome_calendar_get_current_view_widget (gcal)));
- }
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ if (E_IS_DAY_VIEW (view))
+ e_day_view_update_marcus_bains (E_DAY_VIEW (view));
time (&now);
day_begin = time_day_begin (now);
/* check in the first two minutes */
if (now >= day_begin && now <= day_begin + 120) {
- ECalendarView *view = priv->views[priv->current_view_type];
time_t start_time = 0, end_time = 0;
g_return_val_if_fail (view != NULL, TRUE);
@@ -1347,13 +1341,6 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->hpane);
gtk_box_pack_start (GTK_BOX (gcal), priv->hpane, TRUE, TRUE, 6);
- /* The Notebook containing the 4 calendar views. */
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_widget_show (priv->notebook);
- gtk_paned_pack1 (GTK_PANED (priv->hpane), priv->notebook, FALSE, TRUE);
-
/* The ECalendar. */
w = e_calendar_new ();
priv->date_navigator = E_CALENDAR (w);
@@ -1464,13 +1451,6 @@ setup_widgets (GnomeCalendar *gcal)
priv->views[GNOME_CAL_LIST_VIEW] = E_CALENDAR_VIEW (priv->list_view);
priv->configs[GNOME_CAL_LIST_VIEW] = G_OBJECT (e_cal_list_view_config_new (E_CAL_LIST_VIEW (priv->views[GNOME_CAL_LIST_VIEW])));
- for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) {
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
- GTK_WIDGET (priv->views[i]), gtk_label_new (""));
-
- gtk_widget_show (GTK_WIDGET (priv->views[i]));
- }
-
/* Memo view */
vbox = gtk_vbox_new (FALSE, 0);
label = gtk_label_new (NULL);
@@ -1830,7 +1810,13 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
static void
focus_current_view (GnomeCalendar *gcal)
{
- gtk_widget_grab_focus (gnome_calendar_get_current_view_widget (gcal));
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
+
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ gtk_widget_grab_focus (GTK_WIDGET (view));
}
void
@@ -1854,13 +1840,9 @@ gnome_calendar_goto_today (GnomeCalendar *gcal)
GnomeCalendarViewType
gnome_calendar_get_view (GnomeCalendar *gcal)
{
- GnomeCalendarPrivate *priv;
-
- g_return_val_if_fail (gcal != NULL, GNOME_CAL_DAY_VIEW);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), GNOME_CAL_DAY_VIEW);
- priv = gcal->priv;
- return priv->current_view_type;
+ return gcal->priv->current_view_type;
}
static void
@@ -2709,8 +2691,13 @@ gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
time_t *start_time,
time_t *end_time)
{
- e_calendar_view_get_selected_time_range (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)),
- start_time, end_time);
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
+
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ e_calendar_view_get_selected_time_range (view, start_time, end_time);
}
/* Gets the visible time range for the current view. Returns FALSE if no
@@ -2720,14 +2707,16 @@ gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
time_t *start_time,
time_t *end_time)
{
- gboolean retval = FALSE;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
- retval = e_calendar_view_get_visible_time_range (E_CALENDAR_VIEW (gnome_calendar_get_current_view_widget (gcal)),
- start_time, end_time);
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
- return retval;
+ return e_calendar_view_get_visible_time_range (
+ view, start_time, end_time);
}
/* This updates the month shown and the days selected in the calendar, if
@@ -2926,34 +2915,43 @@ gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gc
void
gnome_calendar_cut_clipboard (GnomeCalendar *gcal)
{
- GtkWidget *widget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- widget = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_cut_clipboard (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ e_calendar_view_cut_clipboard (view);
}
void
gnome_calendar_copy_clipboard (GnomeCalendar *gcal)
{
- GtkWidget *widget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- widget = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_copy_clipboard (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ e_calendar_view_copy_clipboard (view);
}
void
gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
{
- GtkWidget *widget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- widget = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_paste_clipboard (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (view_type);
+
+ e_calendar_view_paste_clipboard (view);
}
/* Get the current timezone. */
@@ -2998,12 +2996,15 @@ gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal)
gint
gnome_calendar_get_num_events_selected (GnomeCalendar *gcal)
{
- GtkWidget *view;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
gint retval = 0;
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
- view = gnome_calendar_get_current_view_widget (gcal);
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
if (E_IS_DAY_VIEW (view))
retval = e_day_view_get_num_events_selected (E_DAY_VIEW (view));
else
@@ -3015,23 +3016,29 @@ gnome_calendar_get_num_events_selected (GnomeCalendar *gcal)
void
gnome_calendar_delete_selection (GnomeCalendar *gcal)
{
- GtkWidget *widget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- widget = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_delete_selected_events (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ e_calendar_view_delete_selected_events (view);
}
void
gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
{
- GtkWidget *widget;
+ GnomeCalendarViewType view_type;
+ ECalendarView *view;
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- widget = gnome_calendar_get_current_view_widget (gcal);
- e_calendar_view_delete_selected_occurrence (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (gcal);
+ view = gnome_calendar_get_calendar_view (gcal, view_type);
+
+ e_calendar_view_delete_selected_occurrence (view);
}
static gboolean
@@ -3146,14 +3153,6 @@ gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal)
return GTK_WIDGET(gcal->priv->search_bar);
}
-GtkWidget *
-gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return GTK_WIDGET(gcal->priv->notebook);
-}
-
ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal)
{
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 75ae9b1710..7955aedb6c 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -37,10 +37,6 @@
#include "e-cal-menu.h"
#include "e-calendar-table.h"
-G_BEGIN_DECLS
-
-
-
#define GNOME_TYPE_CALENDAR (gnome_calendar_get_type ())
#define GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CALENDAR, GnomeCalendar))
#define GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), GNOME_TYPE_CALENDAR, \
@@ -48,6 +44,11 @@ G_BEGIN_DECLS
#define GNOME_IS_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CALENDAR))
#define GNOME_IS_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CALENDAR))
+G_BEGIN_DECLS
+
+/* Avoid circular inclusion. */
+struct _ECalendarView;
+
typedef struct _GnomeCalendar GnomeCalendar;
typedef struct _GnomeCalendarClass GnomeCalendarClass;
typedef struct _GnomeCalendarPrivate GnomeCalendarPrivate;
@@ -124,11 +125,11 @@ void gnome_calendar_goto_today (GnomeCalendar *gcal);
GnomeCalendarViewType gnome_calendar_get_view (GnomeCalendar *gcal);
void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type);
-GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal);
+struct _ECalendarView *gnome_calendar_get_calendar_view (GnomeCalendar *gcal,
+ GnomeCalendarViewType view_type);
GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal);
-GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_get_tag (GnomeCalendar *gcal);
ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal);
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 6afb40dce7..0f888c13e9 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -46,19 +46,10 @@ struct _ECalShellContentPrivate {
GtkWidget *notebook;
GtkWidget *vpaned;
- GtkWidget *day_view;
- GtkWidget *work_week_view;
- GtkWidget *week_view;
- GtkWidget *month_view;
- GtkWidget *list_view;
+ GtkWidget *calendar;
GtkWidget *task_table;
GtkWidget *memo_table;
- EDayViewConfig *day_view_config;
- EDayViewConfig *work_week_view_config;
- EWeekViewConfig *week_view_config;
- EWeekViewConfig *month_view_config;
- ECalListViewConfig *list_view_config;
ECalendarTableConfig *task_table_config;
EMemoTableConfig *memo_table_config;
@@ -129,13 +120,15 @@ cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
#if 0 /* TEMPORARILY DISABLED */
GtkWidget *widget;
GnomeCalendar *calendar;
+ GnomeCalendarViewType view_type;
+ ECalendarView calendar_view;
ECalendarTable *task_table;
EMemoTable *memo_table;
ETable *table;
- ECalendarView *calendar_view;
calendar = GNOME_CALENDAR (cal_shell_content->priv->calendar);
- widget = gnome_calendar_get_current_view_widget (calendar);
+ view_type = gnome_calendar_get_view (calendar);
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table);
task_table = E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
@@ -148,34 +141,34 @@ cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
return FOCUS_TASK_TABLE;
- if (E_IS_DAY_VIEW (widget)) {
- EDayView *view = E_DAY_VIEW (widget);
+ if (E_IS_DAY_VIEW (calendar_view)) {
+ EDayView *day_view = E_DAY_VIEW (calendar_view);
- if (GTK_WIDGET_HAS_FOCUS (view->top_canvas))
+ if (GTK_WIDGET_HAS_FOCUS (day_view->top_canvas))
return FOCUS_CALENDAR;
- if (GNOME_CANVAS (view->top_canvas)->focused_item != NULL)
+ if (GNOME_CANVAS (day_view->top_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ if (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))
return FOCUS_CALENDAR;
- if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ if (GNOME_CANVAS (day_view->main_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- } else if (E_IS_WEEK_VIEW (widget)) {
- EWeekView *view = E_WEEK_VIEW (widget);
+ } else if (E_IS_WEEK_VIEW (calendar_view)) {
+ EWeekView *week_view = E_WEEK_VIEW (calendar_view);
- if (GTK_WIDGET_HAS_FOCUS (view->main_canvas))
+ if (GTK_WIDGET_HAS_FOCUS (week_view->main_canvas))
return FOCUS_CALENDAR;
- if (GNOME_CANVAS (view->main_canvas)->focused_item != NULL)
+ if (GNOME_CANVAS (week_view->main_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- } else if (E_IS_CAL_LIST_VIEW (widget)) {
- ECalListView *view = E_CAL_LIST_VIEW (widget);
+ } else if (E_IS_CAL_LIST_VIEW (calendar_view)) {
+ ECalListView *list_view = E_CAL_LIST_VIEW (widget);
- table = e_table_scrolled_get_table (view->table_scrolled);
+ table = e_table_scrolled_get_table (list_view->table_scrolled);
if (GTK_WIDGET_HAS_FOCUS (table))
return FOCUS_CALENDAR;
}
@@ -230,29 +223,9 @@ cal_shell_content_dispose (GObject *object)
priv->vpaned = NULL;
}
- if (priv->day_view != NULL) {
- g_object_unref (priv->day_view);
- priv->day_view = NULL;
- }
-
- if (priv->work_week_view != NULL) {
- g_object_unref (priv->work_week_view);
- priv->work_week_view = NULL;
- }
-
- if (priv->week_view != NULL) {
- g_object_unref (priv->week_view);
- priv->week_view = NULL;
- }
-
- if (priv->month_view != NULL) {
- g_object_unref (priv->month_view);
- priv->month_view = NULL;
- }
-
- if (priv->list_view != NULL) {
- g_object_unref (priv->list_view);
- priv->list_view = NULL;
+ if (priv->calendar != NULL) {
+ g_object_unref (priv->calendar);
+ priv->calendar = NULL;
}
if (priv->task_table != NULL) {
@@ -265,31 +238,6 @@ cal_shell_content_dispose (GObject *object)
priv->memo_table = NULL;
}
- if (priv->day_view_config != NULL) {
- g_object_unref (priv->day_view_config);
- priv->day_view_config = NULL;
- }
-
- if (priv->work_week_view_config != NULL) {
- g_object_unref (priv->work_week_view_config);
- priv->work_week_view_config = NULL;
- }
-
- if (priv->week_view_config != NULL) {
- g_object_unref (priv->week_view_config);
- priv->week_view_config = NULL;
- }
-
- if (priv->month_view_config != NULL) {
- g_object_unref (priv->month_view_config);
- priv->month_view_config = NULL;
- }
-
- if (priv->list_view_config != NULL) {
- g_object_unref (priv->list_view_config);
- priv->list_view_config = NULL;
- }
-
if (priv->task_table_config != NULL) {
g_object_unref (priv->task_table_config);
priv->task_table_config = NULL;
@@ -342,6 +290,7 @@ cal_shell_content_constructed (GObject *object)
gchar *filename;
gchar *markup;
gint page_num;
+ gint ii;
priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (object);
@@ -402,74 +351,19 @@ cal_shell_content_constructed (GObject *object)
container = priv->notebook;
/* Add views in the order defined by GnomeCalendarViewType, such
- * that the notebook page number corresponds to the view type.
- * The assertions below ensure that stays true. */
-
-#if 0 /* Not so fast... get the memo/task pads working first. */
- /* FIXME Need to establish a calendar and timezone first. */
- widget = e_day_view_new (E_CAL_MODEL (cal_model));
- e_calendar_view_set_calendar (
- E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
- e_calendar_view_set_timezone (
- E_CALENDAR_VIEW (widget), priv->timezone);
- page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
- gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
- g_return_if_fail (page_num == GNOME_CAL_DAY_VIEW);
- priv->day_view = g_object_ref (widget);
- gtk_widget_show (widget);
+ * that the notebook page number corresponds to the view type. */
- /* FIXME Need to establish a calendar and timezone first. */
- widget = e_day_view_new (E_CAL_MODEL (cal_model));
- e_day_view_set_work_week_view (E_DAY_VIEW (widget), TRUE);
- e_day_view_set_days_shown (E_DAY_VIEW (widget), 5);
- e_calendar_view_set_calendar (
- E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
- e_calendar_view_set_timezone (
- E_CALENDAR_VIEW (widget), priv->timezone);
- page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
- gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
- g_return_if_fail (page_num == GNOME_CAL_WORK_WEEK_VIEW);
- priv->work_week_view = g_object_ref (widget);
- gtk_widget_show (widget);
+ for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) {
+ GnomeCalendar *calendar;
+ ECalendarView *view;
- /* FIXME Need to establish a calendar and timezone first. */
- widget = e_week_view_new (E_CAL_MODEL (cal_model));
- e_calendar_view_set_calendar (
- E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
- e_calendar_view_set_timezone (
- E_CALENDAR_VIEW (widget), priv->timezone);
- page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
- gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
- g_return_if_fail (page_num == GNOME_CAL_WEEK_VIEW);
- priv->week_view = g_object_ref (widget);
- gtk_widget_show (widget);
+ calendar = GNOME_CALENDAR (priv->calendar);
+ view = gnome_calendar_get_calendar_view (calendar, ii);
- /* FIXME Need to establish a calendar and timezone first. */
- widget = e_week_view_new (E_CAL_MODEL (cal_model));
- e_week_view_set_multi_week_view (E_WEEK_VIEW (widget), TRUE);
- e_week_view_set_weeks_shown (E_WEEK_VIEW (widget), 6);
- e_calendar_view_set_calendar (
- E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
- e_calendar_view_set_timezone (
- E_CALENDAR_VIEW (widget), priv->timezone);
- page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
- gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
- g_return_if_fail (page_num == GNOME_CAL_MONTH_VIEW);
- priv->month_view = g_object_ref (widget);
- gtk_widget_show (widget);
-
- /* FIXME Need to establish a calendar and timezone first. */
- widget = e_cal_list_view_new (E_CAL_MODEL (cal_model));
- e_calendar_view_set_calendar (
- E_CALENDAR_VIEW (widget), GNOME_CALENDAR (priv->calendar));
- e_calendar_view_set_timezone (
- E_CALENDAR_VIEW (widget), priv->timezone);
- page_num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget));
- gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL);
- g_return_if_fail (page_num == GNOME_CAL_LIST_VIEW);
- priv->list_view = g_object_ref (widget);
- gtk_widget_show (widget);
-#endif
+ gtk_notebook_append_page (
+ GTK_NOTEBOOK (container), GTK_WIDGET (view), NULL);
+ gtk_widget_show (GTK_WIDGET (view));
+ }
container = priv->vpaned;
@@ -523,17 +417,7 @@ cal_shell_content_constructed (GObject *object)
e_memo_table_load_state (E_MEMO_TABLE (widget), filename);
g_free (filename);
- /* Configuration managers for views and tables. */
- priv->day_view_config = e_day_view_config_new (
- E_DAY_VIEW (priv->day_view));
- priv->work_week_view_config = e_day_view_config_new (
- E_DAY_VIEW (priv->work_week_view));
- priv->week_view_config = e_week_view_config_new (
- E_WEEK_VIEW (priv->week_view));
- priv->month_view_config = e_week_view_config_new (
- E_WEEK_VIEW (priv->month_view));
- priv->list_view_config = e_cal_list_view_config_new (
- E_CAL_LIST_VIEW (priv->list_view));
+ /* Configuration managers for task and memo tables. */
priv->task_table_config = e_calendar_table_config_new (
E_CALENDAR_TABLE (priv->task_table));
priv->memo_table_config = e_memo_table_config_new (
@@ -588,6 +472,11 @@ cal_shell_content_init (ECalShellContent *cal_shell_content)
cal_shell_content->priv =
E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content);
+ /* XXX GnomeCalendar is a widget, but we don't pack it.
+ * Maybe it should just be a GObject instead? */
+ cal_shell_content->priv->calendar = gnome_calendar_new ();
+ g_object_ref_sink (cal_shell_content->priv->calendar);
+
/* Postpone widget construction until we have a shell view. */
}
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 02b7af609e..1358a0615c 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -197,20 +197,22 @@ action_calendar_print_cb (GtkAction *action,
{
#if 0
ECalShellContent *cal_shell_content;
+ GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
+ ECalendarView *view;
GtkPrintOperationAction print_action;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ view_type = gnome_calendar_get_view (calendar);
+ view = gnome_calendar_get_calendar_view (calendar, view_type);
print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
- if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ if (E_IS_CAL_LIST_VIEW (view)) {
ECalListView *list_view;
- GtkWidget *widget;
ETable *table;
- widget = gnome_calendar_get_current_view_widget (calendar);
- list_view = E_CAL_LIST_VIEW (widget);
+ list_view = E_CAL_LIST_VIEW (view);
table = e_table_scrolled_get_table (list_view->table_scrolled);
print_table (table, _("Print"), _("Calendar"), action);
} else {
@@ -228,20 +230,22 @@ action_calendar_print_preview_cb (GtkAction *action,
{
#if 0
ECalShellContent *cal_shell_content;
+ GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
+ ECalendarView *view;
GtkPrintOperationAction print_action;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+ view_type = gnome_calendar_get_view (calendar);
+ view = gnome_calendar_get_calendar_view (calendar, view_type);
print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
- if (gnome_calendar_get_view (calendar) == GNOME_CAL_LIST_VIEW) {
+ if (E_IS_CAL_LIST_VIEW (view)) {
ECalListView *list_view;
- GtkWidget *widget;
ETable *table;
- widget = gnome_calendar_get_current_view_widget (calendar);
- list_view = E_CAL_LIST_VIEW (widget);
+ list_view = E_CAL_LIST_VIEW (view);
table = e_table_scrolled_get_table (list_view->table_scrolled);
print_table (table, _("Print"), _("Calendar"), action);
} else {
@@ -512,14 +516,16 @@ action_event_open_cb (GtkAction *action,
{
#if 0
ECalShellContent *cal_shell_content;
+ GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
- GtkWidget *widget;
+ ECalendarView *view;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- widget = gnome_calendar_get_current_view_widget (calendar);
+ view_type = gnome_calendar_get_view (calendar);
+ view = gnome_calendar_get_calendar_view (calendar, view_type);
- e_calendar_view_open_event (E_CALENDAR_VIEW (widget));
+ e_calendar_view_open_event (view);
#endif
}
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 5bf1c749a1..2c977e7553 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -59,12 +59,13 @@ cal_shell_view_update_actions (EShellView *shell_view)
ECalShellContent *cal_shell_content;
ECalShellSidebar *cal_shell_sidebar;
EShellWindow *shell_window;
+ GnomeCalendarViewType view_type;
GnomeCalendar *calendar;
+ ECalendarView *view;
ECalModel *model;
ESourceSelector *selector;
ESource *source;
GtkAction *action;
- GtkWidget *widget;
GList *list, *iter;
const gchar *uri = NULL;
gboolean user_created_source;
@@ -79,13 +80,14 @@ cal_shell_view_update_actions (EShellView *shell_view)
cal_shell_content = priv->cal_shell_content;
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- widget = gnome_calendar_get_current_view_widget (calendar);
- model = e_calendar_view_get_model (E_CALENDAR_VIEW (widget));
+ view_type = gnome_calendar_get_view (calendar);
+ view = gnome_calendar_get_calendar_view (calendar, view_type);
+ model = e_calendar_view_get_model (view);
cal_shell_sidebar = priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- list = e_calendar_view_get_selected_events (E_CALENDAR_VIEW (widget));
+ list = e_calendar_view_get_selected_events (view);
n_selected = g_list_length (list);
for (iter = list; iter != NULL; iter = iter->next) {