[goffice] GOFileSaver: add flag for whether fs can do sheet selection.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOFileSaver: add flag for whether fs can do sheet selection.
- Date: Thu, 10 May 2018 17:21:47 +0000 (UTC)
commit 77b9b1f78fdda9789167d6e18fade825ef26e479
Author: Morten Welinder <terra gnome org>
Date: Thu May 10 13:20:15 2018 -0400
GOFileSaver: add flag for whether fs can do sheet selection.
Text exporters generally can export any subset of sheets whereas true
spreadsheet formats generally do all or nothing.
NEWS | 1 +
goffice/app/file-priv.h | 9 +++++----
goffice/app/file.c | 19 ++++++++++++++++++-
goffice/app/go-plugin-loader-module.c | 3 +--
goffice/app/go-plugin-service.c | 10 ++++++++++
5 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index 935fa56..00f9b03 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.10.42:
Morten:
* Introspection fixes.
+ * Improve file saver api.
--------------------------------------------------------------------------
goffice 0.10.41:
diff --git a/goffice/app/file-priv.h b/goffice/app/file-priv.h
index 3a8c5c9..1c188a8 100644
--- a/goffice/app/file-priv.h
+++ b/goffice/app/file-priv.h
@@ -92,10 +92,11 @@ struct _GOFileSaver {
gchar *mime_type;
gchar *extension;
gchar *description;
- gboolean overwrite_files;
- gboolean interactive_only;
- GOFileFormatLevel format_level;
- GOFileSaveScope save_scope;
+ guint overwrite_files : 1;
+ guint interactive_only : 1;
+ guint sheet_selection : 1;
+ GOFileFormatLevel format_level;
+ GOFileSaveScope save_scope;
GOFileSaverSaveFunc save_func;
};
diff --git a/goffice/app/file.c b/goffice/app/file.c
index cdd02aa..0d5c892 100644
--- a/goffice/app/file.c
+++ b/goffice/app/file.c
@@ -501,7 +501,8 @@ enum {
FS_PROP_OVERWRITE,
FS_PROP_INTERACTIVE_ONLY,
FS_PROP_FORMAT_LEVEL,
- FS_PROP_SCOPE
+ FS_PROP_SCOPE,
+ FS_PROP_SHEET_SELECTION
};
enum {
@@ -554,6 +555,9 @@ go_file_saver_set_property (GObject *object, guint property_id,
case FS_PROP_SCOPE:
fs->save_scope = g_value_get_enum (value);
break;
+ case FS_PROP_SHEET_SELECTION:
+ fs->sheet_selection = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -591,6 +595,9 @@ go_file_saver_get_property (GObject *object, guint property_id,
case FS_PROP_SCOPE:
g_value_set_enum (value, fs->save_scope);
break;
+ case FS_PROP_SHEET_SELECTION:
+ g_value_set_boolean (value, fs->sheet_selection);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -702,6 +709,16 @@ go_file_saver_class_init (GOFileSaverClass *klass)
GSF_PARAM_STATIC |
G_PARAM_READWRITE));
+ g_object_class_install_property
+ (goc,
+ FS_PROP_SHEET_SELECTION,
+ g_param_spec_boolean ("sheet-selection",
+ _("Sheet Selection"),
+ _("TRUE if this saver supports saving a subset of all sheet"),
+ FALSE,
+ GSF_PARAM_STATIC |
+ G_PARAM_READWRITE));
+
klass->save = go_file_saver_save_real;
/* class signals */
diff --git a/goffice/app/go-plugin-loader-module.c b/goffice/app/go-plugin-loader-module.c
index a22a03d..5412b75 100644
--- a/goffice/app/go-plugin-loader-module.c
+++ b/goffice/app/go-plugin-loader-module.c
@@ -24,7 +24,6 @@
#include "module-plugin-defs.h"
#include <goffice/app/file.h>
-#include <goffice/app/file-priv.h>
#include <goffice/app/go-plugin.h>
#include <goffice/app/go-plugin-service.h>
#include <goffice/app/go-plugin-loader.h>
@@ -270,7 +269,7 @@ go_plugin_loader_module_func_file_open (GOFileOpener const *fo, GOPluginService
g_return_if_fail (input != NULL);
loader_data = g_object_get_data (G_OBJECT (service), "loader_data");
- if (fo->encoding_dependent) {
+ if (go_file_opener_is_encoding_dependent (fo)) {
void (*module_func_file_open) (GOFileOpener const *fo, char const *enc,
GOIOContext *io_context,
GoView *view,
diff --git a/goffice/app/go-plugin-service.c b/goffice/app/go-plugin-service.c
index 7e24bdc..254b797 100644
--- a/goffice/app/go-plugin-service.c
+++ b/goffice/app/go-plugin-service.c
@@ -755,6 +755,8 @@ struct _GOPluginServiceFileSaver {
gint default_saver_priority;
GOFileSaveScope save_scope;
gboolean overwrite_files;
+ gboolean interactive_only;
+ gboolean sheet_selection;
GOFileSaver *saver;
GOPluginServiceFileSaverCallbacks cbs;
@@ -835,6 +837,12 @@ go_plugin_service_file_saver_read_xml (GOPluginService *service, xmlNode *tree,
if (!go_xml_node_get_bool (tree, "overwrite_files", &(psfs->overwrite_files)))
psfs->overwrite_files = TRUE;
+
+ if (!go_xml_node_get_bool (tree, "interactive_only", &(psfs->interactive_only)))
+ psfs->interactive_only = FALSE;
+
+ if (!go_xml_node_get_bool (tree, "sheet_selection", &(psfs->sheet_selection)))
+ psfs->sheet_selection = FALSE;
} else {
*ret_error = go_error_info_new_str (_("File saver has no description"));
}
@@ -980,7 +988,9 @@ go_plugin_file_saver_new (GOPluginService *service)
"description", psfs->description,
"format-level", psfs->format_level,
"overwrite", psfs->overwrite_files,
+ "interactive-only", psfs->interactive_only,
"scope", psfs->save_scope,
+ "sheet-selection", psfs->sheet_selection,
NULL));
pfs->service = service;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]