Commit 37665894 authored by Chyla Zbigniew's avatar Chyla Zbigniew

Defined gnumeric_plugin_version variable containing Gnumeric version



* plugins/applix/boot.c plugins/dif/dif.c plugins/excel/boot.c
plugins/gb/plugin.c plugins/gda/plugin-gda.c plugins/guile/plugin.c
plugins/html/boot.c plugins/html/boot.h plugins/html/html.c
plugins/html/html.h plugins/html/latex.c plugins/html/latex.h
plugins/html/roff.c plugins/html/roff.h plugins/lotus-123/boot.c
plugins/numtheory/numtheory.c plugins/oleo/boot.c
plugins/plan-perfect/pln.c plugins/python/python.c plugins/sc/sc.c
plugins/sylk/sylk.c plugins/xbase/boot.c plugins/xml2/xml2.c:
Defined gnumeric_plugin_version variable containing Gnumeric version
string for every plugin.
Added user_data parameter to "probe", "open" and "save" functions.
Changed PluginData to PluginInfo.
Modified can_deactivate_plugin, cleanup_plugin and init_plugin
functions to match new prototypes in plugin.h.
Storing registered opener_id/saver_id in variables and using them
while unregistering.

* plugins/applix/Makefile.am plugins/dif/Makefile.am
plugins/gda/Makefile.am plugins/html/Makefile.am
plugins/lotus-123/Makefile.am plugins/numtheory/Makefile.am
plugins/oleo/Makefile.am plugins/plan-perfect/Makefile.am
plugins/sc/Makefile.am plugins/sylk/Makefile.am
plugins/xbase/Makefile.am plugins/xml2/Makefile.am:
Installing every plugin in separate directory, together with plugin
descriptions (plugin.xml files).

* plugins/applix/plugin.xml, plugins/dif/plugin.xml,
plugins/gda/plugin.xml, plugins/html/plugin.xml,
plugins/lotus-123/plugin.xml, plugins/numtheory/plugin.xml,
plugins/oleo/plugin.xml, plugins/plan-perfect/plugin.xml,
plugins/python/plugin.xml, plugins/sc/plugin.xml,
plugins/sylk/plugin.xml, plugins/xbase/plugin.xml,
plugins/xml2/plugin.xml:
New files - plugin descriptions in XML files.
parent 2fb61c09
......@@ -3,6 +3,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = gnum_numtheory.la
gnum_numtheory_la_LDFLAGS = -module -avoid-version
gnum_numtheory_la_SOURCES = numtheory.c
gnumeric_plugin_numtheorydir = $(gnumeric_plugindir)/numtheory
gnumeric_plugin_numtheory_DATA = plugin.xml
gnumeric_plugin_numtheory_LTLIBRARIES = numtheory.la
numtheory_la_LDFLAGS = -module -avoid-version
numtheory_la_SOURCES = numtheory.c
......@@ -13,9 +13,12 @@
#include "gnumeric.h"
#include "func.h"
#include "plugin.h"
#include "plugin-util.h"
#include "value.h"
#include <limits.h>
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
#ifndef WORD_BIT
#define WORD_BIT (sizeof (int) * CHAR_BIT)
#endif
......@@ -533,8 +536,8 @@ static const char *function_names[] = {
static const int function_count =
sizeof (function_names) / sizeof (function_names[0]);
static int
can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
int i, excess = 0;
......@@ -547,8 +550,8 @@ can_unload (PluginData *pd)
return excess == 0;
}
static void
cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
int i;
......@@ -561,16 +564,14 @@ cleanup_plugin (PluginData *pd)
g_free (prime_table);
prime_table = 0;
return TRUE;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData *pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
FunctionCategory *cat;
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
cat = function_get_category (_("Number Theory"));
function_add_args (cat, "ithprime","f",
......@@ -602,10 +603,5 @@ init_plugin (CommandContext *context, PluginData *pd)
function_add_args (cat, "bitrshift", "ff",
"N,N", &help_bitrshift, func_bitrshift);
if (plugin_data_init (pd, can_unload, cleanup_plugin,
_("Number Theory"),
_("Several basic utilities for prime numbers, pi, phi, sigma. It also hold some simple bitwise operations")))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
return TRUE;
}
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_numtheory">
<information name="Number Theory" description="Several basic utilities for prime numbers, pi, phi, sigma. It also hold some simple bitwise operations"/>
<activation type="g_module" module_file="numtheory.so"/>
</plugin>
</gnumeric_plugin_group>
......@@ -3,6 +3,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = gnum_oleo.la
gnum_oleo_la_LDFLAGS = -module -avoid-version
gnum_oleo_la_SOURCES = boot.c oleo.h oleo.c
gnumeric_plugin_oleodir = $(gnumeric_plugindir)/oleo
gnumeric_plugin_oleo_DATA = plugin.xml
gnumeric_plugin_oleo_LTLIBRARIES = oleo.la
oleo_la_LDFLAGS = -module -avoid-version
oleo_la_SOURCES = boot.c oleo.h oleo.c
......@@ -27,9 +27,14 @@
#include "oleo.h"
#include "plugin.h"
#include "plugin-util.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
static FileOpenerId oleo_opener_id;
static gboolean
oleo_probe (const char *filename)
oleo_probe (const char *filename, gpointer user_data)
{
return filename != NULL &&
g_strcasecmp ("oleo", g_extension_pointer (filename)) == 0;
......@@ -37,7 +42,7 @@ oleo_probe (const char *filename)
static int
oleo_load (IOContext *context, WorkbookView *wb_view,
const char *filename)
const char *filename, gpointer user_data)
{
Workbook *wb = wb_view_workbook (wb_view);
int ret;
......@@ -45,38 +50,30 @@ oleo_load (IOContext *context, WorkbookView *wb_view,
ret = oleo_read (context, wb, filename);
if (ret == 0)
workbook_set_saveinfo (wb, filename, FILE_FL_MANUAL, NULL);
workbook_set_saveinfo (wb, filename, FILE_FL_MANUAL, FILE_SAVER_ID_INVAID);
return ret;
}
static int
oleo_can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
return TRUE;
}
static void
oleo_cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
file_format_unregister_open (oleo_probe, oleo_load);
file_format_unregister_open (oleo_opener_id);
return TRUE;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData *pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
file_format_register_open (100,
_("GNU Oleo (*.oleo) file format"),
&oleo_probe, &oleo_load);
if (plugin_data_init (pd, &oleo_can_unload, &oleo_cleanup_plugin,
_("GNU Oleo"),
_("Imports GNU Oleo documents")))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
oleo_opener_id = file_format_register_open (
100, _("GNU Oleo (*.oleo) file format"),
&oleo_probe, &oleo_load, NULL);
return TRUE;
}
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_oleo">
<information name="GNU Oleo" description="Imports GNU Oleo documents"/>
<activation type="g_module" module_file="oleo.so"/>
</plugin>
</gnumeric_plugin_group>
# Do not build by default until we are ready.
if WITH_PLAN_PERFECT
PP_TARGET = gnum_plan_perfect.la
PP_LTLIBRARIES_TARGET = plan_perfect.la
PP_DATA_TARGET = plugin.xml
else
PP_TARGET =
PP_LTLIBRARIES_TARGET =
PP_DATA_TARGET =
endif
INCLUDES = \
......@@ -10,6 +12,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = $(PP_TARGET)
gnum_plan_perfect_la_LDFLAGS = -module -avoid-version
gnum_plan_perfect_la_SOURCES = pln.h pln.c
gnumeric_plugin_plan_perfectdir = $(gnumeric_plugindir)/plan_perfect
gnumeric_plugin_plan_perfect_DATA = $(PP_DATA_TARGET)
gnumeric_plugin_plan_perfect_LTLIBRARIES = $(PP_LTLIBRARIES_TARGET)
plan_perfect_la_LDFLAGS = -module -avoid-version
plan_perfect_la_SOURCES = pln.h pln.c
......@@ -18,11 +18,16 @@
#include <math.h>
#include <gnome.h>
#include "plugin.h"
#include "plugin-util.h"
#include "gnumeric.h"
#include "file.h"
#include "value.h"
#include "cell.h"
#include "workbook.h"
#include "workbook-view.h"
#include "command-context.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
typedef struct {
char const *data, *cur;
......@@ -38,6 +43,8 @@ typedef struct {
#define PLN_BYTE(pointer) (((int)((*(pointer)))) & 0xFF)
#define PLN_WORD(pointer) (PLN_BYTE(pointer) + PLN_BYTE((pointer) + 1) * 256)
static FileOpenerId pln_opener_id;
static const char* formula1[] =
{
"?bad1?", /* 0 */
......@@ -875,22 +882,24 @@ g_warning("PLN : Record handling code for code %d not yet written", rcode);
}
static int
pln_read_workbook (CommandContext *context, WorkbookView *view,
char const *filename)
pln_read_workbook (IOContext *context, WorkbookView *view,
char const *filename, gpointer unused)
{
int result = 0;
int len;
struct stat sbuf;
char const *data;
int const fd = open(filename, O_RDONLY);
Workbook *book = wb_view_workbook (view);
if (fd < 0) {
gnumeric_error_read (context, g_strerror (errno));
gnumeric_error_read (COMMAND_CONTEXT (context), g_strerror (errno));
return -1;
}
if (fstat(fd, &sbuf) < 0) {
close (fd);
gnumeric_error_read (context, g_strerror (errno));
gnumeric_error_read (COMMAND_CONTEXT (context), g_strerror (errno));
return -1;
}
......@@ -908,18 +917,17 @@ pln_read_workbook (CommandContext *context, WorkbookView *view,
workbook_sheet_attach (book, src.sheet, NULL);
g_free (name);
result = pln_parse_sheet (context, &src);
result = pln_parse_sheet (COMMAND_CONTEXT (context), &src);
if (result != 0)
workbook_sheet_detach (book, src.sheet);
else
workbook_set_saveinfo (book, filename,
FILE_FL_MANUAL, NULL);
workbook_set_saveinfo (book, filename, FILE_FL_MANUAL, FILE_SAVER_ID_INVAID);
munmap((char *)data, len);
} else {
result = -1;
gnumeric_error_read (context, _("Unable to mmap the file"));
gnumeric_error_read (COMMAND_CONTEXT (context), _("Unable to mmap the file"));
}
close(fd);
......@@ -931,33 +939,26 @@ pln_read_workbook (CommandContext *context, WorkbookView *view,
#define PAGE_SIZE (BUFSIZ*8)
#endif
static int
pln_can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
/* We can always unload */
return TRUE;
}
static void
pln_cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
file_format_unregister_open (NULL, pln_read_workbook);
file_format_unregister_open (pln_opener_id);
return TRUE;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData * pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
file_format_register_open (1, _("Plan Perfect Format (PLN) import"),
NULL, pln_read_workbook);
pln_opener_id = file_format_register_open (
1, _("Plan Perfect Format (PLN) import"),
NULL, pln_read_workbook, NULL);
if (plugin_data_init (pd, pln_can_unload, pln_cleanup_plugin,
_("Plan Perfect"),
_("Imports Plan Perfect Formatted Documents")))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
return TRUE;
}
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_plan_perfect">
<information name="Plan Perfect" description="Imports Plan Perfect Formatted Documents"/>
<activation type="g_module" module_file="plan_perfect.so"/>
</plugin>
</gnumeric_plugin_group>
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_python">
<information name="Python Plugin" description="This plugin provides Python language support in Gnumeric"/>
<activation type="g_module" module_file="python.so"/>
</plugin>
</gnumeric_plugin_group>
......@@ -14,12 +14,15 @@
#include "gnumeric.h"
#include "func.h"
#include "plugin.h"
#include "plugin-util.h"
#include "gutils.h"
#include "value.h"
#include "command-context.h"
#include "Python.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
/* Classes we define in Python code, and where we define them. */
#define GNUMERIC_DEFS_MODULE "gnumeric_defs"
#define BOOLEAN_CLASS "Boolean"
......@@ -869,37 +872,30 @@ initgnumeric(void)
PyDict_SetItemString(d, "error", GnumericError);
}
static int
no_unloading_for_me (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
return FALSE;
}
static void
no_cleanup_for_me (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
return;
return TRUE;
}
#define PY_TITLE _("Python Plugin")
#define PY_DESCR \
_("This plugin provides Python language support in Gnumeric")
/**
* init_plugin
* @context Command context
* @pd PluginData
* @pinfo PluginInfo
*
* Initialize the plugin. Returns result.
*/
PluginInitResult
init_plugin (CommandContext *context, PluginData * pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
char *exc_string;
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
gchar *exc_string;
*ret_error = NULL;
/* initialize the python interpreter */
Py_SetProgramName ("gnumeric");
Py_Initialize ();
......@@ -909,10 +905,11 @@ init_plugin (CommandContext *context, PluginData * pd)
if (PyErr_Occurred ()) {
exc_string = string_from_exception ();
PyErr_Print (); /* Also do a full traceback to stderr */
gnumeric_error_plugin (context, exc_string);
*ret_error = error_info_new_printf (
_("Unhandled Python exception: %s"), exc_string);
g_free (exc_string);
Py_Finalize ();
return PLUGIN_QUIET_ERROR;
return FALSE;
}
/* plugin stuff */
......@@ -943,10 +940,5 @@ init_plugin (CommandContext *context, PluginData * pd)
g_free(dir);
}
if (plugin_data_init (pd, no_unloading_for_me, no_cleanup_for_me,
PY_TITLE, PY_DESCR))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
return TRUE;
}
......@@ -3,6 +3,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = gnum_sc.la
gnum_sc_la_LDFLAGS = -module -avoid-version
gnum_sc_la_SOURCES = sc.c
gnumeric_plugin_scdir = $(gnumeric_plugindir)/sc
gnumeric_plugin_sc_DATA = plugin.xml
gnumeric_plugin_sc_LTLIBRARIES = sc.la
sc_la_LDFLAGS = -module -avoid-version
sc_la_SOURCES = sc.c
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_sc">
<information name="SC/XSpread" description="Imports SC/XSpread files"/>
<activation type="g_module" module_file="sc.so"/>
</plugin>
</gnumeric_plugin_group>
......@@ -12,6 +12,7 @@
#include <ctype.h>
#include <gnome.h>
#include "plugin.h"
#include "plugin-util.h"
#include "gnumeric.h"
#include "io-context.h"
#include "workbook-view.h"
......@@ -22,6 +23,8 @@
#include "cell.h"
#include "style.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
typedef struct {
/* input data */
FILE *f;
......@@ -37,6 +40,7 @@ typedef enum {
RIGHTSTRING,
} sc_string_cmd_t;
static FileOpenerId sc_opener_id;
/* we can't use parse_cell_name b/c it doesn't support 0 bases (A0, B0, ...) */
static gboolean
......@@ -390,7 +394,7 @@ sc_parse_sheet (IOContext *context, sc_file_state_t *src)
static int
sc_read_workbook (IOContext *context, WorkbookView *wb_view,
const char *filename)
const char *filename, gpointer user_data)
{
/*
* TODO : When there is a reasonable error reporting
......@@ -418,7 +422,7 @@ sc_read_workbook (IOContext *context, WorkbookView *wb_view,
src.sheet = sheet_new (book, name);
workbook_sheet_attach (book, src.sheet, NULL);
workbook_set_saveinfo (book, filename, FILE_FL_MANUAL, NULL);
workbook_set_saveinfo (book, filename, FILE_FL_MANUAL, FILE_SAVER_ID_INVAID);
g_free (name);
result = sc_parse_sheet (context, &src);
......@@ -429,41 +433,30 @@ sc_read_workbook (IOContext *context, WorkbookView *wb_view,
}
static int
sc_can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
g_return_val_if_fail (pd, TRUE);
g_return_val_if_fail (pinfo != NULL, TRUE);
/* We can always unload */
return TRUE;
}
static void
sc_cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
g_return_if_fail (pd);
g_return_val_if_fail (pinfo != NULL, TRUE);
file_format_unregister_open (NULL, sc_read_workbook);
file_format_unregister_open (sc_opener_id);
return TRUE;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData * pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
g_return_val_if_fail (pd, -1);
g_return_val_if_fail (pinfo != NULL, FALSE);
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
sc_opener_id = file_format_register_open (1, _("SC/xspread file import"),
NULL, sc_read_workbook, NULL);
file_format_register_open (1,
_("SC/xspread file import"),
NULL, sc_read_workbook);
if (plugin_data_init (pd, sc_can_unload, sc_cleanup_plugin,
_("SC/XSpread "),
_("Imports SC/XSpread files")))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
return TRUE;
}
......@@ -3,7 +3,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = gnum_sylk.la
gnum_sylk_la_LDFLAGS = -module -avoid-version
gnum_sylk_la_SOURCES = sylk.c
gnumeric_plugin_sylkdir = $(gnumeric_plugindir)/sylk
gnumeric_plugin_sylk_DATA = plugin.xml
gnumeric_plugin_sylk_LTLIBRARIES = sylk.la
sylk_la_LDFLAGS = -module -avoid-version
sylk_la_SOURCES = sylk.c
<?xml version="1.0"?>
<gnumeric_plugin_group>
<plugin id="Gnumeric_sylk">
<information name="MultiPlan (SYLK)" description="Imports MultiPlan (SYLK) files"/>
<activation type="g_module" module_file="sylk.so"/>
</plugin>
</gnumeric_plugin_group>
......@@ -14,6 +14,7 @@
#include <errno.h>
#include "gnumeric.h"
#include "plugin.h"
#include "plugin-util.h"
#include "file.h"
#include "io-context.h"
#include "workbook-view.h"
......@@ -21,6 +22,8 @@
#include "cell.h"
#include "value.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
#define arraysize(x) (sizeof(x)/sizeof(*(x)))
......@@ -64,6 +67,7 @@ typedef struct {
unsigned hide_def_gridlines : 1; /* sheet-wide */
} sylk_file_state_t;
static FileOpenerId sylk_opener_id;
/* why? because we must handle Mac text files, and because I'm too lazy to make it fast */
static char *
......@@ -426,7 +430,7 @@ sylk_parse_sheet (IOContext *context, sylk_file_state_t *src)
static int
sylk_read_workbook (IOContext *context, WorkbookView *wb_view,
const char *filename)
const char *filename, gpointer user_data)
{
/*
* TODO : When there is a reasonable error reporting
......@@ -453,7 +457,7 @@ sylk_read_workbook (IOContext *context, WorkbookView *wb_view,
workbook_sheet_attach (book, src.sheet, NULL);
g_free (name);
workbook_set_saveinfo (book, filename, FILE_FL_MANUAL, NULL);
workbook_set_saveinfo (book, filename, FILE_FL_MANUAL, FILE_SAVER_ID_INVAID);
result = sylk_parse_sheet (context, &src);
......@@ -464,7 +468,7 @@ sylk_read_workbook (IOContext *context, WorkbookView *wb_view,
static gboolean
sylk_probe (const char *filename)
sylk_probe (const char *filename, gpointer user_data)
{
char buf [32] = "";
FILE *f;
......@@ -485,34 +489,25 @@ sylk_probe (const char *filename)
}
static int
sylk_can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
/* We can always unload */
return TRUE;
}
static void
sylk_cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
file_format_unregister_open (sylk_probe, sylk_read_workbook);
file_format_unregister_open (sylk_opener_id);
return TRUE;
}
PluginInitResult
init_plugin (CommandContext *context, PluginData * pd)
gboolean
init_plugin (PluginInfo *pinfo, ErrorInfo **ret_error)
{
if (plugin_version_mismatch (context, pd, GNUMERIC_VERSION))
return PLUGIN_QUIET_ERROR;
file_format_register_open (1, _("MultiPlan (SYLK) import"),
sylk_probe, sylk_read_workbook);
if (plugin_data_init (pd, sylk_can_unload, sylk_cleanup_plugin,
_("MultiPlan (SYLK)"),
_("Imports MultiPlan (SYLK) files")))
return PLUGIN_OK;
else
return PLUGIN_ERROR;
sylk_opener_id = file_format_register_open (
1, _("MultiPlan (SYLK) import"),
sylk_probe, sylk_read_workbook, NULL);
return TRUE;
}
......@@ -3,6 +3,8 @@ INCLUDES = \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR)
gnumeric_plugin_LTLIBRARIES = gnum_xbase.la
gnum_xbase_la_LDFLAGS = -module -avoid-version
gnum_xbase_la_SOURCES = boot.c xbase.h xbase.c
gnumeric_plugin_xbasedir = $(gnumeric_plugindir)/xbase
gnumeric_plugin_xbase_DATA = plugin.xml
gnumeric_plugin_xbase_LTLIBRARIES = xbase.la
xbase_la_LDFLAGS = -module -avoid-version
xbase_la_SOURCES = boot.c xbase.h xbase.c
......@@ -25,6 +25,9 @@
#include "file.h"
#include "xbase.h"
#include "plugin.h"
#include "plugin-util.h"
gchar gnumeric_plugin_version[] = GNUMERIC_VERSION;
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
......@@ -69,8 +72,10 @@ xb_setdouble (guint8 *p, double d)
#endif
static FileOpenerId xbase_opener_id;
static gboolean
xbase_probe (const char *filename)
xbase_probe (const char *filename, gpointer user_data)
{
return filename != NULL &&
g_strcasecmp ("dbf", g_extension_pointer (filename)) == 0;
......@@ -143,7 +148,7 @@ xbase_field_as_value (XBrecord *record, guint num)
static int
xbase_load (IOContext *context, WorkbookView *wb_view,
const char *filename)
const char *filename, gpointer user_data)
{
Workbook *wb = wb_view_workbook (wb_view);
XBfile *file;
......@@ -167,7 +172,7 @@ xbase_load (IOContext *context, WorkbookView *wb_view,
sheet = sheet_new (wb, g_basename (name));
g_free (name);
workbook_sheet_attach (wb, sheet, NULL);
workbook_set_saveinfo (wb, filename, FILE_FL_MANUAL, NULL);
workbook_set_saveinfo (wb, filename, FILE_FL_MANUAL, FILE_SAVER_ID_INVAID);
field = 0;
while (field < file->fields) {
......@@ -193,34 +198,26 @@ xbase_load (IOContext *context, WorkbookView *wb_view,
return 0;
}
static int
xbase_can_unload (PluginData *pd)
gboolean
can_deactivate_plugin (PluginInfo *pinfo)
{
return TRUE;
}
static void
xbase_cleanup_plugin (PluginData *pd)
gboolean
cleanup_plugin (PluginInfo *pinfo)
{
file_format_unregister_open (xbase_probe, xbase_load);
file_format_unregister_open (xbase_opener_id);
return TRUE;
}