aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gncal-week-view.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-02 15:25:44 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-02 15:25:44 +0800
commit0b8a6756acbe25490201ec50441cc82f4f703cb8 (patch)
treebb13427e3fc6043b18581af9221b77f19a27983c /calendar/gncal-week-view.c
parent23463e22bcec65cf1013ae036dc126be0e1903d6 (diff)
downloadgsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar.gz
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar.bz2
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar.lz
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar.xz
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.tar.zst
gsoc2013-evolution-0b8a6756acbe25490201ec50441cc82f4f703cb8.zip
More updates so that Mig can test it - Federico
svn path=/trunk/; revision=91
Diffstat (limited to 'calendar/gncal-week-view.c')
-rw-r--r--calendar/gncal-week-view.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/calendar/gncal-week-view.c b/calendar/gncal-week-view.c
index 98b73ae521..ced5f13627 100644
--- a/calendar/gncal-week-view.c
+++ b/calendar/gncal-week-view.c
@@ -5,6 +5,7 @@
* Author: Federico Mena <federico@nuclecu.unam.mx>
*/
+#include <string.h>
#include "gncal-week-view.h"
@@ -43,6 +44,8 @@ gncal_week_view_init (GncalWeekView *wview)
for (i = 0; i < 7; i++)
wview->days[i] = NULL;
+
+ wview->gtk_calendar = NULL;
}
GtkWidget *
@@ -80,6 +83,22 @@ gncal_week_view_new (Calendar *calendar, time_t start_of_week)
gtk_widget_show (GTK_WIDGET (wview->days[i]));
}
+ /* FIXME: for now this is a plain calendar (for not having anything better to put
+ * there). In the final version it should be a nice days/hours matrix with
+ * "event density" display as in Sun's "cm" program.
+ */
+
+ wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
+ gtk_calendar_display_options (wview->gtk_calendar,
+ GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);
+ gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->gtk_calendar),
+ 0, 3,
+ 1, 2,
+ GTK_EXPAND | GTK_FILL | GTK_SHRINK,
+ GTK_EXPAND | GTK_FILL | GTK_SHRINK,
+ 4, 4);
+ gtk_widget_show (GTK_WIDGET (wview->gtk_calendar));
+
gncal_week_view_set (wview, start_of_week);
return GTK_WIDGET (wview);
@@ -111,15 +130,16 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
{
struct tm tm;
time_t day_start, day_end;
+ int i;
g_return_if_fail (wview != NULL);
g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
tm = *localtime (&start_of_week);
- /* back up to start of week */
+ /* back up to start of week (Monday) */
- tm.tm_mday -= tm.tm_wday;
+ tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
/* Start of day */
@@ -129,11 +149,17 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
day_start = mktime (&tm);
+ /* Calendar */
+
+ gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon + 1, tm.tm_year + 1900);
+
+ /* Day views */
+
for (i = 0; i < 7; i++) { /* rest of days */
tm.tm_mday++;
day_end = mktime (&tm);
- gncal_day_view_set_bounds (days[i], day_start, day_end - 1);
+ gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
day_start = day_end;
}