2007-06-26 Murray Cumming <murrayc@murrayc.com>
+ * src/maemo/modest-maemo-global-settings-dialog.c:
+ (idle_select_default_focus):
+ * src/modest-mail-operation.c: (idle_notify_progress),
+ (idle_notify_progress_once), (idle_notify_update_account_queue),
+ (set_last_updated_idle), (update_account_thread),
+ (notify_get_msgs_full), (get_msgs_full_destroyer),
+ (get_msgs_full_thread):
+ * src/widgets/modest-attachment-view.c: (get_size_idle_func):
+ * src/widgets/modest-header-view.c:
+ (idle_notify_headers_count_changed_destroy),
+ (idle_notify_headers_count_changed):
+ Use gdk_threads_enter() and gdk_threads_enter_leave() in
+ all idle handlers, because some other thread could be blocking
+ the GDK lock, so that it can do GUI stuff.
+
+2007-06-26 Murray Cumming <murrayc@murrayc.com>
+
* src/dbus_api/modest-dbus-callbacks.c: (on_idle_mail_to),
(on_idle_compose_mail), (on_compose_mail), (on_idle_open_message),
(on_idle_send_receive), (on_idle_open_default_inbox):
static gboolean
on_idle_mail_to(gpointer user_data)
{
- gdk_threads_enter();
+ gdk_threads_enter ();
/* This is based on the implemenation of main.c:start_uil(): */
g_free(uri);
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_compose_mail(gpointer user_data)
{
- gdk_threads_enter();
+ gdk_threads_enter ();
ComposeMailIdleData *idle_data = (ComposeMailIdleData*)user_data;
gchar **list = NULL;
g_free (account_name);
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_open_message (gpointer user_data)
{
- gdk_threads_enter();
+ gdk_threads_enter ();
ModestWindow *msg_view;
TnyMsg *msg;
if (msg == NULL) {
g_debug (" %s: message not found.", __FUNCTION__);
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE;
}
g_debug (" %s: Found message.", __FUNCTION__);
g_object_unref (header);
g_object_unref (account);
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_send_receive(gpointer user_data)
{
- gdk_threads_enter();
+ gdk_threads_enter ();
ModestWindow *win;
/* Pick the main window if it exists */
/* TODO: check the auto-update parameter in the configuration */
modest_ui_actions_do_send_receive_all (win);
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_open_default_inbox(gpointer user_data)
{
- gdk_threads_enter();
+ gdk_threads_enter ();
ModestWindow *win =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
modest_folder_view_select_first_inbox_or_local (
MODEST_FOLDER_VIEW (folder_view));
- gdk_threads_leave();
+ gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
idle_select_default_focus (gpointer data)
{
+ gdk_threads_enter ();
+
ModestGlobalSettingsDialogPrivate *ppriv;
ModestMaemoGlobalSettingsDialogPrivate *priv;
SwitchPageHelper *helper;
g_free (helper);
+ gdk_threads_leave ();
+
return FALSE;
}
static gboolean
idle_notify_progress (gpointer data)
{
+ gdk_threads_enter ();
+
ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
ModestMailOperationState *state;
g_signal_emit (G_OBJECT (mail_op), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
g_slice_free (ModestMailOperationState, state);
+ gdk_threads_leave ();
+
return TRUE;
}
static gboolean
idle_notify_progress_once (gpointer data)
{
+ gdk_threads_enter ();
+
ModestPair *pair;
pair = (ModestPair *) data;
g_slice_free (ModestMailOperationState, (ModestMailOperationState*)pair->second);
g_object_unref (pair->first);
+ gdk_threads_leave ();
+
return FALSE;
}
* loop. We call it inside an idle call to achieve that
*/
static gboolean
-notify_update_account_queue (gpointer data)
+idle_notify_update_account_queue (gpointer data)
{
+ gdk_threads_enter ();
+
ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
ModestMailOperationPrivate *priv = NULL;
modest_mail_operation_notify_end (mail_op);
g_object_unref (mail_op);
+ gdk_threads_leave ();
+
return FALSE;
}
static gboolean
set_last_updated_idle (gpointer data)
{
+ gdk_threads_enter ();
+
/* It does not matter if the time is not exactly the same than
the time when this idle was called, it's just an
approximation and it won't be very different */
time(NULL),
TRUE);
+ gdk_threads_leave ();
+
return FALSE;
}
/* Notify about operation end. Note that the info could be
freed before this idle happens, but the mail operation will
be still alive */
- g_idle_add (notify_update_account_queue, g_object_ref (info->mail_op));
+ g_idle_add (idle_notify_update_account_queue, g_object_ref (info->mail_op));
if (info->callback) {
/* This thread is not in the main lock */
static gboolean
notify_get_msgs_full (gpointer data)
{
+ gdk_threads_enter ();
+
NotifyGetMsgsInfo *info;
info = (NotifyGetMsgsInfo *) data;
g_slice_free (NotifyGetMsgsInfo, info);
+ gdk_threads_leave ();
+
return FALSE;
}
static gboolean
get_msgs_full_destroyer (gpointer data)
{
+ gdk_threads_enter ();
+
GetFullMsgsInfo *info;
info = (GetFullMsgsInfo *) data;
g_object_unref (info->headers);
g_slice_free (GetFullMsgsInfo, info);
+ gdk_threads_leave ();
+
return FALSE;
}
priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
/* Notify about operation end */
- g_idle_add (notify_update_account_queue, g_object_ref (info->mail_op));
+ g_idle_add (idle_notify_update_account_queue, g_object_ref (info->mail_op));
/* Free thread resources. Will be called after all previous idles */
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 1, get_msgs_full_destroyer, info, NULL);
static gboolean
get_size_idle_func (gpointer data)
{
+ gdk_threads_enter ();
+
ModestAttachmentView *self = (ModestAttachmentView *) data;
ModestAttachmentViewPriv *priv = MODEST_ATTACHMENT_VIEW_GET_PRIVATE (self);
gssize readed_size;
priv->get_size_idle_id = 0;
}
+ gdk_threads_leave ();
+
return (priv->get_size_stream != NULL);
-
}
static void
static void
idle_notify_headers_count_changed_destroy (gpointer data)
{
+ gdk_threads_enter ();
+
HeadersCountChangedHelper *helper = NULL;
g_return_if_fail (data != NULL);
g_object_unref (helper->change);
g_slice_free (HeadersCountChangedHelper, helper);
+
+ gdk_threads_leave ();
}
static gboolean
idle_notify_headers_count_changed (gpointer data)
{
+ gdk_threads_enter ();
+
TnyFolder *folder = NULL;
ModestHeaderViewPrivate *priv = NULL;
HeadersCountChangedHelper *helper = NULL;
g_mutex_unlock (priv->observers_lock);
+ gdk_threads_leave ();
+
return FALSE;
}