[goffice] Cleaned out deprecated code.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Cleaned out deprecated code.
- Date: Thu, 13 Oct 2011 11:22:37 +0000 (UTC)
commit 4205373dfb4cf1d12107fbc86a78d89e48bffd1a
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Oct 13 13:16:22 2011 +0200
Cleaned out deprecated code.
ChangeLog | 9 +++
goffice/app/go-plugin.c | 71 +-------------------
goffice/app/go-plugin.h | 5 --
goffice/graph/gog-object-xml.c | 142 +++++++++-------------------------------
goffice/graph/gog-object-xml.h | 6 +-
goffice/graph/gog-plot-impl.h | 5 +-
6 files changed, 46 insertions(+), 192 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7b3ddea..00ad4b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-10-13 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/app/go-plugin.c: removed deprecated go_plugins_add().
+ * goffice/app/go-plugin.h: ditto.
+ * goffice/graph/gog-object-xml.c (gog_object_new_from_input): new function
+ to remlace gog_object_new_from_xml.
+ * goffice/graph/gog-object-xml.h: ditto.
+ * goffice/graph/gog-plot-impl.h: removed deprecated declaration.
+
2011-10-09 Gerald Niel
* configure.in: fixed plugins load from a Mac OSX bundle. [#661264]
diff --git a/goffice/app/go-plugin.c b/goffice/app/go-plugin.c
index fc155e3..747f15e 100644
--- a/goffice/app/go-plugin.c
+++ b/goffice/app/go-plugin.c
@@ -1741,8 +1741,8 @@ go_plugins_set_dirs (GSList *plugin_dirs)
* @activate_new_plugins : activate plugins we have no seen before.
* @default_loader_type : importer to use by default.
*
- * Initializes the plugin subsystem. Don't call this function more than
- * once.
+ * Initializes the plugin subsystem. Might be called several times to add
+ * new plugins.
**/
void
go_plugins_init (GOCmdContext *context,
@@ -1830,73 +1830,6 @@ go_plugins_init (GOCmdContext *context,
}
}
-/**
- * go_plugins_add:
- * @context : #GOCmdContext used to report errors
- * @known_states : A list of known states (defined how ?)
- * @active_plugins: A list of active plugins
- * @plugin_dirs :a list of directories to search for plugins
- * @default_loader_type : importer to use by default.
- *
- * Adds new plugins to currently used plugins.
- * Deprecated: this function is deprecated and should not be used at all. It will be removed
- * during next development cycle. Use go_plugins_init() instead.
- **/
-void
-go_plugins_add (GOCmdContext *context,
- GSList const *known_states,
- GSList const *active_plugins,
- GSList *plugin_dirs,
- GType default_loader_type)
-{
- GSList *error_list = NULL;
- GOErrorInfo *error;
- GSList *plugin_list;
-
- go_default_loader_type = default_loader_type;
- go_plugins_set_dirs (plugin_dirs);
- go_plugins_rescan (&error, NULL);
- if (error != NULL) {
- GO_SLIST_PREPEND (error_list, go_error_info_new_str_with_details (
- _("Errors while reading info about new plugins."), error));
- }
-
- GO_SLIST_FOREACH (known_states, char, state_str,
- PluginFileState *state;
-
- state = plugin_file_state_from_string (state_str);
- if (state != NULL)
- g_hash_table_insert (plugin_file_state_dir_hash, state->dir_name, state);
- );
- plugin_file_state_hash_changed = FALSE;
-
- plugin_list = NULL;
- GO_SLIST_FOREACH (active_plugins, char, plugin_id,
- GOPlugin *plugin = go_plugins_get_plugin_by_id (plugin_id);
- if (plugin != NULL && !go_plugin_is_active (plugin))
- GO_SLIST_PREPEND (plugin_list, plugin);
- );
-
- plugin_list = g_slist_reverse (plugin_list);
- go_plugin_db_activate_plugin_list (plugin_list, &error);
- g_slist_free (plugin_list);
- if (error != NULL) {
- GO_SLIST_PREPEND (error_list, go_error_info_new_str_with_details (
- _("Errors while activating plugins."), error));
- }
-
- /* report initialization errors */
- if (error_list != NULL) {
- GO_SLIST_REVERSE (error_list);
- error = go_error_info_new_str_with_details_list (
- _("Errors while initializing plugin system."),
- error_list);
-
- go_cmd_context_error_info (context, error);
- go_error_info_free (error);
- }
-}
-
static void
ghf_collect_used_plugin_state_strings (gpointer key, gpointer value, gpointer user_data)
{
diff --git a/goffice/app/go-plugin.h b/goffice/app/go-plugin.h
index 338f8f1..52fdc1d 100644
--- a/goffice/app/go-plugin.h
+++ b/goffice/app/go-plugin.h
@@ -49,11 +49,6 @@ void go_plugins_init (GOCmdContext *context,
gboolean activate_new_plugins,
GType default_loader_type);
GSList *go_plugins_shutdown (void);
-void go_plugins_add (GOCmdContext *context,
- GSList const *known_states,
- GSList const *active_plugins,
- GSList *plugin_dirs,
- GType default_loader_type);
void go_plugins_register_loader (const gchar *id_str, GOPluginService *service);
void go_plugins_unregister_loader (const gchar *id_str);
diff --git a/goffice/graph/gog-object-xml.c b/goffice/graph/gog-object-xml.c
index 9379110..7997b45 100644
--- a/goffice/graph/gog-object-xml.c
+++ b/goffice/graph/gog-object-xml.c
@@ -177,41 +177,6 @@ gog_object_write_property_sax (GogObject const *obj, GParamSpec *pspec, GsfXMLOu
}
static void
-gog_dataset_dom_load (GogDataset *set, xmlNode *node, gpointer user)
-{
- xmlNode *ptr;
- xmlChar *id, *val, *type;
-
- for (ptr = node->xmlChildrenNode ; ptr != NULL ; ptr = ptr->next) {
- if (xmlIsBlankNode (ptr) || ptr->name == NULL)
- continue;
- if (!strcmp (ptr->name, "data"))
- break;
- }
- if (ptr == NULL)
- return;
- for (ptr = ptr->xmlChildrenNode ; ptr != NULL ; ptr = ptr->next) {
- if (xmlIsBlankNode (ptr) || ptr->name == NULL)
- continue;
- if (!strcmp (ptr->name, "dimension")) {
- id = xmlGetProp (ptr, (xmlChar const *) "id");
- type = xmlGetProp (ptr, (xmlChar const *) "type");
- val = xmlNodeGetContent (ptr);
- if (id != NULL && type != NULL && val != NULL) {
- unsigned dim_id = strtoul (id, NULL, 0);
- GOData *dat = g_object_new (g_type_from_name (type), NULL);
- if (dat != NULL && go_data_unserialize (dat, val, user))
- gog_dataset_set_dim (set, dim_id, dat, NULL);
- }
-
- if (id != NULL) xmlFree (id);
- if (type != NULL) xmlFree (type);
- if (val != NULL) xmlFree (val);
- }
- }
-}
-
-static void
gog_dataset_sax_save (GogDataset const *set, GsfXMLOut *output, gpointer user)
{
GOData *dat;
@@ -279,69 +244,6 @@ gog_object_write_xml_sax (GogObject const *obj, GsfXMLOut *output, gpointer user
gsf_xml_out_end_element (output); /* </GogObject> */
}
-GogObject *
-gog_object_new_from_xml (GogObject *parent, xmlNode *node, gpointer user)
-{
- xmlChar *role, *name, *val, *type_name;
- xmlNode *ptr;
- GogObject *res = NULL;
- gboolean explicitly_typed_role = FALSE;
-
- type_name = xmlGetProp (node, (xmlChar const *) "type");
- if (type_name != NULL) {
- GType type = g_type_from_name (type_name);
- if (type == 0) {
- GogPlot *plot = gog_plot_new_by_name (type_name);
- if (plot)
- res = GOG_OBJECT (plot);
- else
- res = GOG_OBJECT (gog_trend_line_new_by_name (type_name));
- } else
- res = g_object_new (type, NULL);
- xmlFree (type_name);
- explicitly_typed_role = TRUE;
- g_return_val_if_fail (res != NULL, NULL);
- }
- role = xmlGetProp (node, (xmlChar const *) "role");
- if (role == NULL) {
- g_return_val_if_fail (parent == NULL, NULL);
- } else {
- /* FIXME */
- if (strcmp (role, GOG_BACKPLANE_OLD_ROLE_NAME) == 0)
- res = gog_object_add_by_name (parent, GOG_BACKPLANE_NEW_ROLE_NAME, res);
- else
- res = gog_object_add_by_name (parent, role, res);
- xmlFree (role);
- }
-
- g_return_val_if_fail (res != NULL, NULL);
-
- res->explicitly_typed_role = explicitly_typed_role;
-
- if (GO_IS_PERSIST (res))
- go_persist_dom_load (GO_PERSIST (res), node);
- if (GOG_IS_DATASET (res)) /* convenience to save data */
- gog_dataset_dom_load (GOG_DATASET (res), node, user);
-
- for (ptr = node->xmlChildrenNode ; ptr != NULL ; ptr = ptr->next) {
- if (xmlIsBlankNode (ptr) || ptr->name == NULL)
- continue;
- if (!strcmp (ptr->name, "property")) {
- name = xmlGetProp (ptr, "name");
- if (name == NULL) {
- g_warning ("missing name for property entry");
- continue;
- }
- val = xmlNodeGetContent (ptr);
- gog_object_set_arg_full (name, val, res, ptr);
- xmlFree (val);
- xmlFree (name);
- } else if (!strcmp (ptr->name, "GogObject"))
- gog_object_new_from_xml (res, ptr, user);
- }
- return res;
-}
-
typedef struct {
GogObject *obj;
GSList *obj_stack;
@@ -600,8 +502,10 @@ gogo_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
if (state->obj_stack->next != NULL) {
state->obj = state->obj_stack->data;
state->obj_stack = g_slist_remove (state->obj_stack, state->obj);
- } else
+ } else {
g_slist_free (state->obj_stack);
+ state->obj_stack = NULL;
+ }
}
static void
@@ -611,29 +515,45 @@ go_sax_parser_done (GsfXMLIn *xin, GogXMLReadState *state)
g_free (state);
}
+static GsfXMLInNode const gog_dtd[] = {
+ GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ, -1, "GogObject", GSF_XML_NO_CONTENT, &gogo_start, &gogo_end),
+ GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ_PROP, -1, "property", GSF_XML_CONTENT, &gogo_prop_start, &gogo_prop_end),
+ GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ_DATA, -1, "data", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (GOG_OBJ_DATA, GOG_DATA_DIM, -1, "dimension", GSF_XML_CONTENT, &gogo_dim_start, &gogo_dim_end),
+ GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ, -1, "GogObject", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE_END
+};
+static GsfXMLInDoc *gog_sax_doc = NULL;
void
gog_object_sax_push_parser (GsfXMLIn *xin, xmlChar const **attrs,
GogObjectSaxHandler handler,
gpointer user_unserialize,
gpointer user_data)
{
- static GsfXMLInNode const dtd[] = {
- GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ, -1, "GogObject", GSF_XML_NO_CONTENT, &gogo_start, &gogo_end),
- GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ_PROP, -1, "property", GSF_XML_CONTENT, &gogo_prop_start, &gogo_prop_end),
- GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ_DATA, -1, "data", GSF_XML_NO_CONTENT, NULL, NULL),
- GSF_XML_IN_NODE (GOG_OBJ_DATA, GOG_DATA_DIM, -1, "dimension", GSF_XML_CONTENT, &gogo_dim_start, &gogo_dim_end),
- GSF_XML_IN_NODE (GOG_OBJ, GOG_OBJ, -1, "GogObject", GSF_XML_NO_CONTENT, NULL, NULL),
- GSF_XML_IN_NODE_END
- };
- static GsfXMLInDoc *doc = NULL;
GogXMLReadState *state;
- if (NULL == doc)
- doc = gsf_xml_in_doc_new (dtd, NULL);
+ if (NULL == gog_sax_doc)
+ gog_sax_doc = gsf_xml_in_doc_new (gog_dtd, NULL);
state = g_new0 (GogXMLReadState, 1);
state->handler = handler;
state->user_data = user_data;
state->user_unserialize = user_unserialize;
- gsf_xml_in_push_state (xin, doc, state,
+ gsf_xml_in_push_state (xin, gog_sax_doc, state,
(GsfXMLInExtDtor) go_sax_parser_done, attrs);
}
+
+GogObject *
+gog_object_new_from_input (GsfInput *input,
+ gpointer user_unserialize)
+{
+ GogObject *res = NULL;
+ GogXMLReadState *state = g_new0 (GogXMLReadState, 1);
+ if (NULL == gog_sax_doc)
+ gog_sax_doc = gsf_xml_in_doc_new (gog_dtd, NULL);
+ state->user_unserialize = user_unserialize;
+ if (gsf_xml_in_doc_parse (gog_sax_doc, input, state)) {
+ res = state->obj;
+ }
+ g_free (state);
+ return res;
+}
diff --git a/goffice/graph/gog-object-xml.h b/goffice/graph/gog-object-xml.h
index 7adce07..3486212 100644
--- a/goffice/graph/gog-object-xml.h
+++ b/goffice/graph/gog-object-xml.h
@@ -30,15 +30,15 @@ G_BEGIN_DECLS
void gog_object_set_arg (char const *name, char const *val, GogObject *obj);
void gog_object_write_xml_sax(GogObject const *obj, GsfXMLOut *output, gpointer user);
-/* deprecated as soon as sax import works */
-GogObject *gog_object_new_from_xml (GogObject *parent, xmlNode *node, gpointer user);
-
typedef void (*GogObjectSaxHandler)(GogObject *obj, gpointer user_data);
void gog_object_sax_push_parser (GsfXMLIn *xin, xmlChar const **attrs,
GogObjectSaxHandler handler,
gpointer user_unserialize,
gpointer user_data);
GogObject *gog_xml_read_state_get_obj (GsfXMLIn *xin);
+GogObject *gog_object_new_from_input (GsfInput *input,
+ gpointer user_unserialize);
+
G_END_DECLS
diff --git a/goffice/graph/gog-plot-impl.h b/goffice/graph/gog-plot-impl.h
index 540df00..cf9d7e1 100644
--- a/goffice/graph/gog-plot-impl.h
+++ b/goffice/graph/gog-plot-impl.h
@@ -40,10 +40,7 @@ struct _GogPlot {
gboolean cardinality_valid;
unsigned index_num;
gboolean vary_style_by_element;
- union {
- GogPlotRenderingOrder rendering_order;
- gboolean render_before_axes; /* Deprecated */
- };
+ GogPlotRenderingOrder rendering_order;
gchar *plot_group;
char *guru_hints;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]