2004-11-12 [paul] 0.9.12cvs146.4
[claws.git] / src / mimeview.c
index edd792609c6ac0dc21a6120193bc908aab4e47fd..2632f05301b33fc60ed709304f02bdb012fc3136 100644 (file)
@@ -429,7 +429,7 @@ static GtkCTreeNode *mimeview_append_part(MimeView *mimeview,
        gchar *str[N_MIMEVIEW_COLS];
 
        if (partinfo->type != MIMETYPE_UNKNOWN && partinfo->subtype) {
-               g_snprintf(content_type, 64, "%s/%s", procmime_get_type_str(partinfo->type), partinfo->subtype);
+               g_snprintf(content_type, 64, "%s/%s", procmime_get_media_type_str(partinfo->type), partinfo->subtype);
        } else {
                g_snprintf(content_type, 64, "UNKNOWN");
        }
@@ -532,7 +532,7 @@ static MimeViewer *get_viewer_for_mimeinfo(MimeView *mimeview, MimeInfo *partinf
        MimeViewer *viewer = NULL;
 
        if ((partinfo->type == MIMETYPE_APPLICATION) &&
-            (!g_strcasecmp(partinfo->subtype, "octet-stream"))) {
+            (!g_ascii_strcasecmp(partinfo->subtype, "octet-stream"))) {
                const gchar *filename;
 
                filename = procmime_mimeinfo_get_parameter(partinfo, "filename");
@@ -823,7 +823,7 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
                                           "/Display as text", TRUE);
                if (partinfo &&
                    partinfo->type == MIMETYPE_APPLICATION &&
-                   !g_strcasecmp(partinfo->subtype, "octet-stream"))
+                   !g_ascii_strcasecmp(partinfo->subtype, "octet-stream"))
                        menu_set_sensitive(mimeview->popupfactory,
                                           "/Open", FALSE);
                else
@@ -967,7 +967,7 @@ static void mimeview_drag_data_get(GtkWidget            *widget,
                alertpanel_error
                        (_("Can't save the part of multipart message."));
 
-       uriname = g_strconcat("file:/", filename, NULL);
+       uriname = g_strconcat("file://", filename, NULL);
        gtk_selection_data_set(selection_data, selection_data->target, 8,
                               uriname, strlen(uriname));
 
@@ -1012,7 +1012,7 @@ static gboolean mimeview_write_part(const gchar *filename,
 {
        gchar *dir;
        
-       dir= g_dirname(filename);
+       dir= g_path_get_dirname(filename);
        if (!is_dir_exist(dir))
                make_dir_hier(dir);
        g_free(dir);
@@ -1058,7 +1058,7 @@ static void mimeview_save_all(MimeView *mimeview)
                startdir = g_strconcat(prefs_common.attach_save_dir,
                                       G_DIR_SEPARATOR_S, NULL);
 
-       dirname = filesel_select_file_open(_("Select destination folder"), startdir);
+       dirname = filesel_select_file_open_folder(_("Select destination folder"), startdir);
        if (!dirname) {
                if (startdir) g_free(startdir);
                return;
@@ -1074,6 +1074,15 @@ static void mimeview_save_all(MimeView *mimeview)
        if (dirname[strlen(dirname)-1] == G_DIR_SEPARATOR)
                dirname[strlen(dirname)-1] = '\0';
 
+       /* Skip the first part, that is sometimes DISPOSITIONTYPE_UNKNOWN */
+       if (partinfo && partinfo->type == MIMETYPE_MESSAGE)
+               partinfo = procmime_mimeinfo_next(partinfo);
+       if (partinfo && partinfo->type == MIMETYPE_MULTIPART) {
+               partinfo = procmime_mimeinfo_next(partinfo);
+               if (partinfo && partinfo->type == MIMETYPE_TEXT)
+                       partinfo = procmime_mimeinfo_next(partinfo);
+       }
+               
        while (partinfo != NULL) {
                if (partinfo->type != MIMETYPE_MESSAGE &&
                    partinfo->type != MIMETYPE_MULTIPART &&
@@ -1138,7 +1147,7 @@ static void mimeview_save_as(MimeView *mimeview)
 
        mimeview_write_part(filename, partinfo);
 
-       filedir = g_dirname(filename);
+       filedir = g_path_get_dirname(filename);
        if (filedir && strcmp(filedir, ".")) {
                if (prefs_common.attach_save_dir)
                        g_free(prefs_common.attach_save_dir);
@@ -1264,7 +1273,7 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
                cmd = cmdline;
                def_cmd = NULL;
        } else if (MIMETYPE_APPLICATION == partinfo->type &&
-                  !g_strcasecmp(partinfo->subtype, "octet-stream")) {
+                  !g_ascii_strcasecmp(partinfo->subtype, "octet-stream")) {
                return;
        } else if (MIMETYPE_IMAGE == partinfo->type) {
                cmd = prefs_common.mime_image_viewer;
@@ -1506,9 +1515,9 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
        switch (mimeinfo->type) {
                
        case MIMETYPE_TEXT:
-               if (mimeinfo->subtype && !g_strcasecmp(mimeinfo->subtype, "html"))
+               if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "html"))
                        stockp = STOCK_PIXMAP_MIME_TEXT_HTML;
-               else if  (mimeinfo->subtype && !g_strcasecmp(mimeinfo->subtype, "enriched"))
+               else if  (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "enriched"))
                        stockp = STOCK_PIXMAP_MIME_TEXT_ENRICHED;
                else
                        stockp = STOCK_PIXMAP_MIME_TEXT_PLAIN;