aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:29:36 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:29:36 +0800
commitbacbb085895ae69e7f443cc39e04b686128a63a3 (patch)
tree63d7b824dc9827888fb1b77960e3971bcc390e25 /calendar/gui
parentf4295ffe09c2994a93eff4d4c73505f2bc291a59 (diff)
downloadgsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.gz
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.bz2
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.lz
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.xz
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.zst
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.zip
more and more fixes -mig
svn path=/trunk/; revision=104
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gncal-week-view.c4
-rw-r--r--calendar/gui/gnome-cal.c42
-rw-r--r--calendar/gui/gnome-cal.h4
-rw-r--r--calendar/gui/main.c15
4 files changed, 47 insertions, 18 deletions
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
index f7d3222cfe..f837b3b2d8 100644
--- a/calendar/gui/gncal-week-view.c
+++ b/calendar/gui/gncal-week-view.c
@@ -151,7 +151,7 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
/* Calendar */
- gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon + 1, tm.tm_year + 1900);
+ gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
/* Day views */
@@ -159,6 +159,8 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
tm.tm_mday++;
day_end = mktime (&tm);
+ printf ("Boundary: ");
+ print_time_t (day_start);
gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
day_start = day_end;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 4c0806357d..6e6c17ed21 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -93,21 +93,51 @@ get_current_page (GnomeCalendar *gcal)
return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
}
-GtkWidget *
-gnome_calendar_next (GnomeCalendar *gcal)
+void
+gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
+{
+ GtkWidget *current = get_current_page (gcal);
+ g_assert (new_time != -1);
+
+ if (current == gcal->week_view)
+ gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
+ else if (current == gcal->day_view)
+ printf ("updating day view\n");
+ else if (current == gcal->year_view)
+ printf ("updating year view\n");
+ else
+ printf ("My penguin is gone!\n");
+ gcal->current_display = new_time;
+}
+
+static void
+gnome_calendar_direction (GnomeCalendar *gcal, int direction)
{
GtkWidget *cp = get_current_page (gcal);
time_t new_time;
if (cp == gcal->week_view)
- new_time = time_add_week (gcal->current_display, 1);
+ new_time = time_add_day (gcal->current_display, 7 * direction);
else if (cp == gcal->day_view)
- new_time = time_add_day (gcal->current_display, 1);
+ new_time = time_add_day (gcal->current_display, 1 * direction);
else if (cp == gcal->year_view)
- new_time = time_add_year (gcal->current_display, 1);
+ new_time = time_add_year (gcal->current_display, 1 * direction);
else
g_warning ("Weee! Where did the penguin go?");
+
+ gnome_calendar_goto (gcal, new_time);
+}
+
+void
+gnome_calendar_next (GnomeCalendar *gcal)
+{
+ gnome_calendar_direction (gcal, 1);
+}
+void
+gnome_calendar_previous (GnomeCalendar *gcal)
+{
+ gnome_calendar_direction (gcal, -1);
}
GtkWidget *
@@ -147,6 +177,8 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file)
void
gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
{
+ printf ("Adding object at: ");
+ print_time_t (obj->dtstart);
calendar_add_object (gcal->cal, obj);
gnome_calendar_update_all (gcal);
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 8168c26ec8..c13162ef65 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -39,6 +39,10 @@ guint gnome_calendar_get_type (void);
GtkWidget *gnome_calendar_new (char *title);
void gnome_calendar_load (GnomeCalendar *gcal, char *file);
void gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj);
+void gnome_calendar_next (GnomeCalendar *gcal);
+void gnome_calendar_previous (GnomeCalendar *gcal);
+void gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time);
+
END_GNOME_DECLS
#endif
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index eb272c1246..b8e3f2fb9e 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -151,31 +151,22 @@ close_cmd (GtkWidget *widget, GnomeCalendar *gcal)
gtk_main_quit ();
}
-static GtkWidget *
-get_current_page (GnomeCalendar *gcal)
-{
- return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
-}
-
void
previous_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
- GtkWidget *current_page = get_current_page (gcal);
-
- if (current_page == gcal->week_view){
- }
+ gnome_calendar_previous (gcal);
}
void
next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
- GtkWidget *current_page = get_current_page (gcal);
+ gnome_calendar_next (gcal);
}
void
today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
- GtkWidget *current_page = get_current_page (gcal);
+ gnome_calendar_goto (gcal, time (NULL));
}
GnomeUIInfo gnome_cal_file_menu [] = {