[Users] Fix Maildir ++ plugin maildir-0.24.5 patch

root omb at teraflex-bp.dyndns.org
Fri May 10 02:55:27 CEST 2013


The attached patch file updates ClawsPlugins/maildir-0.24.4 from the
current, non working Maildir ++ plugin to (new 0.24.5) which works with
current gtk builds and, when loaded as a Claws plugin, enables the use
of Mdir mailboxes with which Claws can use, create and move messages.

This was part of my exit from Kmail 2.x.

I am not offering to maintain this but I will post any bug fixes to the
list. I work in git so this is:

cpommit: cac297897935723ec3a474ba57825a4ed90e3151

patch in line and as gziped attachment: SHA1

SHA1: 074fc5786545c1b81be2db1a7eae4e8d2c879532

====

diff --git a/config.h b/config.h
new file mode 100644
index 0000000..8be3e96
--- /dev/null
+++ b/config.h
@@ -0,0 +1,56 @@
+/* pluginconfig.h.  Generated from pluginconfig.h.in by configure.  */
+/* pluginconfig.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to detected Berkeley DB major version number */
+#define DBVERS 3
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the address where bug reports for this package should be
sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* plugin version */
+#define PLUGINVERSION "0.24.4"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
diff --git a/pluginconfig.h b/pluginconfig.h
new file mode 100644
index 0000000..8be3e96
--- /dev/null
+++ b/pluginconfig.h
@@ -0,0 +1,56 @@
+/* pluginconfig.h.  Generated from pluginconfig.h.in by configure.  */
+/* pluginconfig.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to detected Berkeley DB major version number */
+#define DBVERS 3
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the address where bug reports for this package should be
sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* plugin version */
+#define PLUGINVERSION "0.24.4"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
diff --git a/src/maildir.c b/src/maildir.c
index c7aa6d5..034e69c 100644
--- a/src/maildir.c
+++ b/src/maildir.c
@@ -97,6 +97,52 @@ struct _MaildirFolderItem
 	UIDDB *db;
 };
 
+// Plugin licence crap
+/*
+
+const gchar const *my_plugin_licence_tokens[] = {
+ "LGPL2.1+", "LGPLv2.1+", "LGPL2.1", "LGPLv2.1",
+ "LGPL3+", "LGPLv3+", "LGPL3", "LGPLv3",
+ "GPL3+", "GPLv3+", "GPL3", "GPLv3",
+ "GPL2+", "GPLv2+",
+ "Apache2.0", "Apache 2.0", "Apache v2.0",
+ "2-clause BSD", "Simplified BSD", "FreeBSD",
+ "3-clause BSD", "New BSD", "Modified BSD",
+ NULL
+};
+
+const gchar* plugin_licence(void) {
+	return "GPL3+";
+}
+
+const gchar* plugin_version(void) {
+	return "123.0";
+}
+
+const gchar* plugin_type(void) {
+	return "GTK2";
+}
+
+const gchar* plugin_name(void) {
+	return "maildir";
+}
+
+const gchar* plugin_desc(void) {
+	return ("This plugin adds archiving features to Claws Mail.\n"
+			"\n"
+			"It enables you to use maildir filders"
+			"Default options can be set
in /Configuration/Preferences/Plugins"
+			);
+}
+
+struct PluginFeature* plugin_provides(void) {
+	static struct PluginFeature features[] =
+	{ {PLUGIN_UTILITY, N_("Mailbox")},
+	  {PLUGIN_NOTHING, NULL} };
+	return features;
+}
+*/
+
 FolderClass *maildir_get_class()
 {
 	if (maildir_class.idstr == NULL) {
@@ -128,6 +174,7 @@ FolderClass *maildir_get_class()
 		maildir_class.copy_msg = maildir_copy_msg;
 		maildir_class.remove_msg = maildir_remove_msg;
 		maildir_class.change_flags = maildir_change_flags;
+		// XXXX
 		maildir_class.get_flags = maildir_get_flags;
 	}
 
@@ -241,11 +288,11 @@ static void build_tree(GNode *node, glob_t
*globbuf)
         for (i = 0; i < globbuf->gl_pathc; i++) {
 		FolderItem *newitem;
 		GNode *newnode;
-		const gchar *dirname, *foldername;
+		gchar *dirname, *foldername;
 		gchar *tmpstr, *dirname_utf8, *foldername_utf8;
 		gboolean res;
 
-		dirname = g_basename(globbuf->gl_pathv[i]);
+		dirname = g_path_get_basename(globbuf->gl_pathv[i]);
 		foldername = &(dirname[strlen(prefix) + 1]);
 
                 if (dirname[0] == '.' && dirname[1] == '\0')
@@ -305,6 +352,7 @@ static void build_tree(GNode *node, glob_t *globbuf)
 		}
 
                 build_tree(newitem->node, globbuf);
+			g_free(dirname);
         }
 
 	g_free(prefix);
@@ -1300,7 +1348,10 @@ static gint maildir_get_flags (Folder *folder,
FolderItem *item,
 
 		flags = flags | (msginfo->flags.perm_flags & 
 			~(MSG_MARKED | MSG_FORWARDED | MSG_REPLIED |
MSG_UNREAD | ((flags & MSG_UNREAD) == 0 ? MSG_NEW : 0)));
-		g_relation_insert(msgflags, msginfo,
GINT_TO_POINTER(flags));
+		// XXXX but no new API
+		// g_relation screwed up! OMB relation never
created ...
+		// commenting out the next line fixes the segfault but
needs more work. ??? no Falags XXXX
+		// g_relation_insert(msgflags, msginfo,
GINT_TO_POINTER(flags));
 
 		uiddb_free_msgdata(msgdata);
 	}
diff --git a/src/maildir_gtk.c b/src/maildir_gtk.c
index 64d61b6..d40c84d 100644
--- a/src/maildir_gtk.c
+++ b/src/maildir_gtk.c
@@ -38,106 +38,144 @@
 #include "maildir.h"
 #include "foldersel.h"
 #include "main.h"
+#include "summaryview.h"
 
-static void new_folder_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void delete_folder_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void rename_folder_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void move_folder_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void update_tree_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void remove_mailbox_cb(FolderView *folderview, guint action,
GtkWidget *widget);
-static void add_mailbox(gpointer callback_data, guint callback_action,
GtkWidget *widget);
+static void add_mailbox(GtkAction *action, gpointer callback_data);
+static void new_folder_cb(GtkAction *action, gpointer data);
+static void delete_folder_cb(GtkAction *action, gpointer data);
+static void rename_folder_cb(GtkAction *action, gpointer data);
+static void move_folder_cb(GtkAction *action, gpointer data);
+static void copy_folder_cb(GtkAction *action, gpointer data);
+static void update_tree_cb(GtkAction *action, gpointer data);
+static void remove_mailbox_cb(GtkAction *action, gpointer data);
 
-static GtkItemFactoryEntry maildir_popup_entries[] =
+
+// XXXX fix Separator
+static GtkActionEntry  maildir_popup_entries[] =
 {
-	{N_("/Create _new folder..."),	 NULL,
new_folder_cb,     0, NULL},
-	{N_("/---"),			 NULL, NULL,
0, "<Separator>"},
-	{N_("/_Rename folder..."),	 NULL, rename_folder_cb,  0,
NULL},
-	{N_("/M_ove folder..."), 	 NULL, move_folder_cb,    0,
NULL},
-	{N_("/Cop_y folder..."),	 NULL, move_folder_cb,    1,
NULL},
-	{N_("/---"),			 NULL, NULL,
0, "<Separator>"},
-	{N_("/_Delete folder"),		 NULL,
delete_folder_cb,  0, NULL},
-	{N_("/---"),			 NULL, NULL,
0, "<Separator>"},
-	{N_("/_Check for new messages"), NULL, update_tree_cb,    0,
NULL},
-	{N_("/C_heck for new folders"),  NULL, update_tree_cb,    1,
NULL},
-	{N_("/R_ebuild folder tree"),	 NULL, update_tree_cb,
2, NULL},
-	{N_("/---"),			 NULL, NULL,
		  0, "<Separator>"},
-	{N_("/Remove _mailbox"),	 NULL, remove_mailbox_cb, 0,
NULL},
-	{N_("/---"),			 NULL, NULL,
		  0, "<Separator>"},
+	{"FolderViewPopup/Create _new folder...",	 NULL,
N_("Create _new folder..."), NULL, NULL, G_CALLBACK(new_folder_cb) },
+	// {"FolderViewPopup/---"),			 NULL,
NULL,              0, "<Separator>"},
+	{"FolderViewPopup/_Rename folder...",	 NULL,
N_("_Rename folder..."), NULL, NULL, G_CALLBACK( rename_folder_cb) },
+	{"FolderViewPopup/M_ove folder...", 	 NULL,  N_("M_ove
folder..."), NULL, NULL, G_CALLBACK(move_folder_cb) },
+	{"FolderViewPopup/Cop_y folder...",	 NULL,  N_("M_ove
folder..."), NULL, NULL, G_CALLBACK(move_folder_cb) },
+	// {"FolderViewPopup/---",			 NULL,
NULL,              0, "<Separator>"},
+	{"FolderViewPopup/_Delete folder",		 NULL,
N_("_Delete folder..."), NULL, NULL, G_CALLBACK(delete_folder_cb) },
+	// {"FolderViewPopup/---"),			 NULL,
NULL,              0, "<Separator>"},
+	{"FolderViewPopup/_Check for new messages", NULL, N_("_Check
for new messages"), NULL, NULL, G_CALLBACK(update_tree_cb) },
+	{"FolderViewPopup/C_heck for new folders",  NULL, N_("_Check
for new messages"), NULL, NULL, G_CALLBACK(update_tree_cb) },
+	{"FolderViewPopup/R_ebuild folder tree",	 NULL,
N_("_Check for new messages"), NULL, NULL, G_CALLBACK(update_tree_cb) },
+	// {"FolderViewPopup/---"),			 NULL,
NULL, 		  0, "<Separator>"},
+	{"FolderViewPopup/Remove _mailbox",	 NULL, N_("Remove
_mailbox..."), NULL, NULL, G_CALLBACK(remove_mailbox_cb) },
+	// {"FolderViewPopup/---"),			 NULL,
NULL, 		  0, "<Separator>"},
 };
 
-static void set_sensitivity(GtkItemFactory *factory, FolderItem *item);
+static void set_sensitivity(GtkUIManager *ui_manager, FolderItem
*item);
+
+static void add_menuitems(GtkUIManager *ui_manager, FolderItem *item)
+{
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"CreateNewFolder", "FolderViewPopup/CreateNewFolder",
GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"SeparatorMbox1", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"RenameFolder", "FolderViewPopup/RenameFolder", GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"MoveFolder", "FolderViewPopup/MoveFolder", GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"CopyFolder", "FolderViewPopup/CopyFolder", GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"SeparatorMbox2", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"DeleteFolder", "FolderViewPopup/DeleteFolder", GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"SeparatorMbox3", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"CheckNewMessages", "FolderViewPopup/CheckNewMessages",
GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"CheckNewFolders", "FolderViewPopup/CheckNewFolders",
GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"RebuildTree", "FolderViewPopup/RebuildTree", GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"SeparatorMbox4", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"RemoveMailbox", "FolderViewPopup/RemoveMailbox",
GTK_UI_MANAGER_MENUITEM)
+    MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup",
"SeparatorMbox5", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+}
 
 static FolderViewPopup maildir_popup =
 {
 	"maildir",
 	"<MaildirFolder>",
-	NULL,
+	maildir_popup_entries,
+	G_N_ELEMENTS(maildir_popup_entries),
+	NULL, 0,
+	NULL, 0, 0, NULL,
+	add_menuitems,
 	set_sensitivity
 };
 
-static GtkItemFactoryEntry mainwindow_add_mailbox = {
-	N_("/File/Add mailbox/Maildir++..."),
-	NULL, 
-	add_mailbox, 
-	0, 
-	NULL
-};
+static GtkActionEntry mainwindow_add_mailbox[] = {{
+    "File/AddMailbox/Mdir",
+    NULL, N_("Maildir++..."), NULL, NULL, G_CALLBACK(add_mailbox)
+}};
+
+static guint main_menu_id = 0;
 
-void maildir_gtk_init(void)
+gint maildir_gtk_init(void)
 {
 	guint i, n_entries;
 	GtkItemFactory *ifactory;
 	MainWindow *mainwin = mainwindow_get_mainwindow();
 
-	n_entries = sizeof(maildir_popup_entries) /
-		sizeof(maildir_popup_entries[0]);
-	for (i = 0; i < n_entries; i++)
-		maildir_popup.entries =
g_slist_append(maildir_popup.entries, &maildir_popup_entries[i]);
+	// n_entries = sizeof(maildir_popup_entries) /
sizeof(maildir_popup_entries[0]);
+	// for (i = 0; i < n_entries; i++) maildir_popup.entries =
g_slist_append(maildir_popup.entries, &maildir_popup_entries[i]);
 
 	folderview_register_popup(&maildir_popup);
 
-	ifactory = gtk_item_factory_from_widget(mainwin->menubar);
-	gtk_item_factory_create_item(ifactory,
&mainwindow_add_mailbox, mainwin, 1);
+	// ifactory = gtk_item_factory_from_widget(mainwin->menubar);
+	// gtk_item_factory_create_item(ifactory,
&mainwindow_add_mailbox, mainwin, 1);
+
+	gtk_action_group_add_actions(mainwin->action_group,
mainwindow_add_mailbox,
+            1, (gpointer)mainwin);
+	MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager,
"/Menu/File/AddMailbox", "Mdir",
+              "File/AddMailbox/Mdir", GTK_UI_MANAGER_MENUITEM,
+              main_menu_id)
+	fprintf(stderr, "maildir_gtk_init\n");
+	return 0;
 }
 
 void maildir_gtk_done(void)
 {
 	GtkItemFactory *ifactory;
 	MainWindow *mainwin = mainwindow_get_mainwindow();
-	GtkWidget *widget;
 	
 	if (mainwin == NULL || claws_is_exiting())
 		return;
 
 	folderview_unregister_popup(&maildir_popup);
 
-	ifactory = gtk_item_factory_from_widget(mainwin->menubar);
-	widget = gtk_item_factory_get_widget(ifactory,
mainwindow_add_mailbox.path);
-	gtk_widget_destroy(widget);
-	gtk_item_factory_delete_item(ifactory,
mainwindow_add_mailbox.path);
+
MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group,
"File/AddMailbox/RSSyl", main_menu_id);
+    main_menu_id = 0;
 }
 
-static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
+static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item)
 {
+    gboolean folder_is_normal =
+            item != NULL &&
+            item->stype == F_NORMAL &&
+            !folder_has_parent_of_type(item, F_OUTBOX) &&
+            !folder_has_parent_of_type(item, F_DRAFT) &&
+            !folder_has_parent_of_type(item, F_QUEUE) &&
+            !folder_has_parent_of_type(item, F_TRASH);
 #define SET_SENS(name, sens) \
-	menu_set_sensitive(factory, name, sens)
+	cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens)
 
-	SET_SENS("/Create new folder...",   item->stype != F_INBOX);
-	SET_SENS("/Rename folder...",       item->stype == F_NORMAL &&
folder_item_parent(item) != NULL);
-	SET_SENS("/Move folder...", 	    item->stype ==
F_NORMAL && folder_item_parent(item) != NULL);
-	SET_SENS("/Delete folder", 	    item->stype == F_NORMAL
&& folder_item_parent(item) != NULL);
-	SET_SENS("/Check for new messages", folder_item_parent(item)
== NULL);
-	SET_SENS("/Check for new folders",  folder_item_parent(item)
== NULL);
-	SET_SENS("/Rebuild folder tree",    folder_item_parent(item)
== NULL);
-	SET_SENS("/Remove mailbox",         folder_item_parent(item)
== NULL);
+	SET_SENS("FolderViewPopup/Create new folder...",
item->stype != F_INBOX);
+	SET_SENS("FolderViewPopup/Rename folder...",       item->stype
== F_NORMAL && folder_item_parent(item) != NULL);
+	SET_SENS("FolderViewPopup/Move folder...",
item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+	SET_SENS("FolderViewPopup/Delete folder",
item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+	SET_SENS("FolderViewPopup/Check for new messages",
folder_item_parent(item) == NULL);
+	SET_SENS("FolderViewPopup/Check for new folders",
folder_item_parent(item) == NULL);
+	SET_SENS("FolderViewPopup/Rebuild folder tree",
folder_item_parent(item) == NULL);
+	SET_SENS("FolderViewPopup/Remove mailbox",
folder_item_parent(item) == NULL);
 
 #undef SET_SENS
 }
 
-static void update_tree_cb(FolderView *folderview, guint action,
-			   GtkWidget *widget)
+#define DO_ACTION(name, act)  { if (!strcmp(a_name, name)) act; }
+
+static void update_tree_cb(GtkAction *action, gpointer data)
 {
+	FolderView *folderview = (FolderView *)data;
 	FolderItem *item;
+	const gchar *a_name = gtk_action_get_name(action);
 
 	item = folderview_get_selected_item(folderview);
 	g_return_if_fail(item != NULL);
@@ -146,19 +184,15 @@ static void update_tree_cb(FolderView
*folderview, guint action,
 
 	g_return_if_fail(item->folder != NULL);
 
-	if (action == 0)
-		folderview_check_new(item->folder);
-	else if (action == 1)
-		folderview_rescan_tree(item->folder, FALSE);
-	else if (action == 2)
-		folderview_rescan_tree(item->folder, TRUE);
+    DO_ACTION("FolderViewPopup/CheckNewMessages",
folderview_check_new(item->folder));
+    DO_ACTION("FolderViewPopup/CheckNewFolders",
folderview_rescan_tree(item->folder, FALSE));
+    DO_ACTION("FolderViewPopup/RebuildTree",
folderview_rescan_tree(item->folder, TRUE));
 }
 
-static void add_mailbox(gpointer callback_data, guint callback_action,
-                        GtkWidget *widget)
+static void add_mailbox(GtkAction *action, gpointer callback_data)
 {
 	MainWindow *mainwin = (MainWindow *) callback_data;
-	gchar *path;
+	gchar *path, *basename;
 	Folder *folder;
 
 	path = input_dialog(_("Add mailbox"),
@@ -172,9 +206,10 @@ static void add_mailbox(gpointer callback_data,
guint callback_action,
 		g_free(path);
 		return;
 	}
-	folder = folder_new(folder_get_class_from_string("maildir"), 
-			    !strcmp(path, "Mail") ? _("Mailbox") :
g_basename(path),
-			    path);
+	basename = g_path_get_basename(path);
+	folder = folder_new(folder_get_class_from_string("maildir"),
+                !strcmp(path, "Mail") ? _("Mailbox") : basename,
+                path);
 	g_free(path);
 
 
@@ -193,10 +228,10 @@ static void add_mailbox(gpointer callback_data,
guint callback_action,
 	return;
 }
 
-static void new_folder_cb(FolderView *folderview, guint action,
-		          GtkWidget *widget)
+static void new_folder_cb(GtkAction *action, gpointer data)
 {
-	GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+	FolderView *folderview = (FolderView *)data;
+	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 	FolderItem *item;
 	FolderItem *new_item;
 	gchar *new_folder;
@@ -205,7 +240,7 @@ static void new_folder_cb(FolderView *folderview,
guint action,
 
 	if (!folderview->selected) return;
 
-	item = gtk_ctree_node_get_row_data(ctree,
folderview->selected);
+	item = gtk_cmctree_node_get_row_data(ctree,
folderview->selected);
 	g_return_if_fail(item != NULL);
 	g_return_if_fail(item->folder != NULL);
 
@@ -245,8 +280,9 @@ static void new_folder_cb(FolderView *folderview,
guint action,
 	folder_write_list();
 }
 
-static void remove_mailbox_cb(FolderView *folderview, guint action,
GtkWidget *widget)
+static void remove_mailbox_cb(GtkAction *action, gpointer data)
 {
+	FolderView *folderview = (FolderView *)data;
 	GtkCTree *ctree = GTK_CTREE(folderview->ctree);
 	GtkCTreeNode *node;
 	FolderItem *item;
@@ -276,10 +312,10 @@ static void remove_mailbox_cb(FolderView
*folderview, guint action, GtkWidget *w
 	folder_destroy(item->folder);
 }
 
-static void delete_folder_cb(FolderView *folderview, guint action,
-			     GtkWidget *widget)
+static void delete_folder_cb(GtkAction *action, gpointer data)
 {
-	GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+	FolderView *folderview = (FolderView *)data;
+	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 	FolderItem *item;
 	gchar *message, *name;
 	AlertValue avalue;
@@ -306,12 +342,12 @@ static void delete_folder_cb(FolderView
*folderview, guint action,
 	old_id = folder_item_get_identifier(item);
 
 	if (folderview->opened == folderview->selected ||
-	    gtk_ctree_is_ancestor(ctree,
-				  folderview->selected,
-				  folderview->opened)) {
-		summary_clear_all(folderview->summaryview);
-		folderview->opened = NULL;
-	}
+        gtk_cmctree_is_ancestor(ctree,
+                  folderview->selected,
+                  folderview->opened)) {
+        summary_clear_all(folderview->summaryview);
+        folderview->opened = NULL;
+    }
 
 	if (item->folder->klass->remove_folder(item->folder, item) <
0) {
 		alertpanel_error(_("Can't remove the folder `%s'."),
name);
@@ -329,24 +365,43 @@ static void delete_folder_cb(FolderView
*folderview, guint action,
 
 }
 
-static void move_folder_cb(FolderView *folderview, guint action,
GtkWidget *widget)
+static void move_folder_cb(GtkAction *action, gpointer data)
+{
+	FolderView *folderview = (FolderView *)data;
+	FolderItem *from_folder = NULL, *to_folder = NULL;
+
+	from_folder = folderview_get_selected_item(folderview);
+	if (!from_folder || from_folder->folder->klass !=
maildir_get_class())
+		return;
+
+	to_folder = foldersel_folder_sel(from_folder->folder,
FOLDER_SEL_MOVE, NULL, FALSE);
+	if (!to_folder)
+		return;
+
+	// folderview_move_folder(folderview, from_folder, to_folder,
action);
+	folderview_move_folder(folderview, from_folder, to_folder, 0);
+}
+
+static void copy_folder_cb(GtkAction *action, gpointer data)
 {
+	FolderView *folderview = (FolderView *)data;
 	FolderItem *from_folder = NULL, *to_folder = NULL;
 
 	from_folder = folderview_get_selected_item(folderview);
 	if (!from_folder || from_folder->folder->klass !=
maildir_get_class())
 		return;
 
-	to_folder = foldersel_folder_sel(from_folder->folder,
FOLDER_SEL_MOVE, NULL);
+	to_folder = foldersel_folder_sel(from_folder->folder,
FOLDER_SEL_MOVE, NULL, FALSE);
 	if (!to_folder)
 		return;
 
-	folderview_move_folder(folderview, from_folder, to_folder,
action);
+	// folderview_move_folder(folderview, from_folder, to_folder,
action);
+	folderview_move_folder(folderview, from_folder, to_folder, 1);
 }
 
-static void rename_folder_cb(FolderView *folderview, guint action,
-			     GtkWidget *widget)
+static void rename_folder_cb(GtkAction *action, gpointer data)
 {
+	FolderView *folderview = (FolderView *)data;
 	FolderItem *item, *parent;
 	gchar *new_folder;
 	gchar *name;
diff --git a/src/plugin.c b/src/plugin.c
index 91b27e7..d43d0f4 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -44,12 +44,13 @@ gint plugin_init(gchar **error)
 	return 0;
 }
 
-void plugin_done(void)
+gboolean plugin_done(void)
 {
 	maildir_gtk_done();
 	if (!claws_is_exiting())
 		folder_unregister_class(maildir_get_class());
 	uiddb_done();
+	return TRUE;
 }
 
 const gchar *plugin_name(void)
@@ -72,7 +73,7 @@ const gchar *plugin_type(void)
 
 const gchar *plugin_licence(void)
 {
-		return "GPL";
+		return "GPLv3+";
 }
 
 const gchar *plugin_version(void)


====

GrĂ¼ss, Brian



-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-gitdiff_0.24.4_0.24.5.gz
Type: application/x-gzip
Size: 4862 bytes
Desc: not available
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20130510/0dcfafbd/attachment.bin>


More information about the Users mailing list