From 8734644b43e1e1854ee1f004f42e220d8a2fb0b8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Jul 2010 09:00:56 -0400 Subject: Bug 624011 - EMeetingTimeSelector tries to change mouse cursor before it's realized --- calendar/gui/e-meeting-time-sel.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 4c19b5a3aa..a34033f44b 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -1468,8 +1468,6 @@ void e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row, gboolean all) { EMeetingTime start, end; - GdkCursor *cursor; - GdkWindow *window; /* nothing to refresh, lets not leak a busy cursor */ if (e_meeting_store_count_actual_attendees (mts->model) <= 0) @@ -1484,14 +1482,22 @@ e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row, end.hour = 0; end.minute = 0; - /* set the cursor to Busy, We need to reset it to normal once the free busy - queries are complete */ - cursor = gdk_cursor_new (GDK_WATCH); - window = gtk_widget_get_window (GTK_WIDGET (mts)); - gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + /* XXX This function is called during schedule page initialization + * before the meeting time selector is realized, meaning it has + * no GdkWindow yet. This avoids a runtime warning. */ + if (gtk_widget_get_realized (GTK_WIDGET (mts))) { + GdkCursor *cursor; + GdkWindow *window; - mts->last_cursor_set = GDK_WATCH; + /* Set the cursor to Busy. We need to reset it to + * normal once the free busy queries are complete. */ + cursor = gdk_cursor_new (GDK_WATCH); + window = gtk_widget_get_window (GTK_WIDGET (mts)); + gdk_window_set_cursor (window, cursor); + gdk_cursor_unref (cursor); + + mts->last_cursor_set = GDK_WATCH; + } /* Ref ourselves in case we are called back after destruction, * we can do this because we will get a call back even after -- cgit v1.2.3