From b6d032573604eedf7e2be9fa1c940272feaeb516 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Wed, 19 Jan 2005 10:53:22 +0000 Subject: [PATCH] 2005-01-19 [colin] 1.0.0cvs2.1 * src/mbox.c * src/mbox.h * src/mainwindow.c * src/summaryview.c * src/summaryview.h Sync with HEAD --- ChangeLog-gtk2.claws | 9 +++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/mainwindow.c | 12 ++++++++++++ src/mbox.c | 37 +++++++++++++++++++++++-------------- src/mbox.h | 2 ++ src/summaryview.c | 15 +++++++++++++++ src/summaryview.h | 2 +- 8 files changed, 64 insertions(+), 16 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index b33af81b9..1f73847ad 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,12 @@ +2005-01-19 [colin] 1.0.0cvs2.1 + + * src/mbox.c + * src/mbox.h + * src/mainwindow.c + * src/summaryview.c + * src/summaryview.h + Sync with HEAD + 2005-01-19 [paul] 1.0.0cvs1.1 * configure.ac diff --git a/PATCHSETS b/PATCHSETS index 48f995726..3b62607de 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -326,3 +326,4 @@ ( cvs diff -u -r 1.30.2.8 -r 1.30.2.9 src/prefs_toolbar.c; cvs diff -u -r 1.4.2.6 -r 1.4.2.7 src/prefs_fonts.c; cvs diff -u -r 1.60.2.9 -r 1.60.2.10 src/prefs_actions.c; ) > 0.9.13cvs36.3.patchset ( cvs diff -u -r 1.26.2.9 -r 1.26.2.10 src/foldersel.c; ) > 1.0.0cvs0.1.patchset ( cvs diff -u -r 1.654.2.360 -r 1.654.2.361 configure.ac; cvs diff -u -r 1.58.2.5 -r 1.58.2.6 po/de.po; cvs diff -u -r 1.60.2.6 -r 1.60.2.7 po/es.po; cvs diff -u -r 1.42.2.6 -r 1.42.2.7 po/fr.po; cvs diff -u -r 1.7.2.3 -r 1.7.2.4 po/hr.po; cvs diff -u -r 1.34.2.5 -r 1.34.2.6 po/it.po; cvs diff -u -r 1.16.2.4 -r 1.16.2.5 po/ja.po; cvs diff -u -r 1.8.2.2 -r 1.8.2.3 po/ko.po; cvs diff -u -r 1.50.2.4 -r 1.50.2.5 po/pt_BR.po; cvs diff -u -r 1.17.2.3 -r 1.17.2.4 po/ru.po; cvs diff -u -r 1.2.2.7 -r 1.2.2.8 po/sk.po; cvs diff -u -r 1.17.2.7 -r 1.17.2.8 po/sr.po; ) > 1.0.0cvs1.1.patchset +( cvs diff -u -r 1.274.2.26 -r 1.274.2.27 src/mainwindow.c; cvs diff -u -r 1.28.2.2 -r 1.28.2.3 src/mbox.c; cvs diff -u -r 1.3.2.2 -r 1.3.2.3 src/mbox.h; cvs diff -u -r 1.395.2.41 -r 1.395.2.42 src/summaryview.c; cvs diff -u -r 1.68.2.4 -r 1.68.2.5 src/summaryview.h; ) > 1.0.0cvs2.1.patchset diff --git a/configure.ac b/configure.ac index fac341ae3..09de9b425 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=0 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=1 +EXTRA_VERSION=2 EXTRA_RELEASE= EXTRA_GTK2_VERSION=.1 diff --git a/src/mainwindow.c b/src/mainwindow.c index c7efcaa3c..33b7fca34 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -160,6 +160,9 @@ static void import_mbox_cb (MainWindow *mainwin, static void export_mbox_cb (MainWindow *mainwin, guint action, GtkWidget *widget); +static void export_list_mbox_cb (MainWindow *mainwin, + guint action, + GtkWidget *widget); static void empty_trash_cb (MainWindow *mainwin, guint action, GtkWidget *widget); @@ -444,6 +447,8 @@ static GtkItemFactoryEntry mainwin_entries[] = {N_("/_File/---"), NULL, NULL, 0, ""}, {N_("/_File/_Import mbox file..."), NULL, import_mbox_cb, 0, NULL}, {N_("/_File/_Export to mbox file..."), NULL, export_mbox_cb, 0, NULL}, + {N_("/_File/_Export selected to mbox file..."), + NULL, export_list_mbox_cb, 0, NULL}, {N_("/_File/---"), NULL, NULL, 0, ""}, {N_("/_File/Empty all _Trash folders"), "D", empty_trash_cb, 0, NULL}, {N_("/_File/---"), NULL, NULL, 0, ""}, @@ -1996,6 +2001,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type) if (prefs_common.folderview_visible) gtk_widget_show(folderwin); } + if (type & SEPARATE_MESSAGE) { messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(messagewin), @@ -2371,6 +2377,12 @@ static void export_mbox_cb(MainWindow *mainwin, guint action, export_mbox(mainwin->summaryview->folder_item); } +static void export_list_mbox_cb(MainWindow *mainwin, guint action, + GtkWidget *widget) +{ + summaryview_export_mbox_list(mainwin->summaryview); +} + static void empty_trash_cb(MainWindow *mainwin, guint action, GtkWidget *widget) { diff --git a/src/mbox.c b/src/mbox.c index 4527a3e52..a28724f1e 100644 --- a/src/mbox.c +++ b/src/mbox.c @@ -365,30 +365,19 @@ void empty_mbox(const gchar *mbox) fclose(fp); } -/* read all messages in SRC, and store them into one MBOX file. */ -gint export_to_mbox(FolderItem *src, const gchar *mbox) +gint export_list_to_mbox(GSList *mlist, const gchar *mbox) { - GSList *mlist; GSList *cur; MsgInfo *msginfo; FILE *msg_fp; FILE *mbox_fp; gchar buf[BUFFSIZE]; - g_return_val_if_fail(src != NULL, -1); - g_return_val_if_fail(src->folder != NULL, -1); - g_return_val_if_fail(mbox != NULL, -1); - - debug_print("Exporting messages from %s into %s...\n", - src->path, mbox); - if ((mbox_fp = fopen(mbox, "wb")) == NULL) { FILE_OP_ERROR(mbox, "fopen"); return -1; } - mlist = folder_item_get_msg_list(src); - for (cur = mlist; cur != NULL; cur = cur->next) { msginfo = (MsgInfo *)cur->data; @@ -418,10 +407,30 @@ gint export_to_mbox(FolderItem *src, const gchar *mbox) fclose(msg_fp); procmsg_msginfo_free(msginfo); } + + fclose(mbox_fp); - g_slist_free(mlist); + return 0; +} - fclose(mbox_fp); +/* read all messages in SRC, and store them into one MBOX file. */ +gint export_to_mbox(FolderItem *src, const gchar *mbox) +{ + GSList *mlist; + int res = 0; + + g_return_val_if_fail(src != NULL, -1); + g_return_val_if_fail(src->folder != NULL, -1); + g_return_val_if_fail(mbox != NULL, -1); + + debug_print("Exporting messages from %s into %s...\n", + src->path, mbox); + + mlist = folder_item_get_msg_list(src); + + export_list_to_mbox(mlist, mbox); + + g_slist_free(mlist); return 0; } diff --git a/src/mbox.h b/src/mbox.h index ef3c6a12e..3e72c2266 100644 --- a/src/mbox.h +++ b/src/mbox.h @@ -47,5 +47,7 @@ void empty_mbox (const gchar *mbox); gint export_to_mbox (FolderItem *src, const gchar *mbox); +gint export_list_to_mbox(GSList *mlist, + const gchar *mbox); #endif /* __MBOX_H__ */ diff --git a/src/summaryview.c b/src/summaryview.c index f1ac05f8e..8e34478cc 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -5346,3 +5346,18 @@ static void summary_find_answers (SummaryView *summaryview, MsgInfo *msg) if (node) summary_select_node(summaryview, node, TRUE, TRUE); } + +void summaryview_export_mbox_list(SummaryView *summaryview) +{ + GSList *list = summary_get_selected_msg_list(summaryview); + gchar *mbox = filesel_select_file_save(_("Export to mbox file"), NULL); + + if (mbox == NULL || list == NULL) + return; + + export_list_to_mbox(list, mbox); + + g_slist_free(list); + g_free(mbox); + +} diff --git a/src/summaryview.h b/src/summaryview.h index f613521c5..93781a8fb 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -278,5 +278,5 @@ void summary_set_prefs_from_folderitem (SummaryView *summaryview, FolderItem *item); void summary_save_prefs_to_folderitem (SummaryView *summaryview, FolderItem *item); - +void summaryview_export_mbox_list (SummaryView *summaryview); #endif /* __SUMMARY_H__ */ -- 2.25.1