* src/maemo/modest-msg-edit-window.c:
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 20 Sep 2007 20:00:06 +0000 (20:00 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 20 Sep 2007 20:00:06 +0000 (20:00 +0000)
        * Now, when we set the file format to html using the
          modest_msg_edit_window_set_file_format, we remove all
          the tags, so that the text is shown again with the default
          font (fixes NB#63647).

pmo-trunk-r3380

src/maemo/modest-msg-edit-window.c

index 64c5759..a397436 100644 (file)
@@ -150,7 +150,9 @@ static gboolean gtk_text_iter_forward_search_insensitive (const GtkTextIter *ite
                                                          const gchar *str,
                                                          GtkTextIter *match_start,
                                                          GtkTextIter *match_end);
-                                                         
+
+static void remove_tags (WPTextBuffer *buffer);
+
 static void DEBUG_BUFFER (WPTextBuffer *buffer)
 {
 #ifdef DEBUG
@@ -2391,6 +2393,7 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
                switch (file_format) {
                case MODEST_FILE_FORMAT_FORMATTED_TEXT:
                        wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), TRUE);
+                       remove_tags (WP_TEXT_BUFFER (priv->text_buffer));
                        break;
                case MODEST_FILE_FORMAT_PLAIN_TEXT:
                {
@@ -3164,3 +3167,13 @@ modest_msg_edit_window_get_child_widget (ModestMsgEditWindow *win,
        }
 }
 
+static void 
+remove_tags (WPTextBuffer *buffer)
+{
+       GtkTextIter start, end;
+
+       gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start);
+       gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end);
+
+       gtk_text_buffer_remove_all_tags (GTK_TEXT_BUFFER (buffer), &start, &end);
+}