* src/maemo/modest-msg-edit-window.c:
[modest] / src / maemo / modest-msg-edit-window.c
index 418638b..04b467d 100644 (file)
@@ -1013,19 +1013,25 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type, guint64 *stream_s
 
        tny_stream_reset (TNY_STREAM (stream));
        while (!tny_stream_is_eos (TNY_STREAM (stream))) {
+               GError *error = NULL;
                unsigned char read_buffer[128];
                gint readed;
                readed = tny_stream_read (TNY_STREAM (stream), (char *) read_buffer, 128);
                size += readed;
-               if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, NULL))
+               if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, &error)) {
                        break;
+               }
        }
 
        pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-       g_object_ref (pixbuf);
+       if (pixbuf) 
+               g_object_ref (pixbuf);
        gdk_pixbuf_loader_close (loader, NULL);
        g_object_unref (loader);
 
+       if (!pixbuf)
+               return NULL;
+
        if (gdk_pixbuf_get_width (pixbuf) > IMAGE_MAX_WIDTH) {
                GdkPixbuf *new_pixbuf;
                gint new_height;
@@ -1058,7 +1064,7 @@ replace_with_images (ModestMsgEditWindow *self, TnyList *attachments)
                const gchar *mime_type = tny_mime_part_get_content_type (part);
                if ((cid != NULL)&&(mime_type != NULL)) {
                        guint64 stream_size;
-                       TnyStream *stream = tny_mime_part_get_stream (part);
+                       TnyStream *stream = tny_mime_part_get_decoded_stream (part);
                        GdkPixbuf *pixbuf = pixbuf_from_stream (stream, mime_type, &stream_size);
 
 
@@ -1555,7 +1561,6 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre
        g_object_unref (menu_rules_group);
        g_object_unref (toolbar_rules_group);
        g_object_unref (clipboard_rules_group);
-       gtk_widget_show_all (GTK_WIDGET (obj));
        modest_msg_edit_window_clipboard_owner_change (NULL, NULL, MODEST_MSG_EDIT_WINDOW (obj));
 
        set_msg (MODEST_MSG_EDIT_WINDOW (obj), msg, preserve_is_rich);
@@ -1949,13 +1954,13 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo
        switch (buffer_format->justification)
        {
        case GTK_JUSTIFY_LEFT:
-               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentLeftMenu");
+               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentMenu/AlignmentLeftMenu");
                break;
        case GTK_JUSTIFY_CENTER:
-               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentCenterMenu");
+               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentMenu/AlignmentCenterMenu");
                break;
        case GTK_JUSTIFY_RIGHT:
-               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentRightMenu");
+               action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentMenu/AlignmentRightMenu");
                break;
        default:
                break;