From d30e7f782ee451e13beac4858ba44b3bd390a768 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Wed, 29 Mar 2006 09:10:27 +0000 Subject: Fixes #160357 svn path=/trunk/; revision=31755 --- calendar/gui/e-meeting-store.c | 18 ++++++++++++++++++ calendar/gui/e-meeting-store.h | 1 + calendar/gui/e-meeting-time-sel.c | 17 +++++++++++++++-- calendar/gui/e-meeting-time-sel.h | 4 ++++ 4 files changed, 38 insertions(+), 2 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index a942d83779..8a185add17 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -60,6 +60,7 @@ struct _EMeetingStorePrivate { guint callback_idle_id; guint num_threads; + guint num_queries; GAsyncQueue *async_queue; }; @@ -611,6 +612,8 @@ ems_init (EMeetingStore *store) priv->async_queue = g_async_queue_new (); + priv->num_queries = 0; + start_addressbook_server (store); } @@ -1177,6 +1180,7 @@ typedef struct { char *email; EMeetingAttendee *attendee; EMeetingStoreQueueData *qdata; + EMeetingStore *store; } FreeBusyAsyncData; #define USER_SUB "%u" @@ -1189,12 +1193,15 @@ freebusy_async (gpointer data) EMeetingAttendee *attendee = fbd->attendee; gchar *default_fb_uri; static GStaticMutex mutex = G_STATIC_MUTEX_INIT; + EMeetingStorePrivate *priv = fbd->store->priv; if (fbd->client) { /* FIXME this a work around for getting all th free busy information for the users we should be able to get free busy asynchronously */ g_static_mutex_lock (&mutex); + priv->num_queries++; e_cal_get_free_busy (fbd->client, fbd->users, fbd->startt, fbd->endt, &(fbd->fb_data), NULL); + priv->num_queries--; g_static_mutex_unlock (&mutex); g_list_foreach (fbd->users, (GFunc)g_free, NULL); @@ -1234,9 +1241,11 @@ freebusy_async (gpointer data) g_free (default_fb_uri); default_fb_uri = replace_string (tmp_fb_uri, DOMAIN_SUB, split_email[1]); + priv->num_queries++; gnome_vfs_async_open (&handle, default_fb_uri, GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT, start_async_read, fbd->qdata); + priv->num_queries--; g_free (tmp_fb_uri); g_strfreev (split_email); @@ -1300,6 +1309,7 @@ refresh_busy_periods (gpointer data) fbd->fb_data = NULL; fbd->qdata = qdata; fbd->fb_uri = priv->fb_uri; + fbd->store = store; fbd->email = g_strdup (itip_strip_mailto (e_meeting_attendee_get_address (attendee))); /* Check the server for free busy data */ @@ -1503,3 +1513,11 @@ e_meeting_store_refresh_busy_periods (EMeetingStore *store, refresh_queue_add (store, row, start, end, call_back, data); } + +guint +e_meeting_store_get_num_queries (EMeetingStore *store) +{ + g_return_if_fail (E_IS_MEETING_STORE (store)); + + return store->priv->num_queries; +} diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h index 8d18126422..6383de07cb 100644 --- a/calendar/gui/e-meeting-store.h +++ b/calendar/gui/e-meeting-store.h @@ -106,6 +106,7 @@ void e_meeting_store_refresh_busy_periods (EMeetingStore *im, EMeetingStoreRefreshCallback call_back, gpointer data); +guint e_meeting_store_get_num_queries (EMeetingStore *store); G_END_DECLS diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index f25ceb4d80..b0cee97f9a 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -59,6 +59,7 @@ #include #include +#include #include "calendar-component.h" #include "calendar-config.h" @@ -390,13 +391,13 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_widget_show (mts->vscrollbar); /* Create the item in the top canvas. */ - gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_top)->root), + mts->item_top = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_top)->root), e_meeting_time_selector_item_get_type (), "EMeetingTimeSelectorItem::meeting_time_selector", mts, NULL); /* Create the item in the main canvas. */ - gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_main)->root), + mts->item_main = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_main)->root), e_meeting_time_selector_item_get_type (), "EMeetingTimeSelectorItem::meeting_time_selector", mts, NULL); @@ -1202,6 +1203,13 @@ e_meeting_time_selector_refresh_cb (gpointer data) { EMeetingTimeSelector *mts = data; + if (e_meeting_store_get_num_queries (mts->model) == 0) { + e_cursor_set ((GtkWidget *)mts, E_CURSOR_NORMAL); + mts->last_cursor_set = GDK_LEFT_PTR; + e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_top)); + e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_main)); + } + if (mts->display_top != NULL) gtk_widget_queue_draw (mts->display_top); if (mts->display_main != NULL) @@ -1224,6 +1232,11 @@ e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, int row, g 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 */ + e_cursor_set ((GtkWidget *)mts, E_CURSOR_BUSY); + 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 * an error */ diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h index 5a4b94ff1e..8697950e06 100644 --- a/calendar/gui/e-meeting-time-sel.h +++ b/calendar/gui/e-meeting-time-sel.h @@ -126,11 +126,13 @@ struct _EMeetingTimeSelector /* The canvas displaying the dates, times, and the summary 'All Attendees' free/busy display. */ GtkWidget *display_top; + GnomeCanvasItem *item_top; /* The canvas containing the free/busy displays of individual attendees. This is separate from display_top since it also scrolls vertically. */ GtkWidget *display_main; + GnomeCanvasItem *item_main; /* The 'Add attendees from addressbook' button */ GtkWidget *add_attendees_button; @@ -258,6 +260,8 @@ struct _EMeetingTimeSelector /* The notification function id for Free/Busy refreshes */ gboolean fb_refresh_not; + + GdkCursorType last_cursor_set; }; -- cgit v1.2.3