[goffice] Fixed various issues related to image filling



commit b5322436bc1b0575bc36df0a34b225ce1f90e880
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Oct 7 18:15:30 2009 +0200

    Fixed various issues related to image filling

 ChangeLog                   |   10 ++++++++++
 NEWS                        |    1 +
 goffice/gtk/go-image-sel.c  |    4 +++-
 goffice/gtk/go-image-sel.ui |    4 ++--
 goffice/utils/go-style.c    |   16 +++++++++++++---
 5 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 053773f..c9dbed3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-07  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/gtk/go-image-sel.c (ok_button_clicked_cb): fix image life cycle.
+	* goffice/gtk/go-image-sel.ui: set correct response buttons.
+	* goffice/utils/go-style.c (cb_image_select): don't proceed until
+	gtk_dialog_run returns non 0,
+	(go_style_populate_editor): accept passing the document as a property
+	(allows images in gnumeric sheet objects),
+	(go_style_create_cairo_pattern): fixed wallpaper origin.
+
 2009-10-06  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-polygon.c (goc_polygon_class_init): removed not
diff --git a/NEWS b/NEWS
index 4b7aff9..96fc124 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bruce Cowan:
 Jean:
 	* Fix unicolor gradient brightness.
 	* Fix custom point marker in scatter plots. [#596585]
+	* Fixed various issues related to image filling.
 
 --------------------------------------------------------------------------
 goffice 0.7.13:
diff --git a/goffice/gtk/go-image-sel.c b/goffice/gtk/go-image-sel.c
index fd45d94..4527f18 100644
--- a/goffice/gtk/go-image-sel.c
+++ b/goffice/gtk/go-image-sel.c
@@ -132,6 +132,8 @@ static void
 ok_button_clicked_cb (GtkWidget *cc, GOImageSelState *state)
 {
 	GList *l = gtk_icon_view_get_selected_items (state->icon_view);
+	if (*(state->result))
+		g_object_unref (*(state->result));
 	if (l) {
 		GtkTreePath *path = l->data;
 		GtkTreeIter iter;
@@ -139,7 +141,7 @@ ok_button_clicked_cb (GtkWidget *cc, GOImageSelState *state)
 		if (gtk_tree_model_get_iter (GTK_TREE_MODEL (state->model), &iter, path)) {
 			gtk_tree_model_get (GTK_TREE_MODEL (state->model), &iter, 1, &name, -1);
 			if (name) {
-				*(state->result) = go_doc_get_image (state->doc, name);
+				*(state->result) = g_object_ref (go_doc_get_image (state->doc, name));
 				g_free (name);
 			}
 		}
diff --git a/goffice/gtk/go-image-sel.ui b/goffice/gtk/go-image-sel.ui
index 63ebd47..5461a25 100644
--- a/goffice/gtk/go-image-sel.ui
+++ b/goffice/gtk/go-image-sel.ui
@@ -227,8 +227,8 @@
     <action-widgets>
       <action-widget response="0">add</action-widget>
       <action-widget response="0">file-image-select</action-widget>
-      <action-widget response="0">cancel-button</action-widget>
-      <action-widget response="0">ok-button</action-widget>
+      <action-widget response="-6">cancel-button</action-widget>
+      <action-widget response="-5">ok-button</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 5748f88..cfb0cf0 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -496,7 +496,8 @@ cb_image_select (GtkWidget *cc, StylePrefState *state)
 
 	w = go_image_sel_new (state->doc, NULL, &style->fill.image.image);
 	gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (gtk_widget_get_toplevel (cc)));
-	gtk_dialog_run (GTK_DIALOG (w));
+	/* we need to call gtk_run_dialog until it returns a non NULL response */
+	while (! gtk_dialog_run (GTK_DIALOG (w)));
 
 	go_style_set_image_preview (style->fill.image.image, state);
 	set_style (state);
@@ -966,8 +967,15 @@ go_style_populate_editor (GOStyle *style,
 	state->object_with_style = object_with_style;
 	state->enable_edit = FALSE;
 
-	state->doc = (GO_IS_STYLED_OBJECT (object_with_style))?
-		go_styled_object_get_document (GO_STYLED_OBJECT (object_with_style)): NULL;
+	if (GO_IS_STYLED_OBJECT (object_with_style))
+		state->doc = go_styled_object_get_document (GO_STYLED_OBJECT (object_with_style));
+	else {
+		GObjectClass *klass = G_OBJECT_GET_CLASS (object_with_style);
+		if (g_object_class_find_property (klass, "document") != NULL)
+			g_object_get (object_with_style, "document", &(state->doc), NULL);
+	}
+	if (state->doc && !GO_IS_DOC (state->doc))
+		state->doc = NULL;
 
 	if ((enable & (GO_STYLE_OUTLINE | GO_STYLE_LINE | GO_STYLE_FILL)) != 0) {
 		gui = go_gtk_builder_new ("go-style-prefs.ui", GETTEXT_PACKAGE, cc);
@@ -2124,6 +2132,8 @@ go_style_create_cairo_pattern (GOStyle const *style, cairo_t *cr)
 					cairo_pattern_set_matrix (cr_pattern, &cr_matrix);
 					break;
 				case GO_IMAGE_WALLPAPER:
+					cairo_matrix_init_translate (&cr_matrix, -x[0], -y[0]);
+					cairo_pattern_set_matrix (cr_pattern, &cr_matrix);
 					break;
 			}
 			return cr_pattern;



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