[Commits] example-plugin.c 1.3 1.4

miras at claws-mail.org miras at claws-mail.org
Tue Oct 4 22:21:42 CEST 2011


Update of /home/claws-mail/contacts/plugins/example
In directory claws-mail:/tmp/cvs-serv4887/plugins/example

Modified Files:
	example-plugin.c 
Log Message:
2011-10-04 [mir]	0.6.0cvs20

	* dbus-client/client.c
	* plugins/example/example-plugin.c
	* plugins/ldap/ldap-plugin.c
	* plugins/xml/plugin-init.c
	* plugins/xml/xml-plugin.c
	* src/about.c
	* src/callbacks.c
	* src/claws-contacts.c
	* src/contactwindow.c
	* src/gtk-utils.c
	* src/mainwindow.c
	* src/plugin-loader.c
	* src/plugin-loader.h
	* src/plugin.h
	* src/printing.c
	* src/utils.c
	* src/utils.h
	* src/dbus/dbus-service.c
	* src/dbus/server-object.c
	* xmllib/parser.c
	* xmllib/parser.h
	    - Implemented forgotten functionality to reactivate closed
	    address books.
	    - Fix a ton of bugs.
	    - Extended plugin API so that it is possible to get a list
	      of closed address books as well as splitting attributes
	      in mandatory and optional.
	    - Provide plugins a way to have a fixed set of attributes.
	      Eg. LDAP has a finite set of attributes while XML supports
	      an infinite set of attributes. 

Index: example-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/example/example-plugin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- example-plugin.c	27 Sep 2011 17:13:04 -0000	1.3
+++ example-plugin.c	4 Oct 2011 20:21:40 -0000	1.4
@@ -48,10 +48,11 @@
 static const gchar subtype[] = "Example plugin";
 /* List of AddressBook */
 static GList* abooks = NULL;
+/* List of closed AddressBook */
+static GList* closed_books = NULL;
 /*
  * HashTable containing names of supported attributes.
- * Currently only keys are used. can be extended to hold
- * AttribDef for each key
+ * Each keys holds an AttribDef.
  */
 static GHashTable* attribs = NULL;
 
@@ -274,8 +275,8 @@
  */
 gboolean plugin_abook_close(AddressBook* abook, gchar** error) {
 	debug_print("List contains %d elements before\n", g_list_length(abooks));
-	address_book_contacts_free(abook);
 	abooks = g_list_remove(abooks, abook);
+	address_book_contacts_free(abook);
 	debug_print("List contains %d elements after\n", g_list_length(abooks));
 	return TRUE;
 }
@@ -342,6 +343,20 @@
 }
 
 /**
+ * Get list of closed address books. The list and data must be freed
+ * by the caller.
+ * @return GList of AddressBook
+ */
+GList* plugin_closed_books_get(void) {
+	GList *cur, *list = NULL;
+	
+	for (cur = closed_books; cur; cur = g_list_next(cur)) {
+	}
+	
+	return list;
+}
+
+/**
  * Initialize plugin.
  * @param Pointer to memory where error is supposed to be saved
  * @return FALSE if success TRUE otherwise



More information about the Commits mailing list