Remove inclusion of sys/socket.h from nntp-thread.c
[claws.git] / src / plugins / archive / archiver.c
blob8110ce536ad8a411bdc1686cd4744710a8094df4
1 /* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
3 /*
4 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
5 * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
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.
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.
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/>.
22 #ifdef HAVE_CONFIG_H
23 # include "config.h"
24 #include "claws-features.h"
25 #endif
27 #include <glib.h>
28 #include <glib/gi18n.h>
30 #include <gtk/gtk.h>
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"
43 #include <archive.h>
45 #define PLUGIN_NAME (_("Mail Archiver"))
47 static void create_archive_cb(GtkAction *action, gpointer data) {
49 debug_print("Call-back function called\n");
51 archiver_gtk_show();
54 static GtkActionEntry archiver_main_menu[] = {{
55 "Tools/CreateArchive",
56 NULL, N_("Create Archive..."), NULL, NULL, G_CALLBACK(create_archive_cb)
57 }};
59 static gint main_menu_id = 0;
60 static char *plugin_description = NULL;
62 gint plugin_init(gchar** error)
64 MainWindow *mainwin = mainwindow_get_mainwindow();
66 if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,4,0,65),
67 VERSION_NUMERIC, PLUGIN_NAME, error))
68 return -1;
70 gtk_action_group_add_actions(mainwin->action_group, archiver_main_menu,
71 1, (gpointer)mainwin);
72 MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateArchive",
73 "Tools/CreateArchive", GTK_UI_MANAGER_MENUITEM,
74 main_menu_id)
76 archiver_prefs_init();
78 debug_print("archive plugin loaded\n");
80 return 0;
83 gboolean plugin_done(void)
85 MainWindow *mainwin = mainwindow_get_mainwindow();
87 if (mainwin == NULL)
88 return FALSE;
90 MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "Tools/CreateArchive", main_menu_id);
91 main_menu_id = 0;
93 if (plugin_description != NULL) {
94 g_free(plugin_description);
95 plugin_description = NULL;
98 archiver_prefs_done();
99 debug_print("archive plugin unloaded\n");
101 return TRUE;
104 const gchar* plugin_licence(void) {
105 return "GPL3+";
108 const gchar* plugin_version(void) {
109 return VERSION;
112 const gchar* plugin_type(void) {
113 return "GTK3";
116 const gchar* plugin_name(void) {
117 return PLUGIN_NAME;
120 const gchar* plugin_desc(void) {
121 if (plugin_description == NULL) {
123 plugin_description = g_strdup_printf(_("This plugin adds archiving features to Claws Mail.\n"
124 "\n"
125 "It enables you to select a mail folder that you want "
126 "to be archived, and then choose a name, format and "
127 "location for the archive. Subfolders can be included "
128 "and MD5 checksums can be added for each file in the "
129 "archive. Several archiving options are also available.\n"
130 "\n"
131 "The archive can be stored as:\n%s"
132 "\n"
133 "The archive can be compressed using:\n%s"
134 "\n"
135 "The archives can be restored with any standard tool "
136 "that supports the chosen format and compression.\n"
137 "\n"
138 "The supported folder types are MH, IMAP, RSSyl and "
139 "vCalendar.\n"
140 "\n"
141 "To activate the archiving feature go to /Tools/Create Archive\n"
142 "\n"
143 "Default options can be set in /Configuration/Preferences/Plugins"
144 "/Mail Archiver"),
146 /* archive formats (untranslated, libarchive-version dependant) */
147 "\tTAR\n\tPAX\n\tSHAR\n\tCPIO\n",
149 /* compression formats (untranslated, libarchive-version dependant) */
150 "\tGZIP\n\tBZIP2\n\tCOMPRESS\n"
151 #if ARCHIVE_VERSION_NUMBER >= 2006990
152 "\tLZMA\n\tXZ\n"
153 #endif
154 #if ARCHIVE_VERSION_NUMBER >= 3000000
155 "\tLZIP\n"
156 #endif
157 #if ARCHIVE_VERSION_NUMBER >= 3001000
158 "\tLRZIP\n\tLZOP\n\tGRZIP\n"
159 #endif
160 #if ARCHIVE_VERSION_NUMBER >= 3001900
161 "\tLZ4\n"
162 #endif
165 return plugin_description;
168 struct PluginFeature* plugin_provides(void) {
169 static struct PluginFeature features[] =
170 { {PLUGIN_UTILITY, N_("Archiver")},
171 {PLUGIN_NOTHING, NULL} };
172 return features;