[gnumeric] Make WorkbookView derive from GoView.



commit 98431d5f0a56d34d1b9350c4b70ac0432d86f964
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Aug 4 12:14:59 2012 +0200

    Make WorkbookView derive from GoView.

 ChangeLog           |   15 +++++++++++++++
 src/gui-clipboard.c |    2 +-
 src/print-info.c    |    4 ++--
 src/stf-export.c    |    3 ++-
 src/stf.c           |    9 ++++++---
 src/workbook-view.c |    7 ++++---
 src/workbook-view.h |    4 ++--
 src/xml-sax-read.c  |    4 ++--
 src/xml-sax-write.c |   11 ++++++-----
 9 files changed, 40 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e189a6..d62d9f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-08-04  Jean Brefort  <jean brefort normalesup org>
+
+	* src/gui-clipboard.c (table_cellregion_write): make WorkbookView derive
+	from GoView.
+	* src/print-info.c (pdf_export): ditto.
+	* src/stf-export.c (gnm_stf_file_saver_save): ditto.
+	* src/stf.c (stf_read_workbook), (stf_read_workbook_auto_csvtab),
+	(stf_write_csv): ditto.
+	* src/workbook-view.c (wbv_save_to_output),
+	(wb_view_new_from_input): ditto.
+	* src/workbook-view.h: ditto.
+	* src/xml-sax-read.c (gnm_xml_file_open):
+	* src/xml-sax-write.c (gnm_xml_file_save_full),
+	(gnm_xml_file_save), (gnm_xml_file_save_xml): ditto.
+
 2012-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/xml-sax-write.c (gnm_xml_file_save): renamed to
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 4c591db..0a18c7a 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -701,7 +701,7 @@ table_cellregion_write (GOCmdContext *ctx, GnmCellRegion *cr,
 			   PASTE_AS_VALUES | PASTE_FORMATS |
 			   PASTE_COMMENTS | PASTE_OBJECTS);
 	if (clipboard_paste_region (cr, &pt, ctx) == FALSE) {
-		go_file_saver_save (saver, ioc, wb_view, output);
+		go_file_saver_save (saver, ioc, GO_VIEW (wb_view), output);
 		if (!go_io_error_occurred (ioc)) {
 			GsfOutputMemory *omem = GSF_OUTPUT_MEMORY (output);
 			gsf_off_t osize = gsf_output_size (output);
diff --git a/src/print-info.c b/src/print-info.c
index 495dd59..3b91a6d 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -779,9 +779,9 @@ pdf_write_workbook (G_GNUC_UNUSED GOFileSaver const *fs,
 
 static void
 pdf_export (GOFileSaver const *fs, GOIOContext *context,
-		    gconstpointer wbv_, GsfOutput *output)
+		    GoView const *view, GsfOutput *output)
 {
-	WorkbookView const *wbv = wbv_;
+	WorkbookView const *wbv = WORKBOOK_VIEW (view);
 	Workbook const *wb = wb_view_get_workbook (wbv);
 	GPtrArray *objects = g_object_get_data (G_OBJECT (wb), "pdf-objects");
 
diff --git a/src/stf-export.c b/src/stf-export.c
index 6ca7c38..892278f 100644
--- a/src/stf-export.c
+++ b/src/stf-export.c
@@ -627,8 +627,9 @@ gnm_stf_get_stfe (GObject *obj)
 
 static void
 gnm_stf_file_saver_save (GOFileSaver const *fs, GOIOContext *context,
-			 gconstpointer wbv, GsfOutput *output)
+			 GoView const *view, GsfOutput *output)
 {
+	WorkbookView *wbv = WORKBOOK_VIEW (view);
 	Workbook *wb = wb_view_get_workbook (wbv);
 	GnmStfExport *stfe = gnm_stf_get_stfe (G_OBJECT (wb));
 	GsfOutput *dummy_sink;
diff --git a/src/stf.c b/src/stf.c
index 6c23906..6c03fb5 100644
--- a/src/stf.c
+++ b/src/stf.c
@@ -215,12 +215,13 @@ resize_columns (Sheet *sheet)
  **/
 static void
 stf_read_workbook (G_GNUC_UNUSED GOFileOpener const *fo,  gchar const *enc,
-		   GOIOContext *context, gpointer wbv, GsfInput *input)
+		   GOIOContext *context, GoView *view, GsfInput *input)
 {
 	DialogStfResult_t *dialogresult = NULL;
 	char *name, *nameutf8 = NULL;
 	char *data = NULL;
 	size_t data_len;
+	WorkbookView *wbv = WORKBOOK_VIEW (view);
 
 	/* FIXME : how to do this cleanly ? */
 	if (!IS_WBC_GTK (context->impl))
@@ -416,7 +417,7 @@ clear_stray_NULs (GOIOContext *context, GString *utf8data)
 static void
 stf_read_workbook_auto_csvtab (G_GNUC_UNUSED GOFileOpener const *fo, gchar const *enc,
 			       GOIOContext *context,
-			       gpointer wbv, GsfInput *input)
+			       GoView *view, GsfInput *input)
 {
 	Sheet *sheet, *old_sheet;
 	Workbook *book;
@@ -429,6 +430,7 @@ stf_read_workbook_auto_csvtab (G_GNUC_UNUSED GOFileOpener const *fo, gchar const
 	int cols, rows, i;
 	GStringChunk *lines_chunk;
 	GPtrArray *lines;
+	WorkbookView *wbv = WORKBOOK_VIEW (view);
 
 	g_return_if_fail (context != NULL);
 	g_return_if_fail (wbv != NULL);
@@ -512,10 +514,11 @@ stf_read_workbook_auto_csvtab (G_GNUC_UNUSED GOFileOpener const *fo, gchar const
 
 static void
 stf_write_csv (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *context,
-	       gconstpointer wbv, GsfOutput *output)
+	       GoView const *view, GsfOutput *output)
 {
 	Sheet *sheet;
 	GnmRangeRef const *range;
+	WorkbookView *wbv = WORKBOOK_VIEW (view);
 
 	GnmStfExport *config = g_object_new
 		(GNM_STF_EXPORT_TYPE,
diff --git a/src/workbook-view.c b/src/workbook-view.c
index 1d46dd7..3f7c44b 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -969,7 +969,7 @@ workbook_view_class_init (GObjectClass *gobject_class)
 }
 
 GSF_CLASS (WorkbookView, workbook_view,
-	   workbook_view_class_init, NULL, G_TYPE_OBJECT)
+	   workbook_view_class_init, NULL, GO_TYPE_VIEW)
 
 WorkbookView *
 workbook_view_new (Workbook *wb)
@@ -1034,7 +1034,7 @@ wbv_save_to_output (WorkbookView *wbv, GOFileSaver const *fs,
 	if (go_doc_is_dirty (godoc))
 	  /* FIXME: we should be using the true modification time */
 	  gnm_insert_meta_date (godoc, GSF_META_NAME_DATE_MODIFIED);
-	go_file_saver_save (fs, io_context, wbv, output);
+	go_file_saver_save (fs, io_context, GO_VIEW (wbv), output);
 
 	/* The plugin convention is unclear */
 	if (!gsf_output_is_closed (output))
@@ -1241,7 +1241,8 @@ wb_view_new_from_input (GsfInput *input,
 
 		/* disable recursive dirtying while loading */
 		old = workbook_enable_recursive_dirty (new_wb, FALSE);
-		go_file_opener_open (optional_fmt, optional_enc, io_context, new_wbv, input);
+		go_file_opener_open (optional_fmt, optional_enc, io_context,
+		                     GO_VIEW (new_wbv), input);
 		workbook_enable_recursive_dirty (new_wb, old);
 
 		if (go_io_error_occurred (io_context)) {
diff --git a/src/workbook-view.h b/src/workbook-view.h
index de3e940..57b798b 100644
--- a/src/workbook-view.h
+++ b/src/workbook-view.h
@@ -4,13 +4,13 @@
 
 #include "gnumeric.h"
 #include "dependent.h"
-#include <glib-object.h>
+#include <goffice/goffice.h>
 #include <gsf/gsf.h>
 
 G_BEGIN_DECLS
 
 struct _WorkbookView {
-	GObject  base;
+	GoView  base;
 
 	Workbook *wb;
 	GPtrArray *wb_controls;
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 20eea6b..18ef9b6 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -3442,7 +3442,7 @@ maybe_convert (GsfInput *input, gboolean quiet)
 
 static void
 gnm_xml_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_context,
-		   gpointer wb_view, GsfInput *input)
+		   GoView *view, GsfInput *input)
 {
 	XMLSaxParseState state;
 	gboolean ok;
@@ -3452,7 +3452,7 @@ gnm_xml_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_context
 	input = maybe_convert (input, FALSE);
 
 	ok = read_file_common (READ_FULL_FILE, &state,
-			       io_context, wb_view, NULL,
+			       io_context, WORKBOOK_VIEW (view), NULL,
 			       input);
 
 	g_object_unref (input);
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index ecdae71..1138898 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -1402,12 +1402,13 @@ gnm_xml_io_conventions (void)
 static void
 gnm_xml_file_save_full (G_GNUC_UNUSED GOFileSaver const *fs, 
 			G_GNUC_UNUSED GOIOContext *io_context,
-			gconstpointer wb_view, GsfOutput *output, 
+			GoView const *view, GsfOutput *output, 
 			gboolean compress)
 {
 	GnmOutputXML state;
 	GsfOutput   *gzout = NULL;
 	GnmLocale   *locale;
+	WorkbookView *wb_view = WORKBOOK_VIEW (view);
 
 	if (compress) {
 		gzout  = gsf_output_gzip_new (output, NULL);
@@ -1469,7 +1470,7 @@ gnm_xml_file_save_full (G_GNUC_UNUSED GOFileSaver const *fs,
 
 static void
 gnm_xml_file_save (GOFileSaver const *fs, GOIOContext *io_context,
-		   gconstpointer wb_view, GsfOutput *output)
+		   GoView const *view, GsfOutput *output)
 {
 	gboolean compress;
 	char const  *extension = NULL;
@@ -1482,14 +1483,14 @@ gnm_xml_file_save (GOFileSaver const *fs, GOIOContext *io_context,
 	else
 		compress = (gnm_conf_get_core_xml_compression_level () > 0);
 	
-	gnm_xml_file_save_full (fs, io_context, wb_view, output, compress);
+	gnm_xml_file_save_full (fs, io_context, view, output, compress);
 }
 
 static void
 gnm_xml_file_save_xml (GOFileSaver const *fs, GOIOContext *io_context,
-		   gconstpointer wb_view, GsfOutput *output)
+		   GoView const *view, GsfOutput *output)
 {
-	gnm_xml_file_save_full (fs, io_context, wb_view, output, FALSE);
+	gnm_xml_file_save_full (fs, io_context, view, output, FALSE);
 }
 
 /**************************************************************************/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]