]> git.datanom.net - vfolder.git/blob - src/vfolder_init.c
initial upload
[vfolder.git] / src / vfolder_init.c
1 /*
2 * $Id: $
3 */
4 /* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
5
6 /*
7 * Virtual folder plugin for claws-mail
8 *
9 * Claws Mail is Copyright (C) 1999-2012 by the Claws Mail Team
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 *
24 */
25
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29
30 #include "gettext.h"
31 #include <gtk/gtk.h>
32
33 #include "common/claws.h"
34 #include "common/version.h"
35 #include "plugin.h"
36 #include "mimeview.h"
37 #include "utils.h"
38 #include "alertpanel.h"
39 #include "statusbar.h"
40 #include "menu.h"
41 #include "vfolder.h"
42 #include "vfolder_gtk.h"
43
44 #define PLUGIN_NAME (_("VFolder"))
45
46 static GtkActionEntry vfolder_main_menu[] = {{
47 "View/CreateVfolder",
48 NULL, N_("Create virtual folder..."),
49 "<Control>v", N_("Create a virtual folder"),
50 G_CALLBACK(vfolder_new_folder_cb)
51 }};
52
53 static gint main_menu_id = 0;
54
55 gint plugin_init(gchar** error) {
56 debug_set_mode(TRUE);
57 MainWindow *mainwin = mainwindow_get_mainwindow();
58
59 #ifdef G_OS_UNIX
60 bindtextdomain(TEXTDOMAIN, LOCALEDIR);
61 #else
62 bindtextdomain(TEXTDOMAIN, get_locale_dir());
63 #endif
64 bind_textdomain_codeset(TEXTDOMAIN, "UTF-8");
65
66 if (!check_plugin_version(MAKE_NUMERIC_VERSION(0,0,1,0),
67 VERSION_NUMERIC, PLUGIN_NAME, error))
68 return -1;
69
70 gtk_action_group_add_actions(mainwin->action_group, vfolder_main_menu,
71 1, (gpointer)mainwin);
72 MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/View", "CreateVfolder",
73 "View/CreateVfolder", GTK_UI_MANAGER_MENUITEM,
74 main_menu_id)
75
76 if (! vfolder_init()) {
77 debug_print("vfolder plugin unloading due to init errors\n");
78 plugin_done();
79 return -1;
80 }
81
82 debug_print("vfolder plugin loaded\n");
83
84 return 0;
85 }
86
87 gboolean plugin_done(void) {
88 MainWindow *mainwin = mainwindow_get_mainwindow();
89
90 vfolder_done();
91
92 if (mainwin == NULL)
93 return FALSE;
94
95 MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "View/CreateVfolder", main_menu_id);
96 main_menu_id = 0;
97
98 debug_print("vfolder plugin unloaded\n");
99
100 debug_set_mode(FALSE);
101 return TRUE;
102 }
103
104 const gchar* plugin_licence(void) {
105 return "GPL3+";
106 }
107
108 const gchar* plugin_version(void) {
109 return PLUGINVERSION;
110 }
111
112 const gchar* plugin_type(void) {
113 return "GTK2";
114 }
115
116 const gchar* plugin_name(void) {
117 return PLUGIN_NAME;
118 }
119
120 const gchar* plugin_desc(void) {
121 return _("This plugin adds virtual folder support to Claws Mail.\n"
122 "\n"
123 "1) Select one or more mail folder(s) to use as the basic mail pool\n"
124 "2) Define a filter\n"
125 "3) Specify name for virtual folder\n"
126 "4) Press create and wait until the scanning of the mail pool finishes\n"
127 "\n"
128 "The VFolder will be updated periodically and when claws-mail is initially opened\n"
129 "Manual update is available from the context menu of the VFolder.\n"
130 "\n"
131 "The supported folder types are MH and IMAP.\n"
132 "Messages in a VFolder cannot be updated.\n"
133 "\n"
134 "To activate the archiving feature go to /View/Create virtual folder\n"
135 "\n"
136 "Default options can be set in /Configuration/Preferences/Plugins"
137 "/vfolder"
138 );
139 }
140
141 struct PluginFeature* plugin_provides(void) {
142 static struct PluginFeature features[] =
143 { {PLUGIN_UTILITY, N_("VFolder")},
144 {PLUGIN_FOLDERCLASS, N_("VFolder")},
145 {PLUGIN_NOTHING, NULL} };
146 return features;
147 }
This page took 0.07593 seconds and 6 git commands to generate.