static void text_buffer_apply_tag (GtkTextBuffer *buffer, GtkTextTag *tag,
GtkTextIter *start, GtkTextIter *end,
gpointer userdata);
-static void text_buffer_insert_text (GtkTextBuffer *buffer,
- GtkTextIter *location,
- gchar *text,
- gint len,
- ModestMsgEditWindow *window);
static void text_buffer_delete_images_by_id (GtkTextBuffer *buffer, const gchar * image_id);
static void subject_field_changed (GtkEditable *editable, ModestMsgEditWindow *window);
static void subject_field_insert_text (GtkEditable *editable,
GtkTextIter *iter,
GtkTextMark *mark,
ModestMsgEditWindow *userdata);
-void vadj_changed (GtkAdjustment *adj,
- ModestMsgEditWindow *window);
+static void vadj_changed (GtkAdjustment *adj,
+ ModestMsgEditWindow *window);
static void DEBUG_BUFFER (WPTextBuffer *buffer)
{
GtkWidget *find_toolbar;
gchar *last_search;
+ GtkWidget *font_dialog;
+
GtkWidget *scroll;
guint scroll_drag_timeout_id;
gdouble last_upper;
TnyMsg *draft_msg;
TnyMsg *outbox_msg;
gchar *msg_uid;
+ gchar *references;
+ gchar *in_reply_to;
gboolean sent;
};
priv->draft_msg = NULL;
priv->outbox_msg = NULL;
priv->msg_uid = NULL;
+ priv->references = NULL;
+ priv->in_reply_to = NULL;
priv->can_undo = FALSE;
priv->can_redo = FALSE;
priv->scroll_drag_timeout_id = 0;
priv->last_upper = 0.0;
+ priv->font_dialog = NULL;
+
modest_window_mgr_register_help_id (modest_runtime_get_window_mgr(),
GTK_WINDOW(obj),"applications_email_editor");
gchar *from_string = NULL;
if (account_name) {
from_string = modest_account_mgr_get_from_string (account_mgr,
- account_name);
+ account_name, NULL);
}
if (from_string && account_name) {
}
}
-void vadj_changed (GtkAdjustment *adj,
- ModestMsgEditWindow *window)
+static void
+vadj_changed (GtkAdjustment *adj,
+ ModestMsgEditWindow *window)
{
ModestMsgEditWindowPrivate *priv;
}
static void
+attachment_deleted (ModestAttachmentsView *attachments_view,
+ gpointer user_data)
+{
+ modest_msg_edit_window_remove_attachments (MODEST_MSG_EDIT_WINDOW (user_data),
+ NULL);
+}
+
+static void
connect_signals (ModestMsgEditWindow *obj)
{
ModestMsgEditWindowPrivate *priv;
G_CALLBACK (body_changed), obj);
g_signal_connect (G_OBJECT (priv->text_buffer), "modified-changed",
G_CALLBACK (body_changed), obj);
- g_signal_connect (G_OBJECT (priv->text_buffer), "insert-text",
- G_CALLBACK (text_buffer_insert_text), obj);
g_signal_connect (G_OBJECT (obj), "window-state-event",
G_CALLBACK (modest_msg_edit_window_window_state_event),
NULL);
g_signal_connect (G_OBJECT (priv->msg_body), "cut-clipboard", G_CALLBACK (cut_clipboard_check), NULL);
g_signal_connect (G_OBJECT (priv->msg_body), "copy-clipboard", G_CALLBACK (copy_clipboard_check), NULL);
-
+ g_signal_connect (G_OBJECT (priv->attachments_view), "delete", G_CALLBACK (attachment_deleted), obj);
}
static void
g_object_set (priv->text_buffer, "font_scale", DEFAULT_FONT_SCALE, NULL);
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), TRUE);
#if (GTK_MINOR_VERSION >= 10)
- gtk_text_buffer_register_serialize_tagset(GTK_TEXT_BUFFER(priv->text_buffer), "wp-text-buffer");
+ gtk_text_buffer_register_serialize_tagset(GTK_TEXT_BUFFER(priv->text_buffer), NULL);
deserialize_type = gtk_text_buffer_register_deserialize_tagset(GTK_TEXT_BUFFER(priv->text_buffer),
- "wp-text-buffer");
+ NULL);
gtk_text_buffer_deserialize_set_can_create_tags (GTK_TEXT_BUFFER (priv->text_buffer),
deserialize_type, TRUE);
#endif
call this function before */
modest_msg_edit_window_disconnect_signals (MODEST_WINDOW (obj));
+ if (priv->font_dialog != NULL) {
+ gtk_dialog_response (GTK_DIALOG (priv->font_dialog), GTK_RESPONSE_NONE);
+ }
+
if (priv->clipboard_text != NULL) {
g_free (priv->clipboard_text);
priv->clipboard_text = NULL;
if (priv->original_account_name)
g_free (priv->original_account_name);
g_free (priv->msg_uid);
+ g_free (priv->references);
+ g_free (priv->in_reply_to);
g_free (priv->last_search);
g_slist_free (priv->font_items_group);
g_slist_free (priv->size_items_group);
readed = tny_stream_read (TNY_STREAM (stream), (char *) read_buffer, 128);
size += readed;
if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, &error)) {
+ if (error)
+ g_free (error);
break;
}
}
gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject);
modest_msg_edit_window_set_priority_flags (MODEST_MSG_EDIT_WINDOW(self),
priority_flags);
+ modest_tny_msg_get_references (TNY_MSG (msg), NULL, &(priv->references), &(priv->in_reply_to));
update_window_title (self);
if (preserve_is_rich && !is_html) {
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
/* Get the default format required from configuration */
- } else if (!modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL)) {
+ } else if (!preserve_is_rich && !modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL)) {
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
}
ModestWindow*
-modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean preserve_is_rich)
+modest_msg_edit_window_new (TnyMsg *msg,
+ const gchar *account_name,
+ const gchar *mailbox, /* ignored */
+ gboolean preserve_is_rich)
{
GObject *obj;
ModestWindowPrivate *parent_priv;
wp_text_buffer_save_document (WP_TEXT_BUFFER(priv->text_buffer), get_formatted_data_cb, &string_buffer);
+ modest_text_utils_hyperlinkify (string_buffer);
+
gtk_text_buffer_set_modified (priv->text_buffer, TRUE);
return g_string_free (string_buffer, FALSE);
/* don't free these (except from) */
data = g_slice_new0 (MsgData);
data->from = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
- account_name);
+ account_name, NULL);
data->account_name = g_strdup (account_name);
data->to = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->to_field)));
data->cc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->cc_field)));
data->bcc = g_strdup (modest_recpt_editor_get_recipients (MODEST_RECPT_EDITOR (priv->bcc_field)));
data->subject = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->subject_field)));
+ data->references = g_strdup (priv->references);
+ data->in_reply_to = g_strdup (priv->in_reply_to);
if (priv->draft_msg) {
data->draft_msg = g_object_ref (priv->draft_msg);
} else if (priv->outbox_msg) {
g_free (data->plain_body);
g_free (data->html_body);
g_free (data->account_name);
+ g_free (data->in_reply_to);
+ g_free (data->references);
if (data->draft_msg != NULL) {
g_object_unref (data->draft_msg);
text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), self);
+ g_free (buffer_format);
g_free (current_format);
+ /* Check dimming rules */
+ modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
}
static void
modest_maemo_utils_setup_images_filechooser (GTK_FILE_CHOOSER (dialog));
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ GTK_WINDOW (window));
+
response = gtk_dialog_run (GTK_DIALOG (dialog));
switch (response) {
case GTK_RESPONSE_OK:
if (stream == NULL) {
- modest_platform_information_banner (NULL, NULL, dgettext("hildon-fm", "sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL,
+ _FM("sfil_ib_opening_not_allowed"));
g_object_unref (mime_part);
gnome_vfs_file_info_unref (info);
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- if (modest_platform_check_memory_low (MODEST_WINDOW(window)))
+ if (modest_platform_check_memory_low (MODEST_WINDOW(window), TRUE))
return;
dialog = hildon_file_chooser_dialog_new (GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_window_set_title (GTK_WINDOW (dialog), _("mcen_ti_select_attachment_title"));
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), GTK_WINDOW (window));
response = gtk_dialog_run (GTK_DIALOG (dialog));
switch (response) {
ModestMsgEditWindowPrivate *priv;
GnomeVFSResult result;
GnomeVFSFileSize size = 0;
-
g_return_val_if_fail (window, 0);
g_return_val_if_fail (uri, 0);
info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
size = info->size;
if (size > allowed_size) {
- g_warning ("%s: attachment too big", __FUNCTION__);
- modest_platform_information_banner (NULL, NULL, dgettext("hildon-fm", "sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL,
+ _FM("sfil_ib_opening_not_allowed"));
return 0;
}
} else
if (stream == NULL) {
- modest_platform_information_banner (NULL, NULL, dgettext("hildon-fm", "sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL, _FM("sfil_ib_opening_not_allowed"));
g_object_unref (mime_part);
gnome_vfs_file_info_unref (info);
if (tny_list_get_length (att_list) == 0) {
hildon_banner_show_information (NULL, NULL, _("TODO: no attachments selected to remove"));
} else {
- GtkWidget *confirmation_dialog = NULL;
gboolean dialog_response;
gchar *message = NULL;
gchar *filename = NULL;
message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments",
tny_list_get_length (att_list)), filename);
g_free (filename);
- confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message);
+
+ dialog_response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window), message);
g_free (message);
- dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK);
- gtk_widget_destroy (confirmation_dialog);
- if (!dialog_response) {
+
+ if (dialog_response != GTK_RESPONSE_OK) {
g_object_unref (att_list);
return;
}
/* we check for low-mem; in that case, show a warning, and don't allow
* for the addressbook
*/
- if (modest_platform_check_memory_low (MODEST_WINDOW(window)))
+ if (modest_platform_check_memory_low (MODEST_WINDOW(window), TRUE))
return;
-
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
if (editor == NULL) {
}
- modest_address_book_select_addresses (editor);
+ modest_address_book_select_addresses (editor, GTK_WINDOW (window));
}
break;
}
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), window);
}
}
dialog = hildon_font_selection_dialog_new (GTK_WINDOW (window), NULL);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr(),
- GTK_WINDOW(dialog));
+ GTK_WINDOW(dialog), GTK_WINDOW (window));
/* First we get the currently selected font information */
wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), &oldfmt, TRUE);
"family-set", !oldfmt.cs.font,
NULL);
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_widget_show_all (dialog);
+ priv->font_dialog = dialog;
response = gtk_dialog_run (GTK_DIALOG (dialog));
+ priv->font_dialog = NULL;
if (response == GTK_RESPONSE_OK) {
g_object_get( dialog,
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
-
}
void
if (result_len + old_length > 1000) {
hildon_banner_show_information (GTK_WIDGET (window), NULL,
- dgettext("hildon-common-strings",
- "ckdg_ib_maximum_characters_reached"));
+ _CS("ckdg_ib_maximum_characters_reached"));
}
g_string_free (result, TRUE);
}
-static void
-text_buffer_insert_text (GtkTextBuffer *buffer,
- GtkTextIter *iter,
- gchar *new_text,
- gint new_text_length,
- ModestMsgEditWindow *window)
-{
- GString *result = g_string_new ("");
- gchar *current;
- gint result_len = 0;
- gboolean changed = FALSE;
-
- for (current = new_text; current != NULL && *current != '\0'; current = g_utf8_next_char (current)) {
- gunichar c = g_utf8_get_char_validated (current, 8);
- /* Invalid unichar, stop */
- if (c == -1)
- break;
- /* a bullet */
- switch (c) {
- case 0x2022:
- result = g_string_append_c (result, ' ');
- changed = TRUE;
- break;
- default:
- result = g_string_append_unichar (result, c);
- }
- result_len++;
- }
-
- if (changed) {
- g_signal_stop_emission_by_name (G_OBJECT (buffer), "insert-text");
- g_signal_handlers_block_by_func(G_OBJECT(buffer), G_CALLBACK(text_buffer_insert_text), window);
- g_signal_emit_by_name (buffer, "insert-text",
- (gpointer) iter,
- (gpointer) result->str, (gpointer) result->len,
- (gpointer) window);
- g_signal_handlers_unblock_by_func(G_OBJECT(buffer), G_CALLBACK(text_buffer_insert_text), window);
- }
-
- g_string_free (result, TRUE);
-}
-
void
modest_msg_edit_window_toggle_find_toolbar (ModestMsgEditWindow *window,
gboolean show)
g_free (priv->last_search);
priv->last_search = NULL;
/* Information banner about empty search */
- hildon_banner_show_information (NULL, NULL, dgettext ("hildon-common-strings", "ecdg_ib_find_rep_enter_text"));
+ hildon_banner_show_information (NULL, NULL,
+ _CS ("ecdg_ib_find_rep_enter_text"));
return;
}
result = gtk_text_iter_forward_search_insensitive (&selection_end, current_search,
&match_start, &match_end);
if (!result)
- hildon_banner_show_information (NULL, NULL, dgettext ("hildon-libs", "ckct_ib_find_search_complete"));
+ hildon_banner_show_information (NULL, NULL,
+ _HL ("ckct_ib_find_search_complete"));
} else {
GtkTextIter buffer_start;
gtk_text_buffer_get_start_iter (priv->text_buffer, &buffer_start);
result = gtk_text_iter_forward_search_insensitive (&buffer_start, current_search,
&match_start, &match_end);
if (!result)
- hildon_banner_show_information (NULL, NULL, dgettext ("hildon-libs", "ckct_ib_find_no_matches"));
+ hildon_banner_show_information (NULL, NULL,
+ _HL ("ckct_ib_find_no_matches"));
}
/* Mark as selected the string found in search */
}
priv->msg_uid = modest_tny_folder_get_header_unique_id (header);
if (GTK_WIDGET_REALIZED (window))
- modest_window_mgr_register_window (mgr, MODEST_WINDOW (window));
+ modest_window_mgr_register_window (mgr, MODEST_WINDOW (window), NULL);
}
priv->draft_msg = draft;
ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (userdata);
gchar *tag_name;
- if (tag == NULL+13) return;
+ if (tag == NULL) return;
g_object_get (G_OBJECT (tag), "name", &tag_name, NULL);
if ((tag_name != NULL) && (g_str_has_prefix (tag_name, "image-tag-replace-"))) {
replace_with_images (window, priv->images);
{
g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
- hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here"));
+ hildon_banner_show_information (NULL, NULL,
+ _CS("ckct_ib_cannot_zoom_here"));
return FALSE;
}