[gnumeric] Fixed graph scalar data editor behavior. [#628721]



commit c5e77b0b49ef60d9539e2ff25ecc32491a810bcd
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Sep 4 18:49:42 2010 +0200

    Fixed graph scalar data editor behavior. [#628721]

 ChangeLog     |    5 +++++
 NEWS          |    1 +
 src/wbc-gtk.c |   19 ++++++++++++-------
 3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 859840c..530d6e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-04  Jean Brefort  <jean brefort normalesup org>
+
+	* src/wbc-gtk.c (set_entry_contents): fixed graph scalar data editor
+	behavior. [#628721]
+
 2010-09-01  Morten Welinder  <terra gnome org>
 
 	* src/func.c (check_argument_refs): Plug leak.  Fix the actual
diff --git a/NEWS b/NEWS
index fe052ae..9b45ada 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
 
 Jean:
 	* Fix some interpolation and periodogram issues.
+	* Fixed graph scalar data editor behavior. [#628721]
 
 Morten:
 	* Plug sylk importer leak.
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 16b52de..202effd 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -5362,13 +5362,18 @@ cb_graph_dim_entry_changed (GraphDimEditor *editor)
 static void
 set_entry_contents (GnmExprEntry *entry, GOData *val)
 {
-	if (go_data_get_n_dimensions (val) == 0 &&
-	    go_data_get_n_values (val) == 1) {
-		double d = go_data_get_scalar_value (val);
-		GODateConventions const *date_conv = go_data_date_conv (val);
-		gog_data_editor_set_value_double (GOG_DATA_EDITOR (entry),
-						  d, date_conv);
-	} else {
+	if (IS_GNM_GO_DATA_SCALAR (val)) {
+		GnmValue const *v = gnm_expr_top_get_constant (gnm_go_data_get_expr (val));
+		if (v && VALUE_IS_NUMBER (v)) {
+			double d = go_data_get_scalar_value (val);
+			GODateConventions const *date_conv = go_data_date_conv (val);
+			gog_data_editor_set_value_double (GOG_DATA_EDITOR (entry),
+							  d, date_conv);
+			return;
+		}
+	}
+
+	{
 		SheetControlGUI *scg = gnm_expr_entry_get_scg (entry);
 		Sheet const *sheet = scg_sheet (scg);
 		char *txt = go_data_serialize (val, (gpointer)sheet->convs);



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