diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-11 02:11:48 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-11 02:11:48 +0800 |
commit | 31fd01398cc76d3c00abbc05d419dfe873bc04c6 (patch) | |
tree | 35c238cdb2a8a68936fa659e5269e75ee0042b49 /calendar/gui/e-week-view-main-item.c | |
parent | f9049cded460a9e316fa83ff1941970abfe0fd09 (diff) | |
parent | 10fef4ac0f4ef7dc907e8bfae9844d4e8be3d80d (diff) | |
download | gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.gz gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.bz2 gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.lz gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.xz gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.tar.zst gsoc2013-evolution-31fd01398cc76d3c00abbc05d419dfe873bc04c6.zip |
Merge branch 'master' into kill-bonobo
Conflicts:
addressbook/util/addressbook.h
calendar/gui/e-week-view-main-item.c
configure.ac
e-util/Makefile.am
mail/em-account-editor.c
mail/em-folder-selection-button.c
shell/e-shell.c
Diffstat (limited to 'calendar/gui/e-week-view-main-item.c')
-rw-r--r-- | calendar/gui/e-week-view-main-item.c | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index bfc95ebe2e..3ea3e2e63b 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -29,7 +29,8 @@ #include <glib.h> #include <glib/gi18n.h> #include "e-week-view-main-item.h" -/*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */ +/*#include "ea-calendar.h"*/ /* KILL-BONOBO */ +#include "calendar-config.h" static void e_week_view_main_item_set_property (GObject *object, guint property_id, @@ -191,6 +192,23 @@ e_week_view_main_item_draw (GnomeCanvasItem *canvas_item, } } +static gint +gdate_to_cal_weekdays (GDateWeekday wd) +{ + switch (wd) { + case G_DATE_MONDAY: return CAL_MONDAY; + case G_DATE_TUESDAY: return CAL_TUESDAY; + case G_DATE_WEDNESDAY: return CAL_WEDNESDAY; + case G_DATE_THURSDAY: return CAL_THURSDAY; + case G_DATE_FRIDAY: return CAL_FRIDAY; + case G_DATE_SATURDAY: return CAL_SATURDAY; + case G_DATE_SUNDAY: return CAL_SUNDAY; + default: break; + } + + return 0; +} + static void e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, gint day, @@ -207,7 +225,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, gint right_edge, bottom_edge, date_width, date_x, line_y; gboolean show_day_name, show_month_name, selected; gchar buffer[128], *format_string; - gint month, day_of_month, max_width; + gint day_of_week, month, day_of_month, max_width; GdkColor *bg_color; PangoFontDescription *font_desc; PangoContext *pango_context; @@ -215,6 +233,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, PangoLayout *layout; gboolean today = FALSE; cairo_t *cr; + CalWeekdays working_days; #if 0 g_print ("Drawing Day:%i at %i,%i\n", day, x, y); @@ -232,6 +251,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, g_return_if_fail (gc != NULL); + day_of_week = gdate_to_cal_weekdays (g_date_get_weekday (date)); month = g_date_get_month (date); day_of_month = g_date_get_day (date); line_y = y + E_WEEK_VIEW_DATE_T_PAD + @@ -239,12 +259,29 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) + E_WEEK_VIEW_DATE_LINE_T_PAD; + if (!today) { + struct icaltimetype tt; + + /* Check if we are drawing today */ + tt = icaltime_from_timet_with_zone (time (NULL), FALSE, + e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); + today = g_date_get_year (date) == tt.year + && g_date_get_month (date) == tt.month + && g_date_get_day (date) == tt.day; + } + + working_days = calendar_config_get_working_days (); + /* Draw the background of the day. In the month view odd months are one color and even months another, so you can easily see when each month starts (defaults are white for odd - January, March, ... and light gray for even). In the week view the background is always the same color, the color used for the odd months in the month view. */ - if (week_view->multi_week_view && (month % 2 == 0)) + if (today) + bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_TODAY_BACKGROUND]; + else if ((working_days & day_of_week) == 0) + bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY]; + else if (week_view->multi_week_view && (month % 2 == 0)) bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS]; else bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS]; @@ -355,21 +392,11 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, if (selected) { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED]); } else if (week_view->multi_week_view) { - struct icaltimetype tt; - - /* Check if we are drawing today */ - tt = icaltime_from_timet_with_zone (time (NULL), FALSE, - e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); - if (g_date_get_year (date) == tt.year - && g_date_get_month (date) == tt.month - && g_date_get_day (date) == tt.day) { + if (today) { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_TODAY]); - today = TRUE; - } - else { + } else { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES]); - - } + } } else { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES]); } |