[Commits] Makefile.am 1.1 1.2 example-extension.c 1.1 1.2

miras at claws-mail.org miras at claws-mail.org
Sat Dec 10 00:01:23 CET 2011


Update of /home/claws-mail/contacts/extensions/example/src
In directory claws-mail:/tmp/cvs-serv2085/extensions/example/src

Modified Files:
	Makefile.am example-extension.c 
Log Message:
2011-12-09 [mir]	0.6.0cvs38

	* claws-contacts.pc.in
	* configure.ac
	* extensions/Makefile.am
	* extensions/example/Makefile.am
	* extensions/example/configure.ac
	* extensions/example/config/Makefile.am
	* extensions/example/src/Makefile.am
	* extensions/example/src/example-extension.c
	* extensions/export/ldifexport_extension.c
	* plugins/Makefile.am
	* plugins/example/Makefile.am
	* plugins/example/configure.ac
	* src/Makefile.am
	* src/callbacks.c
	* src/contactwindow.c
	* src/extension-loader.c
	* src/extension-loader.h
	* src/extension.c
	* src/extension.h
	* src/gtk-utils.c
	* src/mainwindow.c
	* src/mainwindow.h
	    Fix a number of bugs
	    Refined the build system
	    Added a plugable extension framework 

Index: example-extension.c
===================================================================
RCS file: /home/claws-mail/contacts/extensions/example/src/example-extension.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- example-extension.c	3 Dec 2011 21:18:38 -0000	1.1
+++ example-extension.c	9 Dec 2011 23:01:21 -0000	1.2
@@ -0,0 +1,124 @@
+/*
+ * $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 <glib/gprintf.h>
+#include <gtk/gtk.h>
+#include "extension.h"
+#include "utils.h"
+#include "gtk-utils.h"
+
+#define NAME "Example extension"
+
+static guint my_id;
+
+static void my_cb(GtkWidget* widget, gpointer data) {
+	MainWindow* mainwindow = (MainWindow*) data;
+	
+	show_message(mainwindow->window, GTK_UTIL_MESSAGE_INFO, "test");
+}
+
+static void setup(const MainWindow* mainwindow, gpointer object) {
+	GtkWidget *menu;
+	MenuItem* menu_item;
+	
+	//root = gtk_image_menu_item_new_with_mnemonic("_Test1");
+	menu = gtk_image_menu_item_new_with_mnemonic("_Test2");
+    g_signal_connect(menu, "activate",
+            G_CALLBACK(my_cb), (gpointer) mainwindow);
+    menu_item = menu_item_new();
+    menu_item->menu = CONTACTS_MAIN_MENU;
+    menu_item->parent = "file";
+    //menu_item->sublabel = "_Test1";
+    menu_item->submenu = FALSE;
+	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
+
+	menu = gtk_image_menu_item_new_with_mnemonic("_Test3");
+    g_signal_connect(menu, "activate",
+            G_CALLBACK(my_cb), (gpointer) mainwindow);
+    menu_item = menu_item_new();
+    menu_item->menu = CONTACTS_CONTACT_MENU;
+    menu_item->parent = "_Menu1";
+    menu_item->submenu = FALSE;
+	add_menu_item(GTK_IMAGE_MENU_ITEM(menu), menu_item);
+}
+
+/**
+ * The main application will call this function after loading the
+ * extension providing a uniq id for the extension which is to be
+ * used for further references
+ * @param id uniq id provided by main application
+ * @return 0 if success 1 otherwise
+ */
+gint extension_init(guint id) {
+	my_id = id;
+	gchar* error;
+	
+	register_hook_function(my_id, EXTENSION_AFTER_INIT_HOOK, setup, &error);
+	return 0;
+}
+
+/**
+ * Called by main application when the extension should be unloaded
+ * @return TRUE if success FALSE otherwise
+ */
+gboolean extension_done(void) {
+	return TRUE;
+}
+
+/**
+ * Called by main application to ensure extension license is compatible
+ * @return license
+ */
+const gchar* extension_license(void) {
+	return "GPL3+";
+}
+
+/**
+ * Called by main application to get name of extension
+ * @return name
+ */
+const gchar* extension_name(void) {
+	return NAME;
+}
+
+/**
+ * Called by main application to get extension's describtion
+ * @return description
+ */
+const gchar* extension_describtion(void) {
+	return _("Example Claws-contacts extension");
+}

Index: Makefile.am
===================================================================
RCS file: /home/claws-mail/contacts/extensions/example/src/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am	3 Dec 2011 21:18:38 -0000	1.1
+++ Makefile.am	9 Dec 2011 23:01:21 -0000	1.2
@@ -1,7 +1,7 @@
 # $Id$
 AUTOMAKE_OPTIONS = gnu
 
-extensiondir = @CLAWS_CONTACTS_EXTENSIONDIR@
+extensiondir = $(CLAWS_CONTACTS_EXTENSIONDIR)
 
 extension_LTLIBRARIES = example-extension.la
 
@@ -10,6 +10,7 @@
 
 INCLUDES = \
 	   -I${top_srcdir} \
+	   -I${top_srcdir}/src \
 	   -I${top_builddir} \
 	   @GLIB_CFLAGS@ \
 	   @GTK_CFLAGS@



More information about the Commits mailing list