From 0ebe18356658bb57a0c69f872a38ceb58259bfe1 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 21 Apr 2000 02:26:55 +0000 Subject: callback for obj_updated or obj_removed. (gnome_calendar_new): hook up * gui/gnome-cal.c (gnome_calendar_changed_cb): callback for obj_updated or obj_removed. (gnome_calendar_new): hook up gnome_calendar_changed_cb so if evolution is running twice, they will both see changes right away. svn path=/trunk/; revision=2538 --- calendar/gui/gnome-cal.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index bb50e1c1c4..ad4c95168d 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -225,6 +225,28 @@ gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name) } +static void +gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags) +{ + gncal_day_panel_update (GNCAL_DAY_PANEL (cal->day_view), + object, flags); + gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), + object, flags); + month_view_update (MONTH_VIEW (cal->month_view), object, flags); + year_view_update (YEAR_VIEW (cal->year_view), object, flags); +} + + +static void +gnome_calendar_changed_cb (GtkWidget *cal_client, + const char *uid, + GnomeCalendar *gcal) +{ + printf ("gnome-cal: got changed_cb, uid='%s'\n", uid?uid:""); + gnome_calendar_update_all (gcal, NULL, CHANGE_ALL); +} + + GtkWidget * gnome_calendar_new (char *title) { @@ -239,21 +261,14 @@ gnome_calendar_new (char *title) setup_widgets (gcal); - return retval; -} + gtk_signal_connect (GTK_OBJECT (gcal->client), "obj_updated", + gnome_calendar_changed_cb, gcal); + gtk_signal_connect (GTK_OBJECT (gcal->client), "obj_removed", + gnome_calendar_changed_cb, gcal); -static void -gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags) -{ - gncal_day_panel_update (GNCAL_DAY_PANEL (cal->day_view), - object, flags); - gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), - object, flags); - month_view_update (MONTH_VIEW (cal->month_view), object, flags); - year_view_update (YEAR_VIEW (cal->year_view), object, flags); + return retval; } - typedef struct { GnomeCalendar *gcal; @@ -265,7 +280,6 @@ typedef struct static void gnome_calendar_load_cb (GtkWidget *cal_client, - /*gpointer something,*/ CalClientLoadStatus success, load_or_create_data *locd) { -- cgit