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):
+ * src/maemo/modest-msg-edit-window.c:
+ (modest_msg_edit_window_attach_file_noninteractive):
+ Use gdk_threads_enter() and gdk_threads_leave() in all the idle handlers,
+ to prevent a hang. I don't quite understand why these are necessary,
+ beause we should already be in the main loop. I guess something outside
+ of the main loop is taking the lock.
+
+ * tests/dbus_api/test_compose_mail.c: (main): Use file:// prefixes so
+ we are really using URIs, and use files that are more likely to exist.
+
+2007-06-26 Murray Cumming <murrayc@murrayc.com>
+
* tests/dbus_api/Makefile.am: Fix the build of the tests. This was
necessary because configure.ac now defines different variables.
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;
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;
g_free (idle_data);
g_free (account_name);
+
+ gdk_threads_leave();
+
return FALSE; /* Do not call this callback again. */
}
static gint on_compose_mail(GArray * arguments, gpointer data, osso_rpc_t * retval)
{
-
-
if (arguments->len != MODEST_DEBUS_COMPOSE_MAIL_ARGS_COUNT)
return OSSO_ERROR;
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__);
g_object_unref (header);
g_object_unref (account);
+ gdk_threads_leave();
+
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_send_receive(gpointer user_data)
{
+ 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();
+
return FALSE; /* Do not call this callback again. */
}
static gboolean
on_idle_open_default_inbox(gpointer user_data)
{
+ 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();
+
return FALSE; /* Do not call this callback again. */
}
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- if (file_uri) {
+ if (file_uri && strlen(file_uri)) {
gint file_id = 0;
/* TODO: We should probably try to use only the URI,
*/
gchar* filename = g_filename_from_uri (file_uri, NULL, NULL);
if (!filename) {
- g_warning("%s: g_filename_from_uri(%s) failed.\n", __FUNCTION__, file_uri);
+ g_warning("%s: g_filename_from_uri('%s') failed.\n", __FUNCTION__, file_uri);
}
file_id = g_open (filename, O_RDONLY, 0);
/* Call the function in libmodest-dbus-client: */
- attachments = g_slist_append(attachments, "/usr/include/math.h,/usr/include/malloc.h");
+ attachments = g_slist_append(attachments, "file:///usr/include/math.h,file:///usr/include/glib-2.0/glib.h");
const gboolean ret = libmodest_dbus_client_compose_mail (
osso_context,