diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-24 13:38:43 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-24 23:02:51 +0800 |
commit | 7fc5566885801798839c94288fdff2d3c3ffe0d2 (patch) | |
tree | f727ad4bab362ea04fa41c4fed031cc73db166d4 /calendar | |
parent | 4c43a88975bfb4cbab2eb10c9e2de31acedf0a61 (diff) | |
download | gsoc2013-evolution-7fc5566885801798839c94288fdff2d3c3ffe0d2.tar.gz gsoc2013-evolution-7fc5566885801798839c94288fdff2d3c3ffe0d2.tar.zst gsoc2013-evolution-7fc5566885801798839c94288fdff2d3c3ffe0d2.zip |
Add EMonthView, a simple subclass of EWeekView.
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/Makefile.am | 10 | ||||
-rw-r--r-- | calendar/gui/e-month-view.c | 211 | ||||
-rw-r--r-- | calendar/gui/e-month-view.h | 66 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 300 | ||||
-rw-r--r-- | calendar/gui/e-week-view.h | 156 |
5 files changed, 462 insertions, 281 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index e460d3d5ff..0cf9c99aa8 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -54,10 +54,10 @@ noinst_LTLIBRARIES = libcal-gui.la libcal_gui_la_SOURCES = \ e-attachment-handler-calendar.c \ e-attachment-handler-calendar.h \ - e-calendar-view.c \ - e-calendar-view.h \ - e-calendar-table.c \ - e-calendar-table.h \ + e-calendar-view.c \ + e-calendar-view.h \ + e-calendar-table.c \ + e-calendar-table.h \ calendar-config.c \ calendar-config.h \ calendar-config-keys.h \ @@ -141,6 +141,8 @@ libcal_gui_la_SOURCES = \ e-memo-table-config.h \ e-mini-calendar-config.c \ e-mini-calendar-config.h \ + e-month-view.c \ + e-month-view.h \ e-select-names-editable.c \ e-select-names-editable.h \ e-select-names-renderer.c \ diff --git a/calendar/gui/e-month-view.c b/calendar/gui/e-month-view.c new file mode 100644 index 0000000000..6f00e1d233 --- /dev/null +++ b/calendar/gui/e-month-view.c @@ -0,0 +1,211 @@ +/* + * e-month-view.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-month-view.h" + +#define E_MONTH_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MONTH_VIEW, EMonthViewPrivate)) + +struct _EMonthViewPrivate { + gint placeholder; +}; + +static gpointer parent_class; + +static void +month_view_cursor_key_up (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + if (week_view->selection_start_day < 7) { + /* No easy way to calculate new selection_start_day, so + * calculate a time_t value and set_selected_time_range. */ + time_t current; + + if (e_calendar_view_get_selected_time_range ( + E_CALENDAR_VIEW (week_view), ¤t, NULL)) { + + current = time_add_week (current, -1); + e_week_view_scroll_a_step ( + week_view, E_CAL_VIEW_MOVE_PAGE_UP); + e_week_view_set_selected_time_range_visible ( + week_view, current, current); + } + } else { + week_view->selection_start_day -= 7; + week_view->selection_end_day = week_view->selection_start_day; + } + + g_signal_emit_by_name (week_view, "selected-time-changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +month_view_cursor_key_down (EWeekView *week_view) +{ + gint weeks_shown; + + if (week_view->selection_start_day == -1) + return; + + weeks_shown = e_week_view_get_weeks_shown (week_view); + + if (week_view->selection_start_day >= (weeks_shown - 1) * 7) { + /* No easy way to calculate new selection_start_day, so + * calculate a time_t value and set_selected_time_range. */ + time_t current; + + if (e_calendar_view_get_selected_time_range ( + E_CALENDAR_VIEW (week_view), ¤t, NULL)) { + + current = time_add_week (current, -1); + e_week_view_scroll_a_step ( + week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); + e_week_view_set_selected_time_range_visible ( + week_view, current, current); + } + } else { + week_view->selection_start_day += 7; + week_view->selection_end_day = week_view->selection_start_day; + } + + g_signal_emit_by_name (week_view, "selected-time-changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +month_view_cursor_key_left (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + if (week_view->selection_start_day == 0) { + /* No easy way to calculate new selection_start_day, so + * calculate a time_t value and set_selected_time_range. */ + time_t current; + + if (e_calendar_view_get_selected_time_range ( + E_CALENDAR_VIEW (week_view), ¤t, NULL)) { + + current = time_add_day (current, -1); + e_week_view_scroll_a_step ( + week_view, E_CAL_VIEW_MOVE_PAGE_UP); + e_week_view_set_selected_time_range_visible ( + week_view, current, current); + } + } else { + week_view->selection_start_day--; + week_view->selection_end_day = week_view->selection_start_day; + } + + g_signal_emit_by_name (week_view, "selected-time-changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +month_view_cursor_key_right (EWeekView *week_view) +{ + gint weeks_shown; + + if (week_view->selection_start_day == -1) + return; + + weeks_shown = e_week_view_get_weeks_shown (week_view); + + if (week_view->selection_start_day == weeks_shown * 7 - 1) { + /* No easy way to calculate new selection_start_day, so + * calculate a time_t value and set_selected_time_range. */ + time_t current; + + if (e_calendar_view_get_selected_time_range ( + E_CALENDAR_VIEW (week_view), ¤t, NULL)) { + + current = time_add_day (current, 1); + e_week_view_scroll_a_step ( + week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); + e_week_view_set_selected_time_range_visible ( + week_view, current, current); + } + } else { + week_view->selection_start_day++; + week_view->selection_end_day = week_view->selection_start_day; + } + + g_signal_emit_by_name (week_view, "selected-time-changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +month_view_class_init (EMonthViewClass *class) +{ + EWeekViewClass *week_view_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMonthViewPrivate)); + + week_view_class = E_WEEK_VIEW_CLASS (class); + week_view_class->cursor_key_up = month_view_cursor_key_up; + week_view_class->cursor_key_down = month_view_cursor_key_down; + week_view_class->cursor_key_left = month_view_cursor_key_left; + week_view_class->cursor_key_right = month_view_cursor_key_right; +} + +static void +month_view_init (EMonthView *month_view) +{ + month_view->priv = E_MONTH_VIEW_GET_PRIVATE (month_view); +} + +GType +e_month_view_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + const GTypeInfo type_info = { + sizeof (EMonthViewClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) month_view_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMonthView), + 0, /* n_preallocs */ + (GInstanceInitFunc) month_view_init, + NULL /* value_table */ + }; + + type = g_type_register_static ( + E_TYPE_WEEK_VIEW, "EMonthView", &type_info, 0); + } + + return type; +} + +GtkWidget * +e_month_view_new (ECalModel *model) +{ + g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL); + + return g_object_new (E_TYPE_MONTH_VIEW, "model", model, NULL); +} diff --git a/calendar/gui/e-month-view.h b/calendar/gui/e-month-view.h new file mode 100644 index 0000000000..c68346b3e2 --- /dev/null +++ b/calendar/gui/e-month-view.h @@ -0,0 +1,66 @@ +/* + * e-month-view.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MONTH_VIEW_H +#define E_MONTH_VIEW_H + +#include "e-week-view.h" + +/* Standard GObject macros */ +#define E_TYPE_MONTH_VIEW \ + (e_month_view_get_type ()) +#define E_MONTH_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MONTH_VIEW, EMonthView)) +#define E_MONTH_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((obj), E_TYPE_MONTH_VIEW, EMonthViewClass)) +#define E_IS_MONTH_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MONTH_VIEW)) +#define E_IS_MONTH_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MONTH_VIEW)) +#define E_MONTH_VIEW_GET_CLASS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MONTH_VIEW, EMonthViewClass)) + +G_BEGIN_DECLS + +typedef struct _EMonthView EMonthView; +typedef struct _EMonthViewClass EMonthViewClass; +typedef struct _EMonthViewPrivate EMonthViewPrivate; + +struct _EMonthView { + EWeekView parent; + EMonthViewPrivate *priv; +}; + +struct _EMonthViewClass { + EWeekViewClass parent_class; +}; + +GType e_month_view_get_type (void); +GtkWidget * e_month_view_new (ECalModel *model); + +G_END_DECLS + +#endif /* E_MONTH_VIEW_H */ diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index dbdb42c6a6..bfa2ad780f 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -168,7 +168,6 @@ static gboolean e_week_view_on_text_item_event (GnomeCanvasItem *item, EWeekView *week_view); static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction); static gint e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time); -static void e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction); static void e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt, gboolean is_all_day); static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item, GdkEvent *event, @@ -194,6 +193,69 @@ static gboolean e_week_view_layout_timeout_cb (gpointer data); G_DEFINE_TYPE (EWeekView, e_week_view, E_TYPE_CALENDAR_VIEW) +static gint map_left[] = {0, 1, 2, 0, 1, 2, 2}; +static gint map_right[] = {3, 4, 5, 3, 4, 5, 6}; + +static void +week_view_cursor_key_up (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + week_view->selection_start_day--; + + if (week_view->selection_start_day < 0) { + e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_UP); + week_view->selection_start_day = 6; + } + + week_view->selection_end_day = week_view->selection_start_day; + g_signal_emit_by_name (week_view, "selected_time_changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +week_view_cursor_key_down (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + week_view->selection_start_day++; + + if (week_view->selection_start_day > 6) { + e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_DOWN); + week_view->selection_start_day = 0; + } + + week_view->selection_end_day = week_view->selection_start_day; + g_signal_emit_by_name (week_view, "selected_time_changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +week_view_cursor_key_left (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + week_view->selection_start_day = map_left[week_view->selection_start_day]; + week_view->selection_end_day = week_view->selection_start_day; + g_signal_emit_by_name (week_view, "selected_time_changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + +static void +week_view_cursor_key_right (EWeekView *week_view) +{ + if (week_view->selection_start_day == -1) + return; + + week_view->selection_start_day = map_right[week_view->selection_start_day]; + week_view->selection_end_day = week_view->selection_start_day; + g_signal_emit_by_name (week_view, "selected_time_changed"); + gtk_widget_queue_draw (week_view->main_canvas); +} + static void e_week_view_class_init (EWeekViewClass *class) { @@ -225,6 +287,11 @@ e_week_view_class_init (EWeekViewClass *class) view_class->get_visible_time_range = e_week_view_get_visible_time_range; view_class->paste_text = e_week_view_paste_text; + class->cursor_key_up = week_view_cursor_key_up; + class->cursor_key_down = week_view_cursor_key_down; + class->cursor_key_left = week_view_cursor_key_left; + class->cursor_key_right = week_view_cursor_key_right; + #if 0 /* KILL-BONOBO */ /* init the accessibility support for e_week_view */ e_week_view_a11y_init (); @@ -3395,7 +3462,7 @@ e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time) return (event_time - first_day) / (24 * 60 * 60); } -static void +void e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction) { GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment; @@ -3787,227 +3854,48 @@ e_week_view_is_one_day_event (EWeekView *week_view, return FALSE; } -static gint map_left[] = {0, 1, 2, 0, 1, 2, 2}; -static gint map_right[] = {3, 4, 5, 3, 4, 5, 6}; - static void -e_week_view_do_cursor_key_up (EWeekView *week_view) +e_week_view_cursor_key_up (EWeekView *week_view) { - if (week_view->selection_start_day == -1) - return; + EWeekViewClass *week_view_class; - week_view->selection_start_day--; + week_view_class = E_WEEK_VIEW_GET_CLASS (week_view); + g_return_if_fail (week_view_class->cursor_key_up != NULL); - if (week_view->selection_start_day < 0) { - e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_UP); - week_view->selection_start_day = 6; - } - - week_view->selection_end_day = week_view->selection_start_day; - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); + week_view_class->cursor_key_up (week_view); } static void -e_week_view_do_cursor_key_down (EWeekView *week_view) +e_week_view_cursor_key_down (EWeekView *week_view) { - if (week_view->selection_start_day == -1) - return; + EWeekViewClass *week_view_class; - week_view->selection_start_day++; + week_view_class = E_WEEK_VIEW_GET_CLASS (week_view); + g_return_if_fail (week_view_class->cursor_key_down != NULL); - if (week_view->selection_start_day > 6) { - e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_DOWN); - week_view->selection_start_day = 0; - } - - week_view->selection_end_day = week_view->selection_start_day; - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); + week_view_class->cursor_key_down (week_view); } static void -e_week_view_do_cursor_key_left (EWeekView *week_view) +e_week_view_cursor_key_left (EWeekView *week_view) { - if (week_view->selection_start_day == -1) - return; + EWeekViewClass *week_view_class; - week_view->selection_start_day = map_left[week_view->selection_start_day]; - week_view->selection_end_day = week_view->selection_start_day; - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); -} + week_view_class = E_WEEK_VIEW_GET_CLASS (week_view); + g_return_if_fail (week_view_class->cursor_key_left != NULL); -static void -e_week_view_do_cursor_key_right (EWeekView *week_view) -{ - if (week_view->selection_start_day == -1) - return; - - week_view->selection_start_day = map_right[week_view->selection_start_day]; - week_view->selection_end_day = week_view->selection_start_day; - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); + week_view_class->cursor_key_left (week_view); } static void -e_month_view_do_cursor_key_up (EWeekView *week_view) +e_week_view_cursor_key_right (EWeekView *week_view) { - if (week_view->selection_start_day == -1) - return; - - if (week_view->selection_start_day < 7) { - /* no easy way to calculate new selection_start_day, therefore - * calculate a time_t value and set_selected_time_range */ - time_t current; - if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { - current = time_add_week(current,-1); - e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP); - e_week_view_set_selected_time_range_visible(week_view,current,current); - } - } else { - week_view->selection_start_day -= 7; - week_view->selection_end_day = week_view->selection_start_day; - } - - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); -} + EWeekViewClass *week_view_class; -static void -e_month_view_do_cursor_key_down (EWeekView *week_view) -{ - gint weeks_shown = e_week_view_get_weeks_shown (week_view); + week_view_class = E_WEEK_VIEW_GET_CLASS (week_view); + g_return_if_fail (week_view_class->cursor_key_right != NULL); - if (week_view->selection_start_day == -1) - return; - - if (week_view->selection_start_day >= (weeks_shown - 1) * 7) { - /* no easy way to calculate new selection_start_day, therefore - * calculate a time_t value and set_selected_time_range */ - time_t current; - if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { - current = time_add_week(current,1); - e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); - e_week_view_set_selected_time_range_visible(week_view,current,current); - } - } else { - week_view->selection_start_day += 7; - week_view->selection_end_day = week_view->selection_start_day; - } - - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); -} - -static void -e_month_view_do_cursor_key_left (EWeekView *week_view) -{ - if (week_view->selection_start_day == -1) - return; - - if (week_view->selection_start_day == 0) { - /* no easy way to calculate new selection_start_day, therefore - * calculate a time_t value and set_selected_time_range */ - time_t current; - if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { - current = time_add_day(current,-1); - e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP); - e_week_view_set_selected_time_range_visible(week_view,current,current); - } - } else { - week_view->selection_start_day--; - week_view->selection_end_day = week_view->selection_start_day; - } - - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); -} - -static void -e_month_view_do_cursor_key_right (EWeekView *week_view) -{ - gint weeks_shown = e_week_view_get_weeks_shown (week_view); - - if (week_view->selection_start_day == -1) - return; - - if (week_view->selection_start_day == weeks_shown * 7 - 1) { - /* no easy way to calculate new selection_start_day, therefore - * calculate a time_t value and set_selected_time_range */ - time_t current; - if (e_calendar_view_get_selected_time_range(&week_view->cal_view, ¤t, NULL)) { - current = time_add_day(current,1); - e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); - e_week_view_set_selected_time_range_visible(week_view,current,current); - } - } else { - week_view->selection_start_day++; - week_view->selection_end_day = week_view->selection_start_day; - } - - g_signal_emit_by_name (week_view, "selected_time_changed"); - gtk_widget_queue_draw (week_view->main_canvas); -} - -static void -e_week_view_cursor_key_up (EWeekView *week_view, GnomeCalendarViewType view_type) -{ - switch (view_type) { - case GNOME_CAL_WEEK_VIEW: - e_week_view_do_cursor_key_up (week_view); - break; - case GNOME_CAL_MONTH_VIEW: - e_month_view_do_cursor_key_up (week_view); - break; - default: - g_return_if_reached (); - } -} - -static void -e_week_view_cursor_key_down (EWeekView *week_view, GnomeCalendarViewType view_type) -{ - switch (view_type) { - case GNOME_CAL_WEEK_VIEW: - e_week_view_do_cursor_key_down (week_view); - break; - case GNOME_CAL_MONTH_VIEW: - e_month_view_do_cursor_key_down (week_view); - break; - default: - g_return_if_reached (); - } -} - -static void -e_week_view_cursor_key_left (EWeekView *week_view, GnomeCalendarViewType view_type) -{ - switch (view_type) { - case GNOME_CAL_WEEK_VIEW: - e_week_view_do_cursor_key_left (week_view); - break; - case GNOME_CAL_MONTH_VIEW: - e_month_view_do_cursor_key_left (week_view); - break; - default: - g_return_if_reached (); - } -} - -static void -e_week_view_cursor_key_right (EWeekView *week_view, GnomeCalendarViewType view_type) -{ - switch (view_type) { - case GNOME_CAL_WEEK_VIEW: - e_week_view_do_cursor_key_right (week_view); - break; - case GNOME_CAL_MONTH_VIEW: - e_month_view_do_cursor_key_right (week_view); - break; - default: - g_return_if_reached (); - } + week_view_class->cursor_key_right (week_view); } static gboolean @@ -4110,7 +3998,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) guint keyval; gboolean stop_emission; gboolean ret_val; - GnomeCalendarViewType view_type; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE); @@ -4130,7 +4017,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) #endif /* Handle the cursor keys for moving the selection */ - view_type = gnome_calendar_get_view (e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view))); stop_emission = FALSE; if (!(event->state & GDK_SHIFT_MASK) && !(event->state & GDK_MOD1_MASK)) { @@ -4149,16 +4035,16 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_PAGE_DOWN); break; case GDK_Up: - e_week_view_cursor_key_up (week_view, view_type); + e_week_view_cursor_key_up (week_view); break; case GDK_Down: - e_week_view_cursor_key_down (week_view, view_type); + e_week_view_cursor_key_down (week_view); break; case GDK_Left: - e_week_view_cursor_key_left (week_view, view_type); + e_week_view_cursor_key_left (week_view); break; case GDK_Right: - e_week_view_cursor_key_right (week_view, view_type); + e_week_view_cursor_key_right (week_view); break; default: stop_emission = FALSE; diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index b3a9ca7be5..10b4c27f49 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -48,7 +48,7 @@ #define E_IS_WEEK_VIEW_CLASS(cls) \ (G_TYPE_CHECK_CLASS_TYPE \ ((cls), E_TYPE_WEEK_VIEW)) -#define E_IS_WEEK_VIEW_GET_CLASS(obj) \ +#define E_WEEK_VIEW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS \ ((obj), E_TYPE_WEEK_VIEW, EWeekViewClass)) @@ -358,106 +358,122 @@ struct _EWeekView { struct _EWeekViewClass { ECalendarViewClass parent_class; + + void (*cursor_key_up) (EWeekView *week_view); + void (*cursor_key_down) (EWeekView *week_view); + void (*cursor_key_left) (EWeekView *week_view); + void (*cursor_key_right) (EWeekView *week_view); }; -GType e_week_view_get_type (void); -GtkWidget* e_week_view_new (ECalModel *model); +GType e_week_view_get_type (void); +GtkWidget * e_week_view_new (ECalModel *model); /* The first day shown. Note that it will be rounded down to the start of a week when set. The returned value will be invalid if no date has been set yet. */ -void e_week_view_get_first_day_shown (EWeekView *week_view, - GDate *date); -void e_week_view_set_first_day_shown (EWeekView *week_view, - GDate *date); +void e_week_view_get_first_day_shown (EWeekView *week_view, + GDate *date); +void e_week_view_set_first_day_shown (EWeekView *week_view, + GDate *date); /* The selected time range. The EWeekView will show the corresponding month and the days between start_time and end_time will be selected. To select a single day, use the same value for start_time & end_time. */ -void e_week_view_set_selected_time_range_visible (EWeekView *week_view, - time_t start_time, - time_t end_time); +void e_week_view_set_selected_time_range_visible + (EWeekView *week_view, + time_t start_time, + time_t end_time); /* Whether to display 1 week or 1 month (5 weeks). It defaults to 1 week. */ -gboolean e_week_view_get_multi_week_view (EWeekView *week_view); -void e_week_view_set_multi_week_view (EWeekView *week_view, - gboolean multi_week_view); +gboolean e_week_view_get_multi_week_view (EWeekView *week_view); +void e_week_view_set_multi_week_view (EWeekView *week_view, + gboolean multi_week_view); /* Whether to update the base date when the time range changes */ -gboolean e_week_view_get_update_base_date (EWeekView *week_view); -void e_week_view_set_update_base_date (EWeekView *week_view, gboolean update_base_date); +gboolean e_week_view_get_update_base_date(EWeekView *week_view); +void e_week_view_set_update_base_date(EWeekView *week_view, + gboolean update_base_date); /* The number of weeks shown in the multi-week view. */ -gint e_week_view_get_weeks_shown (EWeekView *week_view); -void e_week_view_set_weeks_shown (EWeekView *week_view, - gint weeks_shown); +gint e_week_view_get_weeks_shown (EWeekView *week_view); +void e_week_view_set_weeks_shown (EWeekView *week_view, + gint weeks_shown); /* Whether the weekend (Sat/Sun) should be compressed into 1 cell in the Month view. In the Week view they are always compressed. */ -gboolean e_week_view_get_compress_weekend (EWeekView *week_view); -void e_week_view_set_compress_weekend (EWeekView *week_view, - gboolean compress); +gboolean e_week_view_get_compress_weekend(EWeekView *week_view); +void e_week_view_set_compress_weekend(EWeekView *week_view, + gboolean compress); /* Whether we display event end times. */ -gboolean e_week_view_get_show_event_end_times (EWeekView *week_view); -void e_week_view_set_show_event_end_times (EWeekView *week_view, - gboolean show); +gboolean e_week_view_get_show_event_end_times + (EWeekView *week_view); +void e_week_view_set_show_event_end_times + (EWeekView *week_view, + gboolean show); /* The first day of the week, 0 (Monday) to 6 (Sunday). */ -gint e_week_view_get_week_start_day (EWeekView *week_view); -void e_week_view_set_week_start_day (EWeekView *week_view, - gint week_start_day); +gint e_week_view_get_week_start_day (EWeekView *week_view); +void e_week_view_set_week_start_day (EWeekView *week_view, + gint week_start_day); -void e_week_view_delete_occurrence (EWeekView *week_view); +void e_week_view_delete_occurrence (EWeekView *week_view); /* Returns the number of selected events (0 or 1 at present). */ -gint e_week_view_get_num_events_selected (EWeekView *week_view); +gint e_week_view_get_num_events_selected + (EWeekView *week_view); /* * Internal functions called by the associated canvas items. */ -void e_week_view_get_day_position (EWeekView *week_view, - gint day, - gint *day_x, - gint *day_y, - gint *day_w, - gint *day_h); -gboolean e_week_view_get_span_position (EWeekView *week_view, - gint event_num, - gint span_num, - gint *span_x, - gint *span_y, - gint *span_w); -gboolean e_week_view_is_one_day_event (EWeekView *week_view, - gint event_num); -gboolean e_week_view_start_editing_event (EWeekView *week_view, - gint event_num, - gint span_num, - gchar *initial_text); -void e_week_view_stop_editing_event (EWeekView *week_view); - -void e_week_view_show_popup_menu (EWeekView *week_view, +void e_week_view_get_day_position (EWeekView *week_view, + gint day, + gint *day_x, + gint *day_y, + gint *day_w, + gint *day_h); +gboolean e_week_view_get_span_position (EWeekView *week_view, + gint event_num, + gint span_num, + gint *span_x, + gint *span_y, + gint *span_w); +gboolean e_week_view_is_one_day_event (EWeekView *week_view, + gint event_num); +gboolean e_week_view_start_editing_event (EWeekView *week_view, + gint event_num, + gint span_num, + gchar *initial_text); +void e_week_view_stop_editing_event (EWeekView *week_view); + +void e_week_view_show_popup_menu (EWeekView *week_view, GdkEventButton *event, - gint event_num); - -void e_week_view_convert_time_to_display (EWeekView *week_view, - gint hour, - gint *display_hour, - const gchar **suffix, - gint *suffix_width); -gint e_week_view_get_time_string_width (EWeekView *week_view); - -gint e_week_view_event_sort_func (const void *arg1, - const void *arg2); - -gboolean e_week_view_find_event_from_item (EWeekView *week_view, - GnomeCanvasItem *item, - gint *event_num_return, - gint *span_num_return); - -gboolean e_week_view_is_jump_button_visible (EWeekView *week_view, - gint day); -void e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item); + gint event_num); + +void e_week_view_convert_time_to_display + (EWeekView *week_view, + gint hour, + gint *display_hour, + const gchar **suffix, + gint *suffix_width); +gint e_week_view_get_time_string_width + (EWeekView *week_view); + +gint e_week_view_event_sort_func (gconstpointer arg1, + gconstpointer arg2); + +gboolean e_week_view_find_event_from_item (EWeekView *week_view, + GnomeCanvasItem *item, + gint *event_num_return, + gint *span_num_return); + +gboolean e_week_view_is_jump_button_visible + (EWeekView *week_view, + gint day); +void e_week_view_jump_to_button_item (EWeekView *week_view, + GnomeCanvasItem *item); +void e_week_view_scroll_a_step (EWeekView *week_view, + ECalViewMoveDirection direction); G_END_DECLS |