From: Murray Cumming Date: Fri, 17 Aug 2007 16:15:39 +0000 (+0000) Subject: 2007-08-17 Murray Cumming X-Git-Tag: git_migration_finished~2567 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=7ccc83bcafd36997e2e59b4ff119985741053b53 2007-08-17 Murray Cumming * src/dbus_api/modest-dbus-callbacks.c: (on_dbus_method_get_folders): Avoid trying to get the account name when there are no accounts, to avoid critical g_warnings, fixing projects.maemo.org bug NB#65574. pmo-trunk-r3013 --- diff --git a/ChangeLog2 b/ChangeLog2 index cbb6b31..e57cb4c 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,5 +1,21 @@ 2007-08-17 Murray Cumming + * src/dbus_api/modest-dbus-callbacks.c: + (on_dbus_method_get_folders): Avoid trying to get the account name + when there are no accounts, to avoid critical g_warnings, fixing + projects.maemo.org bug NB#65574. + +2007-08-17 Murray Cumming + + * src/modest-ui-actions.c: (modest_ui_actions_on_new_msg): + Use modest_account_mgr_get_signature() instead of accessing gconf + directly, to slightly simplify the code. + * src/dbus_api/modest-dbus-callbacks.c: (on_idle_compose_mail): + Append the signature also when opening via other applications, + fixing projects.maemo.org bug NB#65828. + +2007-08-17 Murray Cumming + * src/modest-tny-send-queue.c: (modest_tny_send_queue_get_msg_id): Check for NULLs to prevent a crash when opening an email that is an attachment in another email, fixing projects.maemo.org bug diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index d88583b..cfd92a8 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -379,12 +379,36 @@ on_idle_compose_mail(gpointer user_data) if (!from) { g_printerr ("modest: no from address for account '%s'\n", account_name); } else { - + /* Get the signature. + * TODO: This, like much of this function is copy/pasted from + * modest_ui_actions_on_new_msg(): */ + gboolean use_signature = FALSE; + gchar *signature = modest_account_mgr_get_signature (modest_runtime_get_account_mgr (), account_name, &use_signature); + + gchar* blank_and_signature = NULL; + if (use_signature) { + blank_and_signature = g_strconcat ("\n", signature, NULL); + } else { + blank_and_signature = g_strdup (""); + } + g_free (signature); + + /* Add it to the body. */ + gchar *body_with_sig = NULL; + if (!(idle_data->body)) + body_with_sig = g_strdup (blank_and_signature); + else { + body_with_sig = g_strconcat (idle_data->body, blank_and_signature, NULL); + } + /* Create the message: */ TnyMsg *msg = modest_tny_msg_new (idle_data->to, from, - idle_data->cc, idle_data->bcc, idle_data->subject, idle_data->body, + idle_data->cc, idle_data->bcc, idle_data->subject, body_with_sig, NULL); /* NULL because m_t_m_n doesn't use it */ + g_free (body_with_sig); + g_free (blank_and_signature); + if (!msg) { g_printerr ("modest: failed to create message\n"); } else @@ -1395,26 +1419,29 @@ on_dbus_method_get_folders (DBusConnection *con, DBusMessage *message) g_printerr ("modest: no account found\n"); } - TnyAccount *account = NULL; - if (account_mgr) { - account = modest_tny_account_store_get_server_account ( - modest_runtime_get_account_store(), account_name, - TNY_ACCOUNT_TYPE_STORE); - } + GList *folder_names = NULL; - if (!account) { - g_printerr ("modest: failed to get tny account folder'%s'\n", account_name); - } + TnyAccount *account = NULL; + if (account_name) { + if (account_mgr) { + account = modest_tny_account_store_get_server_account ( + modest_runtime_get_account_store(), account_name, + TNY_ACCOUNT_TYPE_STORE); + } + + if (!account) { + g_printerr ("modest: failed to get tny account folder'%s'\n", account_name); + } + + printf("DEBUG: %s: Getting folders for account name=%s\n", __FUNCTION__, account_name); + g_free (account_name); + account_name = NULL; - printf("DEBUG: %s: Getting folders for account name=%s\n", __FUNCTION__, account_name); - g_free (account_name); - account_name = NULL; + add_folders_to_list (TNY_FOLDER_STORE (account), &folder_names); - GList *folder_names = NULL; - add_folders_to_list (TNY_FOLDER_STORE (account), &folder_names); - - g_object_unref (account); - account = NULL; + g_object_unref (account); + account = NULL; + } /* Also add the folders from the local folders account, * because they are (currently) used with all accounts: @@ -1464,13 +1491,11 @@ modest_dbus_req_filter (DBusConnection *con, if (dbus_message_is_method_call (message, MODEST_DBUS_IFACE, MODEST_DBUS_METHOD_SEARCH)) { - printf (" DEBUG1: %s\n", __FUNCTION__); on_dbus_method_search (con, message); handled = TRUE; } else if (dbus_message_is_method_call (message, MODEST_DBUS_IFACE, MODEST_DBUS_METHOD_GET_FOLDERS)) { - printf (" DEBUG2: %s\n", __FUNCTION__); on_dbus_method_get_folders (con, message); handled = TRUE; } diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index f7d2a47..f35b31a 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -717,16 +717,17 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win) goto cleanup; } - if (modest_account_mgr_get_bool (modest_runtime_get_account_mgr (), account_name, - MODEST_ACCOUNT_USE_SIGNATURE, FALSE)) { - signature = modest_account_mgr_get_string (modest_runtime_get_account_mgr (), account_name, - MODEST_ACCOUNT_SIGNATURE, FALSE); + gboolean use_signature = FALSE; + signature = modest_account_mgr_get_signature (modest_runtime_get_account_mgr (), account_name, &use_signature); + + if (use_signature) { blank_and_signature = g_strconcat ("\n", signature, NULL); - g_free (signature); } else { blank_and_signature = g_strdup (""); } + g_free (signature); + msg = modest_tny_msg_new ("", from_str, "", "", "", blank_and_signature, NULL); if (!msg) { g_printerr ("modest: failed to create new msg\n"); @@ -741,7 +742,7 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win) /* Create and register edit window */ - /* This is destroyed by TOOD. */ + /* This is destroyed by TODO. */ msg_win = modest_msg_edit_window_new (msg, account_name, FALSE); mgr = modest_runtime_get_window_mgr (); modest_window_mgr_register_window (mgr, msg_win);