[gnumeric] Register the image when importing from .xls. Fixes #672716 item 3.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Register the image when importing from .xls. Fixes #672716 item 3.
- Date: Mon, 26 Mar 2012 08:25:48 +0000 (UTC)
commit 4378430a786a84ecc6d0b111e615d3ba64998aa2
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Mar 26 10:24:37 2012 +0200
Register the image when importing from .xls. Fixes #672716 item 3.
ChangeLog | 6 ++++++
src/sheet-object-image.c | 13 +++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c5a342..d2a62b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-26 Jean Brefort <jean brefort normalesup org>
+
+ * src/sheet-object-image.c (sheet_object_image_set_image),
+ (gnm_soi_assign_to_sheet): register the image when importing from .xls.
+ Fixes #672716 item 3.
+
2012-03-25 Morten Welinder <terra gnome org>
* src/expr.c (gnm_expr_simplify_if): New function.
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index d67bd5e..0bf7bc4 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -148,6 +148,14 @@ sheet_object_image_set_image (SheetObjectImage *soi,
soi->bytes.data = copy_data ? g_memdup (data, data_len) : data;
soi->image = go_image_new_from_data (soi->type, soi->bytes.data, soi->bytes.len,
((soi->type == NULL)? &soi->type: NULL), NULL);
+ if (soi->sheet_object.sheet != NULL) {
+ GOImage *image = go_doc_add_image (GO_DOC (soi->sheet_object.sheet->workbook), NULL, soi->image);
+ if (image != soi->image) {
+ g_object_unref (soi->image);
+ soi->image = g_object_ref (image);
+ }
+ }
+
}
void
@@ -536,9 +544,9 @@ gnm_soi_assign_to_sheet (SheetObject *so, Sheet *sheet)
{
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
- if (soi->image && !go_image_get_name (soi->image)) {
+ if (soi->image/* && !go_image_get_name (soi->image)*/) {
GODoc *doc = GO_DOC (sheet->workbook);
- GOImage *image = go_doc_add_image (doc, NULL, soi->image);
+ GOImage *image = go_doc_add_image (doc, soi->name, soi->image);
if (soi->image != image) {
g_object_unref (soi->image);
soi->image = g_object_ref (image);
@@ -548,6 +556,7 @@ gnm_soi_assign_to_sheet (SheetObject *so, Sheet *sheet)
GType type = go_image_type_for_format (soi->type);
soi->image = g_object_ref (go_doc_image_fetch (doc, soi->name, type));
} else {
+ /* There is nothing we can do */
}
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]