@ -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
|
||||
|
||||
@ -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);
|
||||
EMeetingStoreRefreshCallback call_back;
|
||||
gpointer *data = NULL;
|
||||
|
||||
aqueue_data->call_back = g_ptr_array_index (qdata->call_backs, i);
|
||||
aqueue_data->data = g_ptr_array_index (qdata->data, i);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user