[gnumeric] GUI: Improve handling of pango contexts.



commit 0ebe0bdf90bd8002ee2415212961399698bfbf42
Author: Morten Welinder <terra gnome org>
Date:   Mon May 3 14:39:42 2010 -0400

    GUI: Improve handling of pango contexts.

 ChangeLog   |    2 ++
 NEWS        |    1 +
 src/sheet.c |   16 ++++++----------
 src/sheet.h |    1 -
 4 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e6a2913..9ce6be5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-05-03  Morten Welinder  <terra gnome org>
 
+	* src/sheet.h (struct _Sheet): Drop context field.
+
 	* src/rendered-value.c (gnm_rendered_value_new): Add a
 	PangoContext* argument.  All callers changed.
 
diff --git a/NEWS b/NEWS
index b4f65b1..d94268a 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ Morten:
 	* Improve error handle for complex functions.
 	* Improve IMPOWER.
 	* Fix sheet duplicate bugs.  [Part of #617469]
+	* Clean-up handling of pango contexts.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.2
diff --git a/src/sheet.c b/src/sheet.c
index 0cdc8d6..9b37d13 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -715,6 +715,8 @@ gnm_sheet_constructor (GType type,
 static void
 gnm_sheet_init (Sheet *sheet)
 {
+	PangoContext *context;
+
 	sheet->priv = g_new0 (SheetPrivate, 1);
 	sheet->being_constructed = TRUE;
 
@@ -783,9 +785,10 @@ gnm_sheet_init (Sheet *sheet)
 
 	/* FIXME: probably not here.  */
 	/* See also gtk_widget_create_pango_context ().  */
-	sheet->context = gnm_pango_context_get ();
 	sheet->last_zoom_factor_used = -1;  /* Overridden later */
-	sheet->rendered_values = gnm_rvc_new (sheet->context, 5000);
+	context = gnm_pango_context_get ();
+	sheet->rendered_values = gnm_rvc_new (context, 5000);
+	g_object_unref (context);
 
 	/* Init menu states */
 	sheet->priv->enable_showhide_detail = TRUE;
@@ -2250,7 +2253,7 @@ cb_max_cell_height (GnmCellIter const *iter, struct cb_fit *data)
 		Sheet const *sheet = cell->base.sheet;
 		height = sheet->last_zoom_factor_used *
 			gnm_style_get_pango_height (gnm_cell_get_style (cell),
-						    sheet->context,
+						    sheet->rendered_values->context,
 						    sheet->last_zoom_factor_used);
 	} else {
 		(void)gnm_cell_fetch_rendered_value (cell, TRUE);
@@ -4002,11 +4005,6 @@ gnm_sheet_finalize (GObject *obj)
 
 	sheet_style_shutdown (sheet);
 
-	if (sheet->context) {
-		g_object_unref (G_OBJECT (sheet->context));
-		sheet->context = NULL;
-	}
-
 	(void) g_idle_remove_by_data (sheet);
 
 	g_free (sheet->name_quoted);
@@ -5405,8 +5403,6 @@ cb_sheet_cell_copy (gpointer unused, gpointer key, gpointer new_sheet_param)
 	array = gnm_cell_is_array_corner (cell);
 
 	if (array) {
-		GnmExpr const *aexpr;
-
 		texpr = gnm_expr_top_relocate_sheet (texpr, src, dst);
 		array = gnm_expr_top_get_array_corner (texpr);
 
diff --git a/src/sheet.h b/src/sheet.h
index a274efc..3446756 100644
--- a/src/sheet.h
+++ b/src/sheet.h
@@ -48,7 +48,6 @@ struct _Sheet {
 
 	/* This should eventually be moved to the views.  */
 	double      last_zoom_factor_used;
-	PangoContext *context;
 	GnmRenderedValueCollection *rendered_values;
 
 	GSList      *sheet_objects;	/* List of objects in this sheet */



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