[gnumeric] Fixed image type from xlsx files.



commit e71332113324eaa1bb835534fe512dd0b37089bc
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Oct 29 08:50:44 2011 +0200

    Fixed image type from xlsx files.

 ChangeLog                         |    6 ++++++
 component/gnumeric.c              |    3 ---
 plugins/excel/ChangeLog           |    4 ++++
 plugins/excel/xlsx-read-drawing.c |    2 +-
 src/sheet-object-image.c          |   26 +++++++++++++++-----------
 5 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e28d624..5027712 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-29  Jean Brefort  <jean brefort normalesup org>
+
+	* component/gnumeric.c (go_gnm_component_init): fixed build.
+	* src/sheet-object-image.c (gnm_soi_get_target_list),
+	(soi_cb_save_as): avoid a crash with unknown file types.
+
 2011-10-28 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/mstyle.c (gnm_style_get_pango_height): check for
diff --git a/component/gnumeric.c b/component/gnumeric.c
index 887c493..215aa60 100644
--- a/component/gnumeric.c
+++ b/component/gnumeric.c
@@ -258,10 +258,7 @@ go_gnm_component_init (GOComponent *component)
 	GOGnmComponent *gognm = GO_GNM_COMPONENT (component);
 	component->resizable = FALSE;
 	component->editable = TRUE;
-	component->needs_window = FALSE;
-#ifdef GO_SNAPSHOT_SVG
 	component->snapshot_type = GO_SNAPSHOT_SVG;
-#endif
 	gognm->row_start = gognm->col_start = 0;
 	gognm->sheet = NULL;
 	gognm->row_end = 9;
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index d9295aa..6524ad8 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-29  Jean Brefort  <jean brefort normalesup org>
+
+	* xlsx-read-drawing.c (xlsx_blip_start): don't set an invalid image type.
+
 2011-10-27  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* ms-excel-read.c (ms_wb_get_font_markup): use subscript/superscript attributes
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 5121727..84aff46 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -2187,7 +2187,7 @@ xlsx_blip_start (GsfXMLIn *xin, xmlChar const **attrs)
 			guint8 *data = g_new (guint8, size);
 			gsf_input_read (input, size, data);
 			sheet_object_image_set_image (SHEET_OBJECT_IMAGE (state->so),
-				gsf_open_pkg_rel_get_type (rel), data, size, FALSE);
+				NULL, data, size, FALSE);
 	}
 
 }
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 5f56f8a..ac5d067 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -379,16 +379,18 @@ gnm_soi_get_target_list (SheetObject const *so)
 	if (soi->type == NULL || soi->image == NULL)
 		pixbuf = soi_get_pixbuf (soi, 1.0);
 	mime_str = go_image_format_to_mime (soi->type);
-	mimes = go_strsplit_to_slist (mime_str, ',');
-	for (ptr = mimes; ptr != NULL; ptr = ptr->next) {
-		const char *mime = ptr->data;
-
-		if (mime != NULL && *mime != '\0')
-			gtk_target_list_add (tl, gdk_atom_intern (mime, FALSE),
-					     0, 0);
+	if (mime_str) {
+		mimes = go_strsplit_to_slist (mime_str, ',');
+		for (ptr = mimes; ptr != NULL; ptr = ptr->next) {
+			const char *mime = ptr->data;
+
+			if (mime != NULL && *mime != '\0')
+				gtk_target_list_add (tl, gdk_atom_intern (mime, FALSE),
+						     0, 0);
+		}
+		g_free (mime_str);
+		go_slist_free_custom (mimes, g_free);
 	}
-	g_free (mime_str);
-	go_slist_free_custom (mimes, g_free);
 	/* No need to eliminate duplicates. */
 	if (soi->image != NULL || pixbuf != NULL) {
 		gtk_target_list_add_image_targets (tl, 0, TRUE);
@@ -441,8 +443,10 @@ soi_cb_save_as (SheetObject *so, SheetControl *sc)
 	if ((pixbuf = soi_get_pixbuf (soi, 1.0)) != NULL)
 		l = go_image_get_formats_with_pixbuf_saver ();
 	/* Move original format first in menu */
-	l = g_slist_remove (l, GUINT_TO_POINTER (sel_fmt));
-	l = g_slist_prepend (l, GUINT_TO_POINTER (sel_fmt));
+	if (sel_fmt) {
+		l = g_slist_remove (l, GUINT_TO_POINTER (sel_fmt));
+		l = g_slist_prepend (l, GUINT_TO_POINTER (sel_fmt));
+	}
 
 	wbcg = scg_wbcg (SHEET_CONTROL_GUI (sc));
 



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