X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-msg-edit-window.c;h=a4a9f02f3b8bad50d4ee4abc551c1db6c986af58;hp=1365dedc5c5e84969519d0e655f0848ec5b39480;hb=ea3d3f6dbfa6361561528e4a90d79c8e7f97c1a6;hpb=56dd0b9590fe68db822f5638d0d772fe7e5ea1c2 diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 1365ded..a4a9f02 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -277,10 +277,11 @@ modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass) modest_window_class->zoom_plus_func = modest_msg_edit_window_zoom_plus; modest_window_class->zoom_minus_func = modest_msg_edit_window_zoom_minus; modest_window_class->show_toolbar_func = modest_msg_edit_window_show_toolbar; + modest_window_class->save_state_func = save_state; g_type_class_add_private (gobject_class, sizeof(ModestMsgEditWindowPrivate)); - modest_window_class->save_state_func = save_state; + } static void @@ -530,6 +531,11 @@ modest_msg_edit_window_finalize (GObject *obj) priv->system_clipboard_change_handler_id = 0; } + if (priv->draft_msg != NULL) { + g_object_unref (priv->draft_msg); + priv->draft_msg = NULL; + } + /* This had to stay alive for as long as the combobox that used it: */ modest_pair_list_free (priv->from_field_protos); @@ -658,7 +664,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg) update_dimmed (self); text_buffer_can_undo (priv->text_buffer, FALSE, self); - priv->draft_msg = msg; + priv->draft_msg = g_object_ref(msg); } static void @@ -1192,7 +1198,7 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR, (gpointer) (&(buffer_format->color))); } if (buffer_format->cs.font_size) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BOLD, (gpointer) (buffer_format->font_size)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, (gpointer) (buffer_format->font_size)); } if (buffer_format->cs.justification) { switch (buffer_format->justification) { @@ -1211,7 +1217,7 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, } if (buffer_format->cs.font) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BOLD, (gpointer) (buffer_format->font)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT, (gpointer) (buffer_format->font)); } if (buffer_format->cs.bullet) { wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BULLET, (gpointer) ((int)buffer_format->bullet)); @@ -1611,7 +1617,7 @@ modest_msg_edit_window_attach_file_noninteractive ( 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, @@ -1619,7 +1625,7 @@ modest_msg_edit_window_attach_file_noninteractive ( */ 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); @@ -1767,7 +1773,7 @@ modest_msg_edit_window_size_change (GtkCheckMenuItem *menu_item, WPTextBufferFormat format; memset (&format, 0, sizeof (format)); - wp_text_buffer_get_current_state (WP_TEXT_BUFFER (priv->text_buffer), &format); + wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), &format, FALSE); label = gtk_bin_get_child (GTK_BIN (menu_item)); @@ -1776,11 +1782,11 @@ modest_msg_edit_window_size_change (GtkCheckMenuItem *menu_item, format.cs.text_position = TRUE; format.cs.font = TRUE; format.font_size = wp_get_font_size_index (new_size_index, DEFAULT_FONT_SIZE); - wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), &format); +/* wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), &format); */ -/* if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, */ -/* (gpointer) wp_get_font_size_index (new_size_index, 12))) */ -/* wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body)); */ + if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, + (gpointer) wp_get_font_size_index (new_size_index, 12))) + wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body)); text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window)); markup = g_strconcat ("", gtk_label_get_text (GTK_LABEL (label)), "", NULL); @@ -2517,7 +2523,8 @@ remove_attachment_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *edi hildon_banner_show_information (NULL, NULL, _("mcen_ib_unable_to_display_more")); else if (n_att_selected == 0) hildon_banner_show_information (NULL, NULL, _("TODO: select one attachment")); - + else + hildon_banner_show_information (NULL, NULL, _("mail_ib_unable_to_purge_attachments")); } static void @@ -2927,3 +2934,5 @@ modest_msg_edit_window_set_sent (ModestMsgEditWindow *window, priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window); priv->sent = sent; } + +