diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-26 03:26:03 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-26 03:26:03 +0800 |
commit | ad465a7c1fbea59767741ae5e56a94b5f5f7c6a1 (patch) | |
tree | 94dcd12b95734f19931042ef8129f105a7cca9af /modules/calendar | |
parent | a1e1732de6b64e68c6a30bd097485c00e36a8bec (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-cal-shell-content.c | 187 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-view-actions.c | 28 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-view.c | 10 |
3 files changed, 61 insertions, 164 deletions
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) { |