Author: juha
Date: 2006-07-29 07:10:09 +0000 (Sat, 29 Jul 2006)
New Revision: 22555
Modified:
xfcalendar/trunk/src/mainbox.c
Log:
fix for bug 2080: update calendar in the background and only when needed.
Much faster and saves a lot of CPU.
Modified: xfcalendar/trunk/src/mainbox.c
===================================================================
--- xfcalendar/trunk/src/mainbox.c 2006-07-29 03:28:19 UTC (rev 22554)
+++ xfcalendar/trunk/src/mainbox.c 2006-07-29 07:10:09 UTC (rev 22555)
@@ -247,10 +247,32 @@
manage_eventlist_win(GTK_CALENDAR(xfcal->mCalendar), el);
}
+gboolean
+upd_calendar(GtkCalendar *calendar)
+{
+ static guint year=-1, month=-1;
+ guint year_n, month_n, day_n;
+
+ /* we only need to do this if it is really a new month. We may get
+ * many of these while calender is changing months and it is enough
+ * to show only the last one, which is visible */
+ gtk_calendar_get_date(calendar, &year_n, &month_n, &day_n);
+ if (month != month_n || year != year_n) { /* need really do it */
+ xfcalendar_mark_appointments();
+ year = year_n;
+ month = month_n;
+ }
+ return(FALSE); /* we do this only once */
+}
+
void
mCalendar_month_changed_cb(GtkCalendar *calendar, gpointer user_data)
{
- xfcalendar_mark_appointments();
+ /* xfcalendar_mark_appointments is rather heavy (=slow), so doing
+ * it here is not a good idea. We can't keep up with the autorepeat
+ * speed if we do the whole thing here. bug 2080 proofs it. so let's
+ * throw it to background and do it later */
+ g_timeout_add(500, (GtkFunction)upd_calendar, calendar);
}
void
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits