* Added a new parametter to modest_ui_actions_compose_msg that instructs the method to set the edit window as modified or not
* Opening a new editor from Contacts plugin and closing it without modifying it no longer shows the "Save message" dialog
* Fixes NB#78911, set the edit window as modified when a new email is created from an external application
pmo-trunk-r4177
}
gdk_threads_enter (); /* CHECKED */
- modest_ui_actions_compose_msg(NULL, to, cc, bcc, subject, body, NULL);
+ modest_ui_actions_compose_msg(NULL, to, cc, bcc, subject, body, NULL, FALSE);
gdk_threads_leave (); /* CHECKED */
cleanup:
g_free(idle_data->attachments);
idle_data->attachments = tmp;
}
+
if (idle_data->attachments != NULL) {
gchar **list = g_strsplit(idle_data->attachments, ",", 0);
gint i = 0;
}
g_strfreev(list);
}
+
+ /* If the message has nothing then mark the buffers as not
+ modified */
gdk_threads_enter (); /* CHECKED */
- modest_ui_actions_compose_msg(NULL, idle_data->to, idle_data->cc,
- idle_data->bcc, idle_data->subject,
- idle_data->body, attachments);
+ if (!strncmp (idle_data->to, "", 1) &&
+ !strncmp (idle_data->to, "", 1) &&
+ !strncmp (idle_data->cc, "", 1) &&
+ !strncmp (idle_data->bcc, "", 1) &&
+ !strncmp (idle_data->subject, "", 1) &&
+ !strncmp (idle_data->body, "", 1) &&
+ attachments == NULL)
+ modest_ui_actions_compose_msg(NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE);
+ else
+ modest_ui_actions_compose_msg(NULL, idle_data->to, idle_data->cc,
+ idle_data->bcc, idle_data->subject,
+ idle_data->body, attachments, TRUE);
gdk_threads_leave (); /* CHECKED */
cleanup:
g_slist_foreach(attachments, (GFunc)g_free, NULL);
/* FUNCTIONS NOT IMPLEMENTED YET */
void
-modest_msg_edit_window_reset_modified (ModestMsgEditWindow *window)
+modest_msg_edit_window_set_modified (ModestMsgEditWindow *window,
+ gboolean modified)
{
g_message (__FUNCTION__);
}
gtk_text_buffer_get_start_iter (priv->text_buffer, &iter);
gtk_text_buffer_place_cursor (priv->text_buffer, &iter);
- modest_msg_edit_window_reset_modified (self);
+ modest_msg_edit_window_set_modified (self, FALSE);
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
modest_window_check_dimming_rules_group (MODEST_WINDOW (obj), MODEST_DIMMING_RULES_CLIPBOARD);
priv->update_caption_visibility = TRUE;
- modest_msg_edit_window_reset_modified (MODEST_MSG_EDIT_WINDOW (obj));
+ modest_msg_edit_window_set_modified (MODEST_MSG_EDIT_WINDOW (obj), FALSE);
/* Track account-removed signal, this window should be closed
in the case we're creating a mail associated to the account
}
void
-modest_msg_edit_window_reset_modified (ModestMsgEditWindow *editor)
+modest_msg_edit_window_set_modified (ModestMsgEditWindow *editor,
+ gboolean modified)
{
ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (editor);
GtkTextBuffer *buffer;
buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->to_field));
- gtk_text_buffer_set_modified (buffer, FALSE);
+ gtk_text_buffer_set_modified (buffer, modified);
buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->cc_field));
- gtk_text_buffer_set_modified (buffer, FALSE);
+ gtk_text_buffer_set_modified (buffer, modified);
buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->bcc_field));
- gtk_text_buffer_set_modified (buffer, FALSE);
- gtk_text_buffer_set_modified (priv->text_buffer, FALSE);
+ gtk_text_buffer_set_modified (buffer, modified);
+ gtk_text_buffer_set_modified (priv->text_buffer, modified);
}
gboolean
const gchar *bcc_str,
const gchar *subject_str,
const gchar *body_str,
- GSList *attachments)
+ GSList *attachments,
+ gboolean set_as_modified)
{
gchar *account_name = NULL;
TnyMsg *msg = NULL;
attachments = g_slist_next(attachments);
}
modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win);
+ modest_msg_edit_window_set_modified (MODEST_MSG_EDIT_WINDOW (msg_win), set_as_modified);
+
gtk_widget_show_all (GTK_WIDGET (msg_win));
cleanup:
if (!modest_ui_actions_run_account_setup_wizard (win))
return;
- modest_ui_actions_compose_msg(win, NULL, NULL, NULL, NULL, NULL, NULL);
+ modest_ui_actions_compose_msg(win, NULL, NULL, NULL, NULL, NULL, NULL, FALSE);
}
/* info_text = g_strdup_printf (_("mail_va_saved_to_drafts"), _("mcen_me_folder_drafts")); */
modest_platform_information_banner (NULL, NULL, _CS("sfil_ib_saving"));
- modest_msg_edit_window_reset_modified (edit_window);
+ modest_msg_edit_window_set_modified (edit_window, FALSE);
/* Frees */
g_free (from);
gpointer user_data);
/**
+ * modest_ui_actions_compose_msg
+ * @win: Modest main window (can be NULL)
+ * @to_str: "To:" header, or NULL
+ * @cc_str: "Cc:" header, or NULL
+ * @bcc_str: "Bcc:" header, or NULL
+ * @subject_str: Subject of the message, or NULL
+ * @body_str: Body of the message (without signature), or NULL
+ * @attachments: attachments List of file URIs to attach
+ * @set_as_modified: wheter or not the message is set initially as modified or not
+ *
* Opens a new message editor for composing
- * @param win Modest main window (can be NULL)
- * @param to_str "To:" header, or NULL
- * @param cc_str "Cc:" header, or NULL
- * @param bcc_str "Bcc:" header, or NULL
- * @param subject_str Subject of the message, or NULL
- * @param body_str Body of the message (without signature), or NULL
- * @param attachments List of file URIs to attach
*/
void modest_ui_actions_compose_msg (ModestWindow *win,
const gchar *to_str,
const gchar *bcc_str,
const gchar *subject_str,
const gchar *body_str,
- GSList *attachments);
+ GSList *attachments,
+ gboolean set_as_modified);
void modest_ui_actions_on_account_connection_error (GtkWindow *parent_window,
TnyAccount *account);
/**
* modest_msg_edit_window_reset_modified:
* @window: a #ModestMsgEditWindow
+ * @modified: wheter or not we want to make the buffer as modified or not
*
- * Resets the message as not modified
+ * Sets the message as modified or not
*/
-void modest_msg_edit_window_reset_modified (ModestMsgEditWindow *window);
+void modest_msg_edit_window_set_modified (ModestMsgEditWindow *window,
+ gboolean modified);
+
gboolean modest_msg_edit_window_get_sent (ModestMsgEditWindow *window);
void modest_msg_edit_window_set_sent (ModestMsgEditWindow *window,
/* If the user wants to close all the windows */
if ((dialog_response == GTK_RESPONSE_OK)
- || (dialog_response == GTK_RESPONSE_ACCEPT)
- || (dialog_response == GTK_RESPONSE_YES))
- {
+ || (dialog_response == GTK_RESPONSE_ACCEPT)
+ || (dialog_response == GTK_RESPONSE_YES)) {
GList *iter = priv->window_list;
do {
if (iter->data != window) {
iter = g_list_next (iter);
}
} while (iter);
- }
- else
- {
- return TRUE;
- }
+ } else {
+ return TRUE;
+ }
}
}
else {