Factorize to make clearer
authorColin Leroy <colin@colino.net>
Fri, 2 May 2014 09:57:33 +0000 (11:57 +0200)
committerColin Leroy <colin@colino.net>
Fri, 2 May 2014 09:57:33 +0000 (11:57 +0200)
src/textview.c

index 37456df..d10485d 100644 (file)
@@ -631,38 +631,28 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
        cm_return_if_fail(mimeinfo != NULL);
        cm_return_if_fail(fp != NULL);
 
        cm_return_if_fail(mimeinfo != NULL);
        cm_return_if_fail(fp != NULL);
 
-       if ((mimeinfo->type == MIMETYPE_MULTIPART) ||
-           ((mimeinfo->type == MIMETYPE_MESSAGE) && !g_ascii_strcasecmp(mimeinfo->subtype, "rfc822"))) {
-               textview->loading = TRUE;
-               textview->stop_loading = FALSE;
-               
-               textview_clear(textview);
-               textview_add_parts(textview, mimeinfo);
-
-               textview->loading = FALSE;
-               textview->stop_loading = FALSE;
-               textview_set_position(textview, 0);
-
-               END_TIMING();
-               return;
-       }
        textview->loading = TRUE;
        textview->stop_loading = FALSE;
 
        textview->loading = TRUE;
        textview->stop_loading = FALSE;
 
-       if (fseek(fp, mimeinfo->offset, SEEK_SET) < 0)
-               perror("fseek");
-
        textview_clear(textview);
 
        textview_clear(textview);
 
-       if (mimeinfo->type == MIMETYPE_MULTIPART)
+       if ((mimeinfo->type == MIMETYPE_MULTIPART) ||
+           ((mimeinfo->type == MIMETYPE_MESSAGE) && !g_ascii_strcasecmp(mimeinfo->subtype, "rfc822"))) {
                textview_add_parts(textview, mimeinfo);
                textview_add_parts(textview, mimeinfo);
-       else
-               textview_write_body(textview, mimeinfo);
+       } else {
+               if (fseek(fp, mimeinfo->offset, SEEK_SET) < 0)
+                       perror("fseek");
+
+               if (mimeinfo->type == MIMETYPE_MULTIPART)
+                       textview_add_parts(textview, mimeinfo);
+               else
+                       textview_write_body(textview, mimeinfo);
+       }
 
        textview->loading = FALSE;
        textview->stop_loading = FALSE;
 
        textview->loading = FALSE;
        textview->stop_loading = FALSE;
-
        textview_set_position(textview, 0);
        textview_set_position(textview, 0);
+
        END_TIMING();
 }
 
        END_TIMING();
 }