aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view-top-item.c
diff options
context:
space:
mode:
authorBolian Yin <bolian.yin@sun.com>2003-11-04 14:39:32 +0800
committerBolian Yin <byin@src.gnome.org>2003-11-04 14:39:32 +0800
commit1ec2cf1777ae358c0bdf32e0ea8d0db04fb01bf6 (patch)
tree6908b7064ac04f7a320db272b15bda2cc2e25aae /calendar/gui/e-day-view-top-item.c
parent9b809ae73a935ea2405ce2af6987e3ae0db828a4 (diff)
downloadgsoc2013-evolution-1ec2cf1777ae358c0bdf32e0ea8d0db04fb01bf6.tar.gz
gsoc2013-evolution-1ec2cf1777ae358c0bdf32e0ea8d0db04fb01bf6.tar.zst
gsoc2013-evolution-1ec2cf1777ae358c0bdf32e0ea8d0db04fb01bf6.zip
add new signal "selected_time_changed" a11y initialization new public
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". svn path=/trunk/; revision=23179
Diffstat (limited to 'calendar/gui/e-day-view-top-item.c')
-rw-r--r--calendar/gui/e-day-view-top-item.c72
1 files changed, 40 insertions, 32 deletions
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);
+}