return result_to;
}
-
static gboolean
on_idle_mail_to(gpointer user_data)
{
- gdk_threads_enter ();
-
/* This is based on the implemenation of main.c:start_uil(): */
gchar *uri = (gchar*)user_data;
} else {
tny_folder_add_msg (folder, msg, NULL); /* TODO: check err */
-
+ gdk_threads_enter ();
+
ModestWindow *win = modest_msg_edit_window_new (msg, account_name);
+ modest_window_mgr_register_window (modest_runtime_get_window_mgr (), win);
gtk_widget_show_all (GTK_WIDGET (win));
+
+ gdk_threads_leave ();
g_object_unref (G_OBJECT(folder));
+ g_object_unref (win);
}
g_object_unref (G_OBJECT(msg));
g_free(to);
g_free(uri);
-
- gdk_threads_leave ();
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_compose_mail(gpointer user_data)
{
- gdk_threads_enter ();
-
ComposeMailIdleData *idle_data = (ComposeMailIdleData*)user_data;
gchar **list = NULL;
gint i = 0;
} else {
tny_folder_add_msg (folder, msg, NULL); /* TODO: check err */
-
+
+ gdk_threads_enter ();
+
ModestWindow *win = modest_msg_edit_window_new (msg, account_name);
/* it seems Sketch at least sends a leading ',' -- take that into account,
(ModestMsgEditWindow *)win, list[i]);
}
g_strfreev(list);
-
+
+ modest_window_mgr_register_window (modest_runtime_get_window_mgr (), win);
gtk_widget_show_all (GTK_WIDGET (win));
+
+ gdk_threads_leave ();
g_object_unref (G_OBJECT(folder));
+ g_object_unref (win);
}
g_object_unref (G_OBJECT(msg));
g_free (account_name);
- gdk_threads_leave ();
-
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_open_message (gpointer user_data)
{
- gdk_threads_enter ();
-
ModestWindow *msg_view;
TnyMsg *msg;
TnyAccount *account;
if (msg == NULL) {
g_debug (" %s: message not found.", __FUNCTION__);
- gdk_threads_leave ();
return FALSE;
}
g_debug (" %s: Found message.", __FUNCTION__);
account_name = tny_account_get_name (account);
msg_uid = tny_header_get_uid (header);
+ gdk_threads_enter ();
+
msg_view = modest_msg_view_window_new (msg,
account_name,
msg_uid);
- /* TODO: does that leak the msg_view ?! */
+ modest_window_mgr_register_window (modest_runtime_get_window_mgr (), msg_view);
gtk_widget_show_all (GTK_WIDGET (msg_view));
+ gdk_threads_leave ();
+
g_object_unref (header);
g_object_unref (account);
-
- gdk_threads_leave ();
+ g_object_unref (msg_view);
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_send_receive(gpointer user_data)
{
- gdk_threads_enter ();
ModestWindow *win;
+ gdk_threads_enter ();
+
/* Pick the main window if it exists */
win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
/* Get the folder view */
GtkWidget *folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
MODEST_WIDGET_TYPE_FOLDER_VIEW);
- modest_folder_view_select_first_inbox_or_local (
- MODEST_FOLDER_VIEW (folder_view));
+ modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (folder_view));
gdk_threads_leave ();
static gboolean
idle_select_default_focus (gpointer data)
{
- gdk_threads_enter ();
-
ModestGlobalSettingsDialogPrivate *ppriv;
ModestMaemoGlobalSettingsDialogPrivate *priv;
SwitchPageHelper *helper;
/* Grab focus, we need to block in order to prevent a
recursive call to this callback */
g_signal_handler_block (G_OBJECT (ppriv->notebook), priv->switch_handler);
+ gdk_threads_enter ();
gtk_widget_grab_focus (helper->focus_widget);
+ gdk_threads_leave ();
g_signal_handler_unblock (G_OBJECT (ppriv->notebook), priv->switch_handler);
-
g_free (helper);
- gdk_threads_leave ();
-
return FALSE;
}
else {
modest_main_window_set_contents_style (main_window,
MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
- }
-
+ }
}
void
header = tny_msg_get_header (draft_msg);
/* Remove the old draft expunging it */
tny_folder_remove_msg (folder, header, NULL);
- tny_folder_sync (folder, TRUE, NULL);
+ tny_folder_sync (folder, TRUE, &(priv->error));
g_object_unref (header);
}
- tny_folder_add_msg (folder, msg, &(priv->error));
+ if (!priv->error)
+ tny_folder_add_msg (folder, msg, &(priv->error));
+
if (!priv->error)
priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
+ else
+ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
end:
if (msg)
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;
if (tny_stream_is_eos (priv->get_size_stream)) {
gchar *display_size;
+ gdk_threads_enter ();
+
display_size = modest_text_utils_get_display_size (priv->size);
size_string = g_strdup_printf (" (%s)", display_size);
g_free (display_size);
gtk_widget_queue_resize (priv->size_view);
priv->get_size_stream = NULL;
priv->get_size_idle_id = 0;
- }
-
- gdk_threads_leave ();
+ gdk_threads_leave ();
+ }
return (priv->get_size_stream != NULL);
}
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;
folder = tny_folder_change_get_folder (helper->change);
priv = MODEST_HEADER_VIEW_GET_PRIVATE (helper->self);
+
g_mutex_lock (priv->observers_lock);
- /* Emmit signal to evaluate how headers changes affects to the window view */
- g_signal_emit (G_OBJECT(helper->self), signals[MSG_COUNT_CHANGED_SIGNAL], 0, folder, helper->change);
+ /* Emit signal to evaluate how headers changes affects to the window view */
+ gdk_threads_enter ();
+ g_signal_emit (G_OBJECT(helper->self),
+ signals[MSG_COUNT_CHANGED_SIGNAL],
+ 0, folder, helper->change);
+ gdk_threads_leave ();
/* Added or removed headers, so data stored on cliboard are invalid */
if (modest_email_clipboard_check_source_folder (priv->clipboard, folder))
g_mutex_unlock (priv->observers_lock);
- gdk_threads_leave ();
-
return FALSE;
}
handler_id = *tmp;
g_hash_table_remove (priv->destroy_handlers, window);
- /* Remove the reference to the window. We need to block the
- destroy event handler to avoid recursive calls */
- g_signal_handler_block (window, handler_id);
+ /* Remove the reference to the window. Disconnect also the
+ delete-event handler, we won't need it anymore */
+ g_signal_handler_disconnect (window, handler_id);
gtk_widget_destroy (win->data);
- if (G_IS_OBJECT (window))
- g_signal_handler_unblock (window, handler_id);
/* If there are no more windows registered then exit program */
if (priv->window_list == NULL) {