aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-06-30 20:54:43 +0800
committerMilan Crha <mcrha@redhat.com>2009-06-30 20:56:56 +0800
commit2d0ca7939abde5a7cfe1dcbb974e52939637e5a9 (patch)
tree423eb142537e159705feefed4afaed7691ac3672
parent619c1cf37efc97be4bad9b028b3e8fbb080aefd4 (diff)
downloadgsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar.gz
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar.bz2
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar.lz
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar.xz
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.tar.zst
gsoc2013-evolution-2d0ca7939abde5a7cfe1dcbb974e52939637e5a9.zip
Bug #245723 - Show days with transparent events in italic
-rw-r--r--calendar/gui/tag-calendar.c14
-rw-r--r--widgets/misc/e-calendar-item.c38
-rw-r--r--widgets/misc/e-calendar-item.h10
-rw-r--r--widgets/misc/test-calendar.c4
4 files changed, 46 insertions, 20 deletions
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index 272d822a2c..2eddfbfec6 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -98,13 +98,18 @@ tag_calendar_cb (ECalComponent *comp,
struct calendar_tag_closure *c = data;
struct icaltimetype start_tt, end_tt;
ECalComponentTransparency transparency;
+ guint8 style = 0;
/* If we are skipping TRANSPARENT events, return if the event is
transparent. */
- if (c->skip_transparent_events) {
- e_cal_component_get_transparency (comp, &transparency);
- if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT)
+ e_cal_component_get_transparency (comp, &transparency);
+ if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT) {
+ if (c->skip_transparent_events)
return TRUE;
+
+ style = E_CALENDAR_ITEM_MARK_ITALIC;
+ } else {
+ style = E_CALENDAR_ITEM_MARK_BOLD;
}
start_tt = icaltime_from_timet_with_zone (istart, FALSE, c->zone);
@@ -114,7 +119,8 @@ tag_calendar_cb (ECalComponent *comp,
start_tt.day,
end_tt.year, end_tt.month - 1,
end_tt.day,
- E_CALENDAR_ITEM_MARK_BOLD);
+ style,
+ TRUE);
return TRUE;
}
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 890355620b..5f4b828783 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -139,7 +139,8 @@ static void e_calendar_item_get_day_style (ECalendarItem *calitem,
GdkColor **bg_color,
GdkColor **fg_color,
GdkColor **box_color,
- gboolean *bold);
+ gboolean *bold,
+ gboolean *italic);
static void e_calendar_item_check_selection_end (ECalendarItem *calitem,
gint start_month,
gint start_day,
@@ -1420,7 +1421,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
gint week_num, mon, days_from_week_start;
gint years[3], months[3], days_in_month[3];
gboolean today, selected, has_focus, drop_target = FALSE;
- gboolean bold, draw_day, finished = FALSE;
+ gboolean bold, italic, draw_day, finished = FALSE;
gint today_year, today_month, today_mday, month_offset;
gchar buffer[9];
gint day_style = 0;
@@ -1579,6 +1580,9 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
else
has_focus = FALSE;
+ bold = FALSE;
+ italic = FALSE;
+
if (calitem->style_callback)
(*calitem->style_callback)
(calitem,
@@ -1595,6 +1599,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
&fg_color,
&box_color,
&bold,
+ &italic,
calitem->style_callback_data);
else
e_calendar_item_get_day_style
@@ -1611,7 +1616,8 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
&bg_color,
&fg_color,
&box_color,
- &bold);
+ &bold,
+ &italic);
/* Draw the background, if set. */
if (bg_color) {
@@ -1664,6 +1670,13 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
} else {
pango_font_description_set_weight (font_desc, PANGO_WEIGHT_NORMAL);
}
+
+ if (italic) {
+ pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
+ } else {
+ pango_font_description_set_style (font_desc, PANGO_STYLE_NORMAL);
+ }
+
pango_layout_set_font_description (layout, font_desc);
pango_layout_set_text (layout, buffer, num_chars);
cairo_translate (cr, day_x, day_y);
@@ -2053,7 +2066,8 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
GdkColor **bg_color,
GdkColor **fg_color,
GdkColor **box_color,
- gboolean *bold)
+ gboolean *bold,
+ gboolean *italic)
{
GtkWidget *widget;
GtkStyle *style;
@@ -2064,10 +2078,9 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
*bg_color = NULL;
*fg_color = NULL;
*box_color = NULL;
- *bold = FALSE;
- if (day_style == 1)
- *bold = TRUE;
+ *bold = (day_style & E_CALENDAR_ITEM_MARK_BOLD) == E_CALENDAR_ITEM_MARK_BOLD;
+ *italic = (day_style & E_CALENDAR_ITEM_MARK_ITALIC) == E_CALENDAR_ITEM_MARK_ITALIC;
if (today)
*box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
@@ -2849,12 +2862,14 @@ e_calendar_item_clear_marks (ECalendarItem *calitem)
}
+/* add_day_style - whether bit-or with the actual style or change the style fully */
void
e_calendar_item_mark_day (ECalendarItem *calitem,
gint year,
gint month,
gint day,
- guint8 day_style)
+ guint8 day_style,
+ gboolean add_day_style)
{
gint month_offset;
@@ -2865,7 +2880,7 @@ e_calendar_item_mark_day (ECalendarItem *calitem,
if (!calitem->styles)
calitem->styles = g_new0 (guint8, (calitem->rows * calitem->cols + 2) * 32);
- calitem->styles[(month_offset + 1) * 32 + day] = day_style;
+ calitem->styles[(month_offset + 1) * 32 + day] = (add_day_style ? calitem->styles[(month_offset + 1) * 32 + day] : 0) | day_style;
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
}
@@ -2879,7 +2894,8 @@ e_calendar_item_mark_days (ECalendarItem *calitem,
gint end_year,
gint end_month,
gint end_day,
- guint8 day_style)
+ guint8 day_style,
+ gboolean add_day_style)
{
gint month_offset, end_month_offset, day;
@@ -2920,7 +2936,7 @@ e_calendar_item_mark_days (ECalendarItem *calitem,
#if 0
g_print ("Marking Month:%i Day:%i\n", month_offset, day);
#endif
- calitem->styles[(month_offset + 1) * 32 + day] = day_style;
+ calitem->styles[(month_offset + 1) * 32 + day] = (add_day_style ? calitem->styles[(month_offset + 1) * 32 + day] : 0) | day_style;
day++;
if (day == 32) {
diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h
index f86fc4fd79..936e86ebab 100644
--- a/widgets/misc/e-calendar-item.h
+++ b/widgets/misc/e-calendar-item.h
@@ -41,7 +41,8 @@ G_BEGIN_DECLS
#define E_CALENDAR_COLS_PER_MONTH 7
/* Used to mark days as bold in e_calendar_item_mark_day(). */
-#define E_CALENDAR_ITEM_MARK_BOLD 1
+#define E_CALENDAR_ITEM_MARK_BOLD (1 << 0)
+#define E_CALENDAR_ITEM_MARK_ITALIC (1 << 1)
/*
* These are the padding sizes between various pieces of the calendar.
@@ -101,6 +102,7 @@ typedef void (*ECalendarItemStyleCallback) (ECalendarItem *calitem,
GdkColor **fg_color,
GdkColor **box_color,
gboolean *bold,
+ gboolean *italic,
gpointer data);
/* The type of the callback function optionally used to get the current time.
@@ -329,7 +331,8 @@ void e_calendar_item_mark_day (ECalendarItem *calitem,
gint year,
gint month,
gint day,
- guint8 day_style);
+ guint8 day_style,
+ gboolean add_day_style);
/* Mark a range of days. Any days outside the currently shown range are
ignored. */
@@ -340,7 +343,8 @@ void e_calendar_item_mark_days (ECalendarItem *calitem,
gint end_year,
gint end_month,
gint end_day,
- guint8 day_style);
+ guint8 day_style,
+ gboolean add_day_style);
/* Sets the function to call to get the colors to use for a particular day. */
void e_calendar_item_set_style_callback (ECalendarItem *calitem,
diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c
index 68a9cc12f7..20b8773c34 100644
--- a/widgets/misc/test-calendar.c
+++ b/widgets/misc/test-calendar.c
@@ -120,9 +120,9 @@ on_date_range_changed (ECalendarItem *calitem)
/* These days should appear bold. Remember month is 0 to 11. */
e_calendar_item_mark_day (calitem, 2000, 7, 26, /* 26th Aug 2000. */
- E_CALENDAR_ITEM_MARK_BOLD);
+ E_CALENDAR_ITEM_MARK_BOLD, FALSE);
e_calendar_item_mark_day (calitem, 2000, 8, 13, /* 13th Sep 2000. */
- E_CALENDAR_ITEM_MARK_BOLD);
+ E_CALENDAR_ITEM_MARK_BOLD, FALSE);
}