diff options
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.c | 10 | ||||
-rw-r--r-- | calendar/gui/e-cal-view.h | 1 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 10 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.h | 1 | ||||
-rw-r--r-- | calendar/gui/e-day-view-main-item.c | 4 | ||||
-rw-r--r-- | calendar/gui/e-day-view-top-item.c | 72 | ||||
-rw-r--r-- | calendar/gui/e-day-view-top-item.h | 3 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 12 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 5 |
10 files changed, 89 insertions, 39 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9de8a5fe06..7171623a22 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2003-11-04 Bolian Yin <bolian.yin@sun.com> + + * gui/e-cal-view.c: add new signal "selected_time_changed" + * gui/e-day-view-main-item.c (e_day_view_main_item_class_init): + a11y initialization + * gui/e-day-view-top-item (e_day_view_top_item_get_day_label): + new public function. + * gui/e-day-view.c (e_day_view_ensure_rows_visible, e_day_view_update_calendar_selection_time): make static functions public + (e_day_view_cursor_key_up, e_day_view_cursor_key_down, e_day_view_cursor_key_left, e_day_view_cursor_key_right): emit "selected_time_changed". + 2003-11-03 Ettore Perazzoli <ettore@ximian.com> * gui/e-meeting-model.c (SELECT_NAMES_OAFID): Append "_2". diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 7d2ef1c704..2e392560cd 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -94,6 +94,7 @@ enum props { /* Signal IDs */ enum { SELECTION_CHANGED, + SELECTED_TIME_CHANGED, TIMEZONE_CHANGED, EVENT_CHANGED, EVENT_ADDED, @@ -154,6 +155,7 @@ e_cal_view_class_init (ECalViewClass *klass) object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; + klass->selected_time_changed = NULL; klass->event_changed = NULL; klass->event_added = NULL; @@ -177,6 +179,14 @@ e_cal_view_class_init (ECalViewClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + e_cal_view_signals[SELECTED_TIME_CHANGED] = + g_signal_new ("selected_time_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECalViewClass, selected_time_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); e_cal_view_signals[TIMEZONE_CHANGED] = g_signal_new ("timezone_changed", G_TYPE_FROM_CLASS (klass), diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h index 0fd829a5f4..292871b709 100644 --- a/calendar/gui/e-cal-view.h +++ b/calendar/gui/e-cal-view.h @@ -76,6 +76,7 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); + void (* selected_time_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); void (* event_changed) (ECalView *day_view, ECalViewEvent *event); void (* event_added) (ECalView *day_view, ECalViewEvent *event); diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 7d2ef1c704..2e392560cd 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -94,6 +94,7 @@ enum props { /* Signal IDs */ enum { SELECTION_CHANGED, + SELECTED_TIME_CHANGED, TIMEZONE_CHANGED, EVENT_CHANGED, EVENT_ADDED, @@ -154,6 +155,7 @@ e_cal_view_class_init (ECalViewClass *klass) object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; + klass->selected_time_changed = NULL; klass->event_changed = NULL; klass->event_added = NULL; @@ -177,6 +179,14 @@ e_cal_view_class_init (ECalViewClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + e_cal_view_signals[SELECTED_TIME_CHANGED] = + g_signal_new ("selected_time_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECalViewClass, selected_time_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); e_cal_view_signals[TIMEZONE_CHANGED] = g_signal_new ("timezone_changed", G_TYPE_FROM_CLASS (klass), diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index 0fd829a5f4..292871b709 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -76,6 +76,7 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); + void (* selected_time_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); void (* event_changed) (ECalView *day_view, ECalViewEvent *event); void (* event_added) (ECalView *day_view, ECalViewEvent *event); diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index f5a1921dee..15d6141a5a 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -31,6 +31,7 @@ #include "e-util/e-categories-config.h" #include "e-day-view-layout.h" #include "e-day-view-main-item.h" +#include "ea-calendar.h" static void e_day_view_main_item_class_init (EDayViewMainItemClass *class); static void e_day_view_main_item_init (EDayViewMainItem *dvtitem); @@ -106,6 +107,9 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) item_class->draw = e_day_view_main_item_draw; item_class->point = e_day_view_main_item_point; item_class->event = e_day_view_main_item_event; + + /* init the accessibility support for e_day_view */ + e_day_view_main_item_a11y_init (); } diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 39fdc1df1c..5a49408566 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -165,12 +165,10 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, EDayView *day_view; GtkStyle *style; GdkGC *gc, *fg_gc, *bg_gc, *light_gc, *dark_gc; - gchar buffer[128], *format; + gchar buffer[128]; GdkRectangle clip_rect; gint canvas_width, canvas_height, left_edge, day, date_width, date_x; gint item_height, event_num; - struct tm day_start = { 0 }; - struct icaltimetype day_start_tt; PangoLayout *layout; #if 0 @@ -245,34 +243,8 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, /* Draw the date. Set a clipping rectangle so we don't draw over the next day. */ for (day = 0; day < day_view->days_shown; day++) { - day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, - e_cal_view_get_timezone (E_CAL_VIEW (day_view))); - day_start.tm_year = day_start_tt.year - 1900; - day_start.tm_mon = day_start_tt.month - 1; - day_start.tm_mday = day_start_tt.day; - day_start.tm_isdst = -1; - - day_start.tm_wday = time_day_of_week (day_start_tt.day, - day_start_tt.month - 1, - day_start_tt.year); - - if (day_view->date_format == E_DAY_VIEW_DATE_FULL) - /* strftime format %A = full weekday name, %d = day of month, - %B = full month name. Don't use any other specifiers. */ - format = _("%A %d %B"); - else if (day_view->date_format == E_DAY_VIEW_DATE_ABBREVIATED) - /* strftime format %a = abbreviated weekday name, %d = day of month, - %b = abbreviated month name. Don't use any other specifiers. */ - format = _("%a %d %b"); - else if (day_view->date_format == E_DAY_VIEW_DATE_NO_WEEKDAY) - /* strftime format %d = day of month, %b = abbreviated month name. - Don't use any other specifiers. */ - format = _("%d %b"); - else - format = "%d"; - - e_utf8_strftime (buffer, sizeof (buffer), format, &day_start); - + e_day_view_top_item_get_day_label (day_view, day, + buffer, sizeof (buffer)); clip_rect.x = day_view->day_offsets[day] - x; clip_rect.y = 2 - y; clip_rect.width = day_view->day_widths[day]; @@ -690,4 +662,40 @@ e_day_view_top_item_event (GnomeCanvasItem *item, GdkEvent *event) return FALSE; } - +void +e_day_view_top_item_get_day_label (EDayView *day_view, gint day, + gchar *buffer, gint buffer_len) +{ + struct icaltimetype day_start_tt; + struct tm day_start = { 0 }; + gchar *format; + + day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], + FALSE, + e_cal_view_get_timezone (E_CAL_VIEW (day_view))); + day_start.tm_year = day_start_tt.year - 1900; + day_start.tm_mon = day_start_tt.month - 1; + day_start.tm_mday = day_start_tt.day; + day_start.tm_isdst = -1; + + day_start.tm_wday = time_day_of_week (day_start_tt.day, + day_start_tt.month - 1, + day_start_tt.year); + + if (day_view->date_format == E_DAY_VIEW_DATE_FULL) + /* strftime format %A = full weekday name, %d = day of month, + %B = full month name. Don't use any other specifiers. */ + format = _("%A %d %B"); + else if (day_view->date_format == E_DAY_VIEW_DATE_ABBREVIATED) + /* strftime format %a = abbreviated weekday name, %d = day of month, + %b = abbreviated month name. Don't use any other specifiers. */ + format = _("%a %d %b"); + else if (day_view->date_format == E_DAY_VIEW_DATE_NO_WEEKDAY) + /* strftime format %d = day of month, %b = abbreviated month name. + Don't use any other specifiers. */ + format = _("%d %b"); + else + format = "%d"; + + e_utf8_strftime (buffer, buffer_len, format, &day_start); +} diff --git a/calendar/gui/e-day-view-top-item.h b/calendar/gui/e-day-view-top-item.h index daeb37aca7..9b8342af99 100644 --- a/calendar/gui/e-day-view-top-item.h +++ b/calendar/gui/e-day-view-top-item.h @@ -55,7 +55,8 @@ typedef struct { GtkType e_day_view_top_item_get_type (void); - +void e_day_view_top_item_get_day_label (EDayView *day_view, gint day, + gchar *buffer, gint buffer_len); #ifdef __cplusplus diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index d6678487c7..bfdb788327 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -184,9 +184,6 @@ static void e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event); static void e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event); -static void e_day_view_ensure_rows_visible (EDayView *day_view, - gint start_row, - gint end_row); static void e_day_view_scroll (EDayView *day_view, gfloat pages_to_scroll); @@ -219,7 +216,6 @@ static gboolean e_day_view_on_time_canvas_scroll (GtkWidget *widget, GdkEventScroll *scroll, EDayView *day_view); -static void e_day_view_update_calendar_selection_time (EDayView *day_view); static gboolean e_day_view_on_main_canvas_motion (GtkWidget *widget, GdkEventMotion *event, EDayView *day_view); @@ -3295,7 +3291,7 @@ e_day_view_on_main_canvas_button_release (GtkWidget *widget, } -static void +void e_day_view_update_calendar_selection_time (EDayView *day_view) { time_t start, end; @@ -5228,6 +5224,7 @@ e_day_view_cursor_key_up (EDayView *day_view, GdkEventKey *event) day_view->selection_start_row, day_view->selection_end_row); + g_signal_emit_by_name (day_view, "selected_time_changed"); e_day_view_update_calendar_selection_time (day_view); /* FIXME: Optimise? */ @@ -5260,6 +5257,7 @@ e_day_view_cursor_key_down (EDayView *day_view, GdkEventKey *event) day_view->selection_start_row, day_view->selection_end_row); + g_signal_emit_by_name (day_view, "selected_time_changed"); e_day_view_update_calendar_selection_time (day_view); /* FIXME: Optimise? */ @@ -5283,6 +5281,7 @@ e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event) gtk_widget_queue_draw (day_view->top_canvas); gtk_widget_queue_draw (day_view->main_canvas); } + g_signal_emit_by_name (day_view, "selected_time_changed"); } @@ -5301,6 +5300,7 @@ e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event) gtk_widget_queue_draw (day_view->top_canvas); gtk_widget_queue_draw (day_view->main_canvas); } + g_signal_emit_by_name (day_view, "selected_time_changed"); } @@ -5348,7 +5348,7 @@ e_day_view_check_if_new_event_fits (EDayView *day_view) } -static void +void e_day_view_ensure_rows_visible (EDayView *day_view, gint start_row, gint end_row) diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index e6f485e8b1..cb691f5762 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -577,6 +577,11 @@ gboolean e_day_view_find_event_from_item (EDayView *day_view, GnomeCanvasItem *item, gint *day_return, gint *event_num_return); +void e_day_view_update_calendar_selection_time (EDayView *day_view); +void e_day_view_ensure_rows_visible (EDayView *day_view, + gint start_row, + gint end_row); + #ifdef __cplusplus } |