aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/year-view.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-10-01 04:37:06 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-10-01 04:37:06 +0800
commitd1769d5646e9fef3c6de607f9f884b02dd954844 (patch)
treefa80d3825e8f7264f542a2d6cebb0c0c735b4a42 /calendar/gui/year-view.c
parent63d572bcbc667902a5cc3e78c6e3429729f076d4 (diff)
downloadgsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar.gz
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar.bz2
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar.lz
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar.xz
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.tar.zst
gsoc2013-evolution-d1769d5646e9fef3c6de607f9f884b02dd954844.zip
New function to mark the current day in the year view.
1998-09-30 Federico Mena Quintero <federico@nuclecu.unam.mx> * year-view.c (mark_current_day): New function to mark the current day in the year view. * mark.c: Removed mark_current_day from here. svn path=/trunk/; revision=418
Diffstat (limited to 'calendar/gui/year-view.c')
-rw-r--r--calendar/gui/year-view.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index da39318ecd..96b43c264b 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -479,6 +479,7 @@ year_view_init (YearView *yv)
/* We will need to resize the items when we paint for the first time */
+ yv->old_marked_day = -1;
yv->idle_id = -1;
need_resize (yv);
}
@@ -568,6 +569,52 @@ year_view_update (YearView *yv, iCalObject *object, int flags)
year_view_set (yv, time_year_begin (time_from_day (yv->year, 0, 1)));
}
+/* Unmarks the old day that was marked as current and marks the current day */
+static void
+mark_current_day (YearView *yv)
+{
+ time_t t;
+ struct tm *tm;
+ int month_index, day_index;
+ GnomeCanvasItem *item;
+
+ /* Unmark the old day */
+
+ if (yv->old_marked_day != -1) {
+ month_index = yv->old_marked_day / 42;
+ day_index = yv->old_marked_day % 42;
+
+ item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
+ GNOME_MONTH_ITEM_DAY_LABEL + day_index);
+ gnome_canvas_item_set (item,
+ "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
+ "font", NORMAL_DAY_FONT,
+ NULL);
+
+ yv->old_marked_day = -1;
+ }
+
+ /* Mark the new day */
+
+ t = time (NULL);
+ tm = localtime (&t);
+
+ if ((tm->tm_year + 1900) == yv->year) {
+ month_index = tm->tm_mon;
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm->tm_mday);
+ g_assert (day_index != -1);
+
+ item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
+ GNOME_MONTH_ITEM_DAY_LABEL + day_index);
+ gnome_canvas_item_set (item,
+ "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
+ "font", CURRENT_DAY_FONT,
+ NULL);
+
+ yv->old_marked_day = month_index * 42 + day_index;
+ }
+}
+
void
year_view_set (YearView *yv, time_t year)
{
@@ -602,6 +649,8 @@ year_view_set (YearView *yv, time_t year)
unmark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]));
mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
}
+
+ mark_current_day (yv);
}
void
@@ -628,9 +677,10 @@ year_view_colors_changed (YearView *yv)
g_return_if_fail (yv != NULL);
g_return_if_fail (IS_YEAR_VIEW (yv));
-
for (i = 0; i < 12; i++) {
colorify_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), default_color_func, NULL);
mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
}
+
+ mark_current_day (yv);
}