Commit 30b6be10 authored by Arturo Espinosa's avatar Arturo Espinosa
Browse files

Added sample plugin

parent 7c5682a8
SUBDIRS = intl po macros src
SUBDIRS = intl po macros src plugins
......@@ -40,6 +40,8 @@ AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
AC_OUTPUT([
Makefile
src/Makefile
plugins/Makefile
plugins/sample/Makefile
intl/Makefile
po/Makefile.in
macros/Makefile
......
SUBDIRS = sample
#
# Sample Makefile for a Gnumeric plugin.
#
# Where can we find the Gnumeric include files.
#
GNUMERIC_SRC_DIR = $(srcdir)/../../src
#
# Where to install the plugin
#
plugindir = $(libdir)/gnumeric/plugins
CFLAGS += -g -Wall \
-Wshadow -Wpointer-arith \
-Wmissing-prototypes -Wmissing-declarations
plugin_LTLIBRARIES = libsample.la
libsample_la_SOURCES = plugin-sample.c
INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
$(GNOME_INCLUDEDIR)
/*
* Sample plugin demostration
*
* Author:
* Tom Dyas (tdyas@romulus.rutgers.edu)
*/
#include <gnome.h>
#include <glib.h>
#include "../../src/gnumeric.h"
#include "../../src/func.h"
#include "../../src/plugin.h"
static Value *
func_plusone (Value *argv [], char **error_string)
{
Value *v = g_new (Value, 1);
v->type = VALUE_FLOAT;
v->v.v_float = value_get_as_double (argv [0]) + 1.0;
return v;
}
static FunctionDefinition plugin_functions [] = {
{ "plusone", "f", "number", NULL, NULL, func_plusone },
{ NULL, NULL },
};
int init_plugin (PluginData * pd)
{
g_print("plugin-one.c: initializing\n");
install_symbols (plugin_functions);
pd->title = g_strdup ("PlusOne Plugin");
return 0;
}
void cleanup_plugin (PluginData *pd)
{
Symbol *sym;
g_free (pd->title);
sym = symbol_lookup ("plusone");
if (sym) {
symbol_unref(sym);
}
}
......@@ -5,9 +5,9 @@ CFLAGS += -g -Wall \
bin_PROGRAMS = gnumeric
check_PROGRAMS = test-format test-parser
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
$(GNOME_INCLUDEDIR)
GNOME_XML_LIB = -lxml
......
......@@ -24,4 +24,7 @@ PluginData *plugin_load (gchar *filename);
void plugin_unload (PluginData *pd);
GtkWidget *plugin_manager_new (void);
/* These get defined in plugins */
int init_plugin (PluginData *pd);
void cleanup_plugin (PluginData *pd);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment