+2011-11-30 [mir] 0.6.0cvs34
+
+ * Makefile.am
+ * TODO
+ * configure.ac
+ * extensions/.cvsignore
+ * extensions/Makefile.am
+ * extensions/export/.cvsignore
+ * extensions/export/Makefile.am
+ * extensions/export/ldifexport_extension.c
+ * extensions/import/.cvsignore
+ * extensions/import/Makefile.am
+ * extensions/import/ldifimport_extension.c
+ * src/Makefile.am
+ * src/claws-contacts.c
+ * src/extension-loader.c
+ * src/extension-loader.h
+ * src/extension.c
+ * src/extension.h
+ * src/mainwindow.c
+ * src/mainwindow.h
+ Begin implementing plugable extension feature.
+
2011-11-30 [mir] 0.6.0cvs33
* src/contactwindow.c
xmllib \
plugins \
src \
+ extensions \
${DBUS_CLIENT}
DOCS = \
( cvs diff -u -r 1.8 -r 1.9 src/utils.c; cvs diff -u -r 1.1 -r 1.2 src/dbus/dbus-contact.h; cvs diff -u -r 1.3 -r 1.4 src/dbus/server-object.c; ) > 0.6.0cvs31.patchset
( cvs diff -u -r 1.11 -r 1.12 plugins/ldap/ldap-plugin.c; cvs diff -u -r 1.2 -r 1.3 src/dbus/dbus-service.c; ) > 0.6.0cvs32.patchset
( cvs diff -u -r 1.10 -r 1.11 src/contactwindow.c; ) > 0.6.0cvs33.patchset
+( cvs diff -u -r 1.2 -r 1.3 Makefile.am; cvs diff -u -r 1.1 -r 1.2 TODO; cvs diff -u -r 1.34 -r 1.35 configure.ac; diff -u /dev/null extensions/.cvsignore; diff -u /dev/null extensions/Makefile.am; diff -u /dev/null extensions/export/.cvsignore; diff -u /dev/null extensions/export/Makefile.am; diff -u /dev/null extensions/export/ldifexport_extension.c; diff -u /dev/null extensions/import/.cvsignore; diff -u /dev/null extensions/import/Makefile.am; diff -u /dev/null extensions/import/ldifimport_extension.c; cvs diff -u -r 1.2 -r 1.3 src/Makefile.am; cvs diff -u -r 1.2 -r 1.3 src/claws-contacts.c; diff -u /dev/null src/extension-loader.c; diff -u /dev/null src/extension-loader.h; diff -u /dev/null src/extension.c; diff -u /dev/null src/extension.h; cvs diff -u -r 1.4 -r 1.5 src/mainwindow.c; cvs diff -u -r 1.2 -r 1.3 src/mainwindow.h; ) > 0.6.0cvs34.patchset
$Id$
1) Remove annoying compile time warnings DONE
- 2) Complete example plugin with user documentation
+ 2) Complete example plugin with user documentation DONE
3) Implement basic search DONE
4) Implement advanced search DONE
5) Implement application preferences Partly DONE
10) Apply compile time selection between old and new address
book into Claws-mail as well as compile time switches
to remove all old address book code from binary DONE
-11) Develop LDAP plugin
+11) Develop LDAP plugin DONE
12) Bug hunt Never DONE
-13) Improve tab-completion search in claws
+13) Improve tab-completion search in claws DONE
+14) Implement plugable extension interface
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=33
+EXTRA_VERSION=34
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
AC_DEFINE_UNQUOTED(BINDIR, "$BINDIR", [Where is binary installed])
AC_DEFINE_UNQUOTED(PIXDIR, "${ac_pwd}/pixmaps", [Directory with various pixmaps])
PLUGINDIR="${ac_pwd}/plugins"
+ EXTENSIONDIR="${ac_pwd}/extensions"
else
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
AC_DEFINE_UNQUOTED(BINDIR, "$BINDIR", [Where is binary installed])
AC_DEFINE_UNQUOTED(PIXDIR, "${prefix}/share/claws-contacts/pixmaps", [Directory with various pixmaps])
PLUGINDIR="${prefix}/lib/claws-contacts/plugins"
+ EXTENSIONDIR="${prefix}/lib/claws-contacts/extensions"
fi
AC_SUBST(PLUGINDIR)
+AC_SUBST(EXTENSIONDIR)
AC_SUBST(BINDIR)
GLIB_REQUIRED=2.16.0
plugins/example/Makefile
plugins/xml/Makefile
plugins/ldap/Makefile
+ extensions/Makefile
+ extensions/import/Makefile
+ extensions/export/Makefile
])
AC_OUTPUT
--- /dev/null
+contacts.geany
+stamp-h1
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+auxdir
+*.bz2
+claws-contacts.desktop
+claws-contacts.pc
+config
+config.h
+config.h.in
+config.log
+config.status
+configure
+libtool
+m4
+org.clawsmail.ClawsContact.service
+.deps
+.libs
+*.lo
+*.la
+claws-contacts
+server-bindings.h
+
--- /dev/null
+# $Id$
+AUTOMAKE_OPTIONS = gnu
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = \
+ export \
+ import
+
--- /dev/null
+contacts.geany
+stamp-h1
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+auxdir
+*.bz2
+claws-contacts.desktop
+claws-contacts.pc
+config
+config.h
+config.h.in
+config.log
+config.status
+configure
+libtool
+m4
+org.clawsmail.ClawsContact.service
+.deps
+.libs
+*.lo
+*.la
+claws-contacts
+server-bindings.h
+
--- /dev/null
+# $Id$
+AUTOMAKE_OPTIONS = gnu
+
+extensiondir = $(pkglibdir)/extensions
+
+extension_LTLIBRARIES = ldifexport-extension.la
+
+ldifexport_extension_la_LDFLAGS = \
+ -avoid-version -module
+
+INCLUDES = \
+ -I${top_srcdir} \
+ -I${top_srcdir}/src \
+ -I${top_builddir} \
+ @GLIB_CFLAGS@ \
+ @GTK_CFLAGS@
+
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Claws-Contacts\"
+
+ldifexport_extension_la_SOURCES = \
+ ldifexport_extension.c
+
+ldifexport_extension_la_LIBADD= \
+ @GLIB_LIBS@ \
+ @GTK_LIBS@
--- /dev/null
+contacts.geany
+stamp-h1
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+auxdir
+*.bz2
+claws-contacts.desktop
+claws-contacts.pc
+config
+config.h
+config.h.in
+config.log
+config.status
+configure
+libtool
+m4
+org.clawsmail.ClawsContact.service
+.deps
+.libs
+*.lo
+*.la
+claws-contacts
+server-bindings.h
+
--- /dev/null
+# $Id$
+AUTOMAKE_OPTIONS = gnu
+
+extensiondir = $(pkglibdir)/extensions
+
+extension_LTLIBRARIES = ldifimport-extension.la
+
+ldifimport_extension_la_LDFLAGS = \
+ -avoid-version -module
+
+INCLUDES = \
+ -I${top_srcdir} \
+ -I${top_srcdir}/src \
+ -I${top_builddir} \
+ @GLIB_CFLAGS@ \
+ @GTK_CFLAGS@
+
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Claws-Contacts\"
+
+ldifimport_extension_la_SOURCES = \
+ ldifimport_extension.c
+
+ldifimport_extension_la_LIBADD= \
+ @GLIB_LIBS@ \
+ @GTK_LIBS@
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Claws-Contacts\" \
-DPLUGINDIR=\"@PLUGINDIR@\" \
+ -DEXTENSIONDIR=\"@EXTENSIONDIR@\" \
$(LIBGCRYPT_CFLAGS)
claws_contacts_SOURCES = \
claws-contacts.c \
mainwindow.c \
- mainwindow.h \
callbacks.c \
callbacks.h \
utils.c \
printing.c \
printing.h \
settings.c \
- settings.h
-
+ settings.h \
+ extension.c \
+ extension-loader.c \
+ extension-loader.h
claws_contactsincludedir = $(pkgincludedir)
claws_contactsinclude_HEADERS = \
utils.h \
plugin.h \
- gtk-utils.h
+ gtk-utils.h \
+ mainwindow.h \
+ extension.h
claws_contacts_LDADD= \
@GLIB_LIBS@ \
static gboolean compose = FALSE;
static gboolean service = FALSE;
static gboolean keep = FALSE;
+static gboolean no_extensions = FALSE;
#if DEBUG
static gboolean debug_mode = TRUE;
#else
N_("Run in compose mode"), NULL},
{"keep", 'k', 0, G_OPTION_ARG_NONE, &keep,
N_("Dont fork in service mode"), NULL},
+ {"noext", 'n', 0, G_OPTION_ARG_NONE, &no_extensions,
+ N_("Avoid loading any extensions"), NULL},
{"service", 's', 0, G_OPTION_ARG_NONE, &service,
N_("Run as a DBus service"), NULL},
{"debug", 'd', 0, G_OPTION_ARG_NONE, &debug_mode,
return EXIT_FAILURE;
}
- if (service)
+ if (service) {
start_service(keep);
+ //start_service(keep, no_extensions);
+ }
else {
gtk_init(&argc, &argv);
- application_start(compose);
+ application_start(compose, no_extensions);
}
return EXIT_SUCCESS;
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "mainwindow.h"
+#include "extension.h"
+#include "extension-loader.h"
+
+static const GSList* active_hooks[EXTENSION_HOOK_N];
+static const MainWindow* mainwindow = NULL;
+static gint NEXT_ID = 0;
+
+static gint next_id() {
+ gint id = NEXT_ID;
+ NEXT_ID++;
+
+ return id;
+}
+
+Extension* extension_new(HOOKFUNC callback) {
+ Extension* extension = g_new0(Extension, 1);
+ extension->callback = callback;
+ extension->id = next_id();
+
+ return extension;
+}
+
+void extension_free(void) {
+}
+
+gint install_hook_function(ExtensionHook hook_type,
+ HOOKFUNC callback,
+ gchar** error) {
+ gint result = 0;
+ Extension* extension;
+
+ if (! callback) {
+ if (error)
+ *error = g_strdup(_("Missing reference to callback function"));
+ return TRUE;
+ }
+
+ extension = extension_new(callback);
+ active_hooks[hook_type] = g_slist_prepend(active_hooks[hook_type], extension);
+
+ return result;
+}
+
+void uninstall_hook_function(gint id, gchar** error) {
+ ExtensionHook i;
+ Extension* ext = NULL;
+ GSList* cur;
+ gboolean found = FALSE;
+
+ for (i = EXTENSION_BEFORE_INIT_HOOK; i < EXTENSION_HOOK_N && ! ext; i++) {
+ cur = active_hooks[i];
+ while (cur && ! found) {
+ ext = (Extension *) cur->data;
+ if (ext && ext->id == id)
+ found = TRUE;
+ else {
+ ext = NULL;
+ cur = cur->next;
+ }
+ }
+ }
+
+ if (ext) {
+ active_hooks[i] = g_slist_remove(active_hooks[i], ext);
+ g_free(ext);
+ ext = NULL;
+ }
+ else {
+ if (error)
+ *error = g_strdup(_("%d: Extension not found"));
+ }
+}
+
+void init_hooks(MainWindow* main) {
+ ExtensionHook i;
+
+ mainwindow = (const MainWindow *) main;
+ for (i = EXTENSION_BEFORE_INIT_HOOK; i < EXTENSION_HOOK_N; i++)
+ active_hooks[i] = NULL;
+
+}
+
+void run_hook_callbacks(ExtensionHook hook, gpointer object) {
+ GSList* cur;
+
+ if (! object)
+ return;
+
+ for (cur = active_hooks[hook]; cur; cur = g_slist_next(cur)) {
+ Extension* ext = (Extension *) cur->data;
+ if (ext && ext->callback)
+ ext->callback(mainwindow, object);
+ }
+}
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __EXTENSION_LOADER_H__
+#define __EXTENSION_LOADER_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#include <gtk/gtk.h>
+#include "extension.h"
+#include "mainwindow.h"
+
+typedef struct {
+ gint id;
+ HOOKFUNC callback;
+ gchar* parent;
+ GtkWidget* menu_item;
+} Extension;
+
+Extension* extension_new(HOOKFUNC callback);
+void extension_free(void);
+void init_hooks(MainWindow* main);
+void run_hook_callbacks(ExtensionHook hook, gpointer object);
+gint install_hook_function(ExtensionHook hook_type,
+ HOOKFUNC callback,
+ gchar** error);
+void uninstall_hook_function(gint id, gchar** error);
+
+
+G_END_DECLS
+
+#endif
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "mainwindow.h"
+#include "extension.h"
+#include "extension-loader.h"
+
+
+
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __EXTENSION_H__
+#define __EXTENSION_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#include "mainwindow.h"
+
+typedef enum {
+ EXTENSION_BEFORE_INIT_HOOK,
+ EXTENSION_AFTER_INIT_HOOK,
+ EXTENSION_BEFORE_OPEN_ABOOK_HOOK,
+ EXTENSION_AFTER_OPEN_ABOOK_HOOK,
+ EXTENSION_BEFORE_CLOSE_ABOOK_HOOK,
+ EXTENSION_AFTER_CLOSE_ABOOK_HOOK,
+ EXTENSION_BEFORE_DELETE_ABOOK_HOOK,
+ EXTENSION_AFTER_DELETE_ABOOK_HOOK,
+ EXTENSION_BEFORE_SEARCH_ABOOK_HOOK,
+ EXTENSION_AFTER_SEARCH_ABOOK_HOOK,
+ EXTENSION_BEFORE_ADD_ABOOK_HOOK,
+ EXTENSION_AFTER_ADD_ABOOK_HOOK,
+ EXTENSION_BEFORE_INIT_ABOOK_HOOK,
+ EXTENSION_AFTER_INIT_ABOOK_HOOK,
+ EXTENSION_BEFORE_OPEN_CONTACT_HOOK,
+ EXTENSION_AFTER_OPEN_CONTACT_HOOK,
+ EXTENSION_BEFORE_CLOSE_CONTACT_HOOK,
+ EXTENSION_AFTER_CLOSE_CONTACT_HOOK,
+ EXTENSION_BEFORE_DELETE_CONTACT_HOOK,
+ EXTENSION_AFTER_DELETE_CONTACT_HOOK,
+ EXTENSION_BEFORE_SEARCH_CONTACT_HOOK,
+ EXTENSION_AFTER_SEARCH_CONTACT_HOOK,
+ EXTENSION_BEFORE_ADD_CONTACT_HOOK,
+ EXTENSION_AFTER_ADD_CONTACT_HOOK,
+ EXTENSION_BEFORE_INIT_CONTACT_HOOK,
+ EXTENSION_AFTER_INIT_CONTACT_HOOK,
+ EXTENSION_HOOK_N
+} ExtensionHook;
+
+typedef void (*HOOKFUNC) (const MainWindow* mainwindow, gpointer object);
+
+/* Any extension must implement these functions */
+
+G_END_DECLS
+
+#endif
#include "mainwindow.h"
#include "callbacks.h"
#include "utils.h"
+#include "extension-loader.h"
const gchar* PIXMAPS[PIXMAP_N] = {
PIXDIR"/claws-contacts_16x16.png",
g_string_free(msg, TRUE);
}
-void application_start(gboolean compose) {
+void application_start(gboolean compose, gboolean avoid_extensions) {
MainWindow* mainwindow = g_new0(MainWindow, 1);
mainwindow->compose_mode = compose;
mainwindow_create(mainwindow);
+ if (! avoid_extensions) {
+ init_hooks(mainwindow);
+ }
+
GList* pixmaps = load_pixmaps();
gtk_window_set_default_icon_list(pixmaps);
g_list_free(pixmaps);
STATUS_MSG_SEARCHING
} STATUS;
-void application_start(gboolean compose);
+void application_start(gboolean compose, gboolean avoid_extensions);
void set_status_msg(MainWindow* mainwindow, STATUS id, const gchar* extra);
G_END_DECLS