aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-19 09:16:59 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-19 09:16:59 +0800
commit3b76de8bcdab2e043b5882ff096a1602f12b8db6 (patch)
tree122249b482cb530a80a6faf2bf14feb7b7a355f3 /calendar/gui
parent64a3522acac1f96115f6d8aaee15dcb1d5812f5a (diff)
downloadgsoc2013-evolution-3b76de8bcdab2e043b5882ff096a1602f12b8db6.tar.gz
gsoc2013-evolution-3b76de8bcdab2e043b5882ff096a1602f12b8db6.tar.zst
gsoc2013-evolution-3b76de8bcdab2e043b5882ff096a1602f12b8db6.zip
Various small fixes here and there -mig
svn path=/trunk/; revision=160
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gncal-week-view.c58
-rw-r--r--calendar/gui/year-view.c5
2 files changed, 54 insertions, 9 deletions
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
index 59252baa0c..ef3b2b9fc8 100644
--- a/calendar/gui/gncal-week-view.c
+++ b/calendar/gui/gncal-week-view.c
@@ -2,7 +2,8 @@
*
* Copyright (C) 1998 The Free Software Foundation
*
- * Author: Federico Mena <quartic@gimp.org>
+ * Authors: Federico Mena <quartic@gimp.org>
+ * Miguel de Icaza <miguel@kernel.org>
*/
#include <string.h>
@@ -48,6 +49,46 @@ gncal_week_view_init (GncalWeekView *wview)
wview->gtk_calendar = NULL;
}
+static void
+jump_to_day (GtkCalendar *cal, GncalWeekView *wview, int day)
+{
+ struct tm tm;
+ time_t t;
+ static int inside;
+
+ if (inside)
+ return;
+ inside = 1;
+ tm.tm_mday = day;
+ tm.tm_mon = cal->month;
+ tm.tm_year = cal->year - 1900;
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = -1;
+ t = mktime (&tm);
+
+ gncal_week_view_set (wview, t);
+ inside = 0;
+}
+
+static void
+jump_to_day_click (GtkCalendar *cal, GncalWeekView *wview)
+{
+ jump_to_day (cal, wview, cal->selected_day);
+}
+
+static void
+sync_week (GtkCalendar *cal, GncalWeekView *wview)
+{
+ jump_to_day (cal, wview, wview->start_of_week.tm_mday + 7);
+}
+
+static void
+double_click_on_weekday (GtkWidget *widget, GdkEvent *e, GncalWeekView *wview)
+{
+}
+
GtkWidget *
gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
{
@@ -64,7 +105,9 @@ gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
for (i = 0; i < 7; i++) {
wview->days[i] = GNCAL_DAY_VIEW (gncal_day_view_new (calendar, 0, 0));
-
+ gtk_signal_connect (GTK_OBJECT (wview->days [i]), "button_press_event",
+ GTK_SIGNAL_CONNECT(double_click_on_weekday), wview);
+
if (i < 5)
gtk_table_attach (GTK_TABLE (wview), GTK_WIDGET (wview->days[i]),
i, i + 1,
@@ -83,12 +126,13 @@ gncal_week_view_new (GnomeCalendar *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_signal_connect (GTK_OBJECT (wview->gtk_calendar), "day_selected_double_click",
+ GTK_SIGNAL_FUNC(jump_to_day), wview);
+ gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "month_changed",
+ GTK_SIGNAL_FUNC(sync_week), wview);
+
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),
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index 5376826239..dd1a963d52 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -22,10 +22,11 @@ double_click(GtkCalendar *gc, GncalYearView *yview)
tm.tm_mday = gc->selected_day;
tm.tm_mon = gc->month;
- tm.tm_year = gc->year;
+ tm.tm_year = gc->year - 1900;
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
+ tm.tm_isdst = -1;
t = mktime (&tm);
gnome_calendar_dayjump (yview->gcal, t);
@@ -199,7 +200,7 @@ gncal_year_view_set_year (GncalYearView *yview, int year)
gtk_label_set(GTK_LABEL(yview->year_label), buff);
for (i = 0; i < 12; i++) {
- gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year);
+ gtk_calendar_select_month (GTK_CALENDAR(yview->calendar[i]), i, yview->year + 1900);
gtk_calendar_clear_marks (GTK_CALENDAR (yview->calendar[i]));
}