[gnumeric] Further introspection support



commit 115d24d751b3a1049f038a78dda59c4d097749b8
Author: Morten Welinder <terra gnome org>
Date:   Wed Apr 11 22:00:06 2018 -0400

    Further introspection support

 src/cell.c                        |   13 +++++++++++++
 src/cell.h                        |    1 +
 src/sheet.c                       |   20 ++++++++++++++++++--
 src/sheet.h                       |    2 +-
 test/t3000-introspection-basic.py |    1 +
 5 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/src/cell.c b/src/cell.c
index 73c000c..56f5300 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -499,6 +499,19 @@ gnm_cell_is_zero (GnmCell const *cell)
 }
 
 /**
+ * gnm_cell_get_value:
+ * @cell: #GnmCell
+ *
+ * Returns: (transfer none): @cell's value
+ **/
+GnmValue *
+gnm_cell_get_value (GnmCell const *cell)
+{
+       g_return_val_if_fail (cell != NULL, NULL);
+       return cell->value;
+}
+
+/**
  * gnm_cell_array_bound:
  * @cell: (nullable): #GnmCell
  * @res: (out): The range containing an array cell
diff --git a/src/cell.h b/src/cell.h
index c9858f1..3cc02a0 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -43,6 +43,7 @@ gboolean    gnm_cell_is_blank   (GnmCell const *cell); /* empty, or "" */
 GnmValue   *gnm_cell_is_error    (GnmCell const *cell);
 gboolean    gnm_cell_is_number   (GnmCell const *cell);
 gboolean    gnm_cell_is_zero     (GnmCell const *cell);
+GnmValue   *gnm_cell_get_value    (GnmCell const *cell);
 
 gboolean    gnm_cell_is_array    (GnmCell const *cell);
 gboolean    gnm_cell_is_nonsingleton_array (GnmCell const *cell);
diff --git a/src/sheet.c b/src/sheet.c
index fdc388f..0af9d04 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2911,8 +2911,7 @@ sheet_range_set_markup_undo (GnmSheetRange *sr, PangoAttrList *markup)
  * @col: Source column
  * @row: Source row
  *
- * Retrieve the value of a cell. The returned value must
- * NOT be freed or tampered with.
+ * Returns: (transfer none) (nullable): the cell's current value.
  **/
 GnmValue const *
 sheet_cell_get_value (Sheet *sheet, int const col, int const row)
@@ -3000,6 +2999,23 @@ sheet_cell_set_text (GnmCell *cell, char const *text, PangoAttrList *markup)
 }
 
 /**
+ * sheet_cell_set_text_gi: (rename-to sheet_cell_set_text)
+ * @sheet: #Sheet
+ * @col: column number
+ * @row: row number
+ * @str: the text to set.
+ *
+ * Sets the contents of a cell.
+ */
+void
+sheet_cell_set_text_gi (Sheet *sheet, int col, int row, char const *str)
+{
+       sheet_cell_set_text (sheet_cell_fetch (sheet, col, row), str, NULL);
+}
+
+
+
+/**
  * sheet_cell_set_expr:
  *
  * Marks the sheet as dirty
diff --git a/src/sheet.h b/src/sheet.h
index 9856c06..942222b 100644
--- a/src/sheet.h
+++ b/src/sheet.h
@@ -388,7 +388,7 @@ SheetView *sheet_get_view (Sheet const *sheet, WorkbookView const *wbv);
 
 // Introspection support
 void sheet_cell_set_value_gi (Sheet *sheet, int col, int row, GnmValue *v);
-
+void sheet_cell_set_text_gi  (Sheet *sheet, int col, int row, char const *str);
 
 
 #define SHEET_FOREACH_VIEW(sheet, view, code)                                  \
diff --git a/test/t3000-introspection-basic.py b/test/t3000-introspection-basic.py
index c3ee058..be4b6fe 100755
--- a/test/t3000-introspection-basic.py
+++ b/test/t3000-introspection-basic.py
@@ -4,5 +4,6 @@
 import gi
 gi.require_version('Gnm', '1.12') 
 from gi.repository import Gnm
+Gnm.init()
 
 print Gnm.qnorm(0.4,0,1,1,0)


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