diff options
author | Chenthill Palanisamy <pchen@src.gnome.org> | 2006-04-10 18:11:16 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2006-04-10 18:11:16 +0800 |
commit | 79a50792491efc77d0bf7b53fdeaa1afd3fa8dd8 (patch) | |
tree | d4ee9de29c3f2c44a6cd30624808a88a58103f3a /calendar | |
parent | 05a50698056b0e3610b980d9392c44a24329b06f (diff) | |
download | gsoc2013-evolution-79a50792491efc77d0bf7b53fdeaa1afd3fa8dd8.tar.gz gsoc2013-evolution-79a50792491efc77d0bf7b53fdeaa1afd3fa8dd8.tar.zst gsoc2013-evolution-79a50792491efc77d0bf7b53fdeaa1afd3fa8dd8.zip |
Fixes #163039
svn path=/trunk/; revision=31798
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 13 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.c | 59 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-meeting-time-sel.c | 4 |
4 files changed, 24 insertions, 54 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index d4cbbf4090..c36e2e5c2d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,16 @@ +2006-04-07 Chenthill Palanisamy <pchenthill@novell.com> + + Fixes #163039 + * gui/e-meeting-store.c: (ems_finalize), (ems_init), + (process_callbacks), (refresh_busy_periods): Removed the + async queue, updated the gui via the callback function in a + idle loop as and when we receive the free busy information. + (e_meeting_store_get_num_queries): Fixed a warning. + * gui/e-meeting-store.h: + * gui/e-meeting-time-sel.c: + (e_meeting_time_selector_refresh_cb): Changed the return type of + the function to return a boolean variable. + 2006-04-05 Chenthill Palanisamy <pchenthill@novell.com> Fixes #328808 diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 8a185add17..738447b83b 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -58,10 +58,8 @@ struct _EMeetingStorePrivate { GMutex *mutex; guint refresh_idle_id; - guint callback_idle_id; guint num_threads; guint num_queries; - GAsyncQueue *async_queue; }; #define BUF_SIZE 1024 @@ -566,15 +564,10 @@ ems_finalize (GObject *obj) if (priv->refresh_idle_id) g_source_remove (priv->refresh_idle_id); - if (priv->callback_idle_id) - g_source_remove (priv->callback_idle_id); - g_free (priv->fb_uri); g_mutex_free (priv->mutex); - g_async_queue_unref (priv->async_queue); - g_free (priv); if (G_OBJECT_CLASS (parent_class)->finalize) @@ -610,8 +603,6 @@ ems_init (EMeetingStore *store) priv->mutex = g_mutex_new (); - priv->async_queue = g_async_queue_new (); - priv->num_queries = 0; start_addressbook_server (store); @@ -947,38 +938,6 @@ find_zone (icalproperty *ip, icalcomponent *tz_top_level) return NULL; } -typedef struct { - EMeetingStoreRefreshCallback call_back; - gpointer *data; -} QueueCbData; - -/* Process the callbacks in the main thread. Avoids widget redrawing issues. */ -static gboolean -process_callbacks_main_thread (void *data) -{ - EMeetingStore *store = data; - EMeetingStorePrivate *priv; - QueueCbData *aqueue_data; - gboolean threads_done = FALSE; - - priv = store->priv; - - g_mutex_lock (priv->mutex); - if (priv->num_threads == 0) { - threads_done = TRUE; - priv->callback_idle_id = 0; - } - g_mutex_unlock (priv->mutex); - - while ((aqueue_data = g_async_queue_try_pop (priv->async_queue)) != NULL) { - aqueue_data->call_back (aqueue_data->data); - - g_free (aqueue_data); - } - - return !threads_done; -} - static void process_callbacks (EMeetingStoreQueueData *qdata) { @@ -988,12 +947,13 @@ process_callbacks (EMeetingStoreQueueData *qdata) store = qdata->store; for (i = 0; i < qdata->call_backs->len; i++) { - QueueCbData *aqueue_data = g_new0 (QueueCbData, 1); - - aqueue_data->call_back = g_ptr_array_index (qdata->call_backs, i); - aqueue_data->data = g_ptr_array_index (qdata->data, i); + EMeetingStoreRefreshCallback call_back; + gpointer *data = NULL; - g_async_queue_push (store->priv->async_queue, aqueue_data); + call_back = g_ptr_array_index (qdata->call_backs, i); + data = g_ptr_array_index (qdata->data, i); + + g_idle_add ((GSourceFunc) call_back, data); } g_mutex_lock (store->priv->mutex); @@ -1001,7 +961,6 @@ process_callbacks (EMeetingStoreQueueData *qdata) g_mutex_unlock (store->priv->mutex); refresh_queue_remove (qdata->store, qdata->attendee); - g_async_queue_unref (store->priv->async_queue); g_object_unref (store); } @@ -1338,7 +1297,6 @@ refresh_busy_periods (gpointer data) } - g_async_queue_ref (priv->async_queue); g_mutex_lock (store->priv->mutex); store->priv->num_threads++; @@ -1352,17 +1310,14 @@ refresh_busy_periods (gpointer data) g_free (fbd->email); priv->refresh_idle_id = 0; - g_async_queue_unref (priv->async_queue); g_mutex_lock (store->priv->mutex); store->priv->num_threads--; g_mutex_unlock (store->priv->mutex); return FALSE; - } else if (priv->callback_idle_id == 0) { - priv->callback_idle_id = g_idle_add (process_callbacks_main_thread, - store); } + return TRUE; } diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h index 6383de07cb..fb6d678fd0 100644 --- a/calendar/gui/e-meeting-store.h +++ b/calendar/gui/e-meeting-store.h @@ -65,7 +65,7 @@ struct _EMeetingStoreClass { GtkListStoreClass parent_class; }; -typedef void (* EMeetingStoreRefreshCallback) (gpointer data); +typedef gboolean (* EMeetingStoreRefreshCallback) (gpointer data); GType e_meeting_store_get_type (void); GObject *e_meeting_store_new (void); diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index b0cee97f9a..0cfadf4b5a 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -1198,7 +1198,7 @@ e_meeting_time_selector_set_zoomed_out (EMeetingTimeSelector *mts, gtk_widget_queue_draw (mts->display_main); } -static void +static gboolean e_meeting_time_selector_refresh_cb (gpointer data) { EMeetingTimeSelector *mts = data; @@ -1216,6 +1216,8 @@ e_meeting_time_selector_refresh_cb (gpointer data) gtk_widget_queue_draw (mts->display_main); gtk_object_unref (GTK_OBJECT (mts)); + + return FALSE; } static void |