Included save_all patch from Xaview FACQ
authorThorsten Maerz <torte@netztorte.de>
Sun, 21 Jul 2002 16:06:50 +0000 (16:06 +0000)
committerThorsten Maerz <torte@netztorte.de>
Sun, 21 Jul 2002 16:06:50 +0000 (16:06 +0000)
ChangeLog.claws
TODO.claws
configure.in
src/mimeview.c

index 596fc56..1a82037 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-21 [thorsten]  0.7.8claws89
+
+       * src/mimeview.c
+               Included save_all patch from Xaview FACQ
+               added support for pathnames
+
+       
 2002-07-21 [alfons]    0.7.8claws88
 
        * po/POTFILES.in
index e0784af..b068037 100644 (file)
          Hiro to accept the new system too)
        o fix processing, summaryview still uses old list of
          messages with messages deleted or moved by processing
+
+[thorsten]
+       
+0.8.0claws+
+       o common dialog for save / save all attachments
+
+win32 0.8.0claws+
+       o LDAP support
+       o Pspell support
+       o implement pipe actions
+       o fix addrbook crash
+       o review utf8 conversions for mem leaks
+       ? imap : use buffer instead of MSG_PEEK
index dce7067..2580604 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws88
+EXTRA_VERSION=claws89
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 4111804..2fe0fea 100644 (file)
@@ -102,6 +102,7 @@ static void mimeview_drag_data_get      (GtkWidget    *widget,
 static void mimeview_display_as_text   (MimeView       *mimeview);
 static void mimeview_show_image                (MimeView       *mimeview);
 static void mimeview_save_as           (MimeView       *mimeview);
+static void mimeview_save_all          (MimeView       *mimeview);
 static void mimeview_launch            (MimeView       *mimeview);
 static void mimeview_open_with         (MimeView       *mimeview);
 static void mimeview_view_file         (const gchar    *filename,
@@ -117,7 +118,8 @@ static GtkItemFactoryEntry mimeview_popup_entries[] =
        {N_("/Open _with..."),    NULL, mimeview_open_with,       0, NULL},
        {N_("/_Display as text"), NULL, mimeview_display_as_text, 0, NULL},
        {N_("/_Display image"),   NULL, mimeview_show_image,      0, NULL},
-       {N_("/_Save as..."),      NULL, mimeview_save_as,         0, NULL}
+       {N_("/_Save as..."),      NULL, mimeview_save_as,         0, NULL},
+       {N_("/Save _all..."),     NULL, mimeview_save_all,        0, NULL}
 #if USE_GPGME
         ,
         {N_("/_Check signature"), NULL, mimeview_check_signature, 0, NULL}
@@ -790,6 +792,66 @@ static void mimeview_drag_data_get(GtkWidget           *widget,
        g_free(filename);
 }
 
+static void mimeview_save_all(MimeView *mimeview)
+{
+       gchar *dirname;
+       gchar *defname = NULL;
+       MimeInfo *partinfo;
+       MimeInfo *attachment;
+       gchar buf[1024];
+
+       if (!mimeview->opened) return;
+       if (!mimeview->file) return;
+
+       partinfo = gtk_ctree_node_get_row_data
+               (GTK_CTREE(mimeview->ctree), mimeview->opened);
+
+       g_return_if_fail(partinfo != NULL);
+
+       dirname = filesel_select_file(_("Save as"), defname);
+
+       if (!dirname) return;
+
+       /* return to first children */
+       attachment = partinfo->parent->children->next;
+
+       /* for each attachment, extract it in the selected dir. */
+       while(attachment != NULL)
+       {
+               if(attachment->filename)
+               {
+                       gchar *attachname = g_strdup(attachment->filename);
+
+                       subst_chars(attachname, "/\\", G_DIR_SEPARATOR);
+                       subst_chars(attachname, ":?*&|<>\t\r\n", '_');
+                       g_snprintf(buf, sizeof(buf), "%s%s",
+                                       dirname,
+                                       (attachname[0] == G_DIR_SEPARATOR)
+                                       ? &attachname[1]
+                                       : attachname );
+                       g_free(attachname);
+                       make_dir_hier(g_dirname(buf));
+
+                       if (is_file_exist(buf))
+                       {
+                               AlertValue aval;
+
+                               aval = alertpanel(_("Overwrite"),
+                                               _("Overwrite existing file?"),
+                                               _("OK"), _("Cancel"), NULL);
+
+                               if (G_ALERTDEFAULT != aval) return;
+                       }
+
+                       if (procmime_get_part(buf, mimeview->file, attachment) < 0)
+                               alertpanel_error
+                                       (_("Can't save the part of multipart message."));
+               }
+
+               attachment = attachment->next;
+       }
+}
+
 static void mimeview_display_as_text(MimeView *mimeview)
 {
        MimeInfo *partinfo;