RSSyl: Allow use of .netrc by libcurl. Bug/enhancement #3309, by Vincent Pelletier
[claws.git] / src / plugins / archive / archiver.c
1 /* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
2
3 /*
4  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
5  * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  * 
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #  include "config.h"
24 #include "claws-features.h"
25 #endif
26
27 #include <glib.h>
28 #include <glib/gi18n.h>
29
30 #include <gtk/gtk.h>
31
32 #include "common/claws.h"
33 #include "common/version.h"
34 #include "plugin.h"
35 #include "mimeview.h"
36 #include "utils.h"
37 #include "alertpanel.h"
38 #include "statusbar.h"
39 #include "archiver.h"
40 #include "archiver_prefs.h"
41 #include "menu.h"
42
43 #define PLUGIN_NAME (_("Mail Archiver"))
44
45 static void create_archive_cb(GtkAction *action, gpointer data) {
46
47         debug_print("Call-back function called\n");
48         
49         archiver_gtk_show();
50 }
51
52 static GtkActionEntry archiver_main_menu[] = {{
53         "Tools/CreateArchive",
54         NULL, N_("Create Archive..."), NULL, NULL, G_CALLBACK(create_archive_cb)
55 }};
56
57 static gint main_menu_id = 0;
58 static char *plugin_description = NULL;
59
60 gint plugin_init(gchar** error)
61 {
62         MainWindow *mainwin = mainwindow_get_mainwindow();
63
64         if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,4,0,65),
65                                 VERSION_NUMERIC, PLUGIN_NAME, error))
66                 return -1;
67
68         gtk_action_group_add_actions(mainwin->action_group, archiver_main_menu,
69                         1, (gpointer)mainwin);
70         MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateArchive", 
71                           "Tools/CreateArchive", GTK_UI_MANAGER_MENUITEM,
72                           main_menu_id)
73
74         archiver_prefs_init();
75
76         debug_print("archive plugin loaded\n");
77
78         return 0;
79 }
80
81 gboolean plugin_done(void)
82 {
83         MainWindow *mainwin = mainwindow_get_mainwindow();
84
85         if (mainwin == NULL)
86                 return FALSE;
87
88         MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "Tools/CreateArchive", main_menu_id);
89         main_menu_id = 0;
90
91         if (plugin_description != NULL) {
92                 g_free(plugin_description);
93                 plugin_description = NULL;
94         }
95
96         archiver_prefs_done();
97         debug_print("archive plugin unloaded\n");
98
99         return TRUE;
100 }
101
102 const gchar* plugin_licence(void) {
103         return "GPL3+";
104 }
105
106 const gchar* plugin_version(void) {
107         return VERSION;
108 }
109
110 const gchar* plugin_type(void) {
111         return "GTK2";
112 }
113
114 const gchar* plugin_name(void) {
115         return PLUGIN_NAME;
116 }
117
118 #if NEW_ARCHIVE_API
119 #define ARCHIVER_COMPRESS_FORMATS "\tGZIP/ZIP\n\tBZIP2\n\tCOMPRESS\n"
120 #else
121 #define ARCHIVER_COMPRESS_FORMATS "\tGZIP/ZIP\n\tBZIP2\n"
122 #endif
123
124 const gchar* plugin_desc(void) {
125         if (plugin_description == NULL) {
126                 plugin_description = g_strdup_printf(_("This plugin adds archiving features to Claws Mail.\n"
127                         "\n"
128                         "It enables you to select a mail folder that you want "
129                         "to be archived, and then choose a name, format and "
130                         "location for the archive. Subfolders can be included "
131                         "and MD5 checksums can be added for each file in the "
132                         "archive. Several archiving options are also available.\n"
133                         "\n"
134                         "The archive can be stored as:\n"
135                         "\tTAR\n\tPAX\n\tSHAR\n\tCPIO\n"
136                         "\n"
137                         "The archive can be compressed using:\n%s"
138                         "\n"
139                         "The archives can be restored with any standard tool "
140                         "that supports the chosen format and compression.\n"
141                         "\n"
142                         "The supported folder types are MH, IMAP, RSSyl and "
143                         "vCalendar.\n"
144                         "\n"
145                         "To activate the archiving feature go to /Tools/Create Archive\n"
146                         "\n"
147                         "Default options can be set in /Configuration/Preferences/Plugins"
148                         "/Mail Archiver"
149                         ), ARCHIVER_COMPRESS_FORMATS);
150         }
151         return plugin_description;
152 }
153
154 struct PluginFeature* plugin_provides(void) {
155         static struct PluginFeature features[] =
156         { {PLUGIN_UTILITY, N_("Archiver")},
157           {PLUGIN_NOTHING, NULL} };
158         return features;
159 }