[gnumeric] Introspection fixes.



commit 48c07294832803e3e3453ac58a1888e8fedaeee3
Author: Morten Welinder <terra gnome org>
Date:   Sun May 13 19:59:15 2018 -0400

    Introspection fixes.

 src/print-info.c   |  139 +++++++++++++++++++++++++++++++++-------------------
 src/search.c       |   22 ++++----
 src/selection.c    |   24 +++++-----
 src/sheet-object.c |   15 +++--
 4 files changed, 121 insertions(+), 79 deletions(-)
---
diff --git a/src/print-info.c b/src/print-info.c
index 54b3ac9..18dfa0b 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -47,42 +47,46 @@ static gint hf_formats_base_num = 0;
 GType
 gnm_print_comment_placement_get_type (void)
 {
-  static GType etype = 0;
-  if (etype == 0) {
-         static GEnumValue const values[] = {
-                 { GNM_PRINT_COMMENTS_NONE, "GNM_PRINT_COMMENTS_NONE", "none"},
-                 { GNM_PRINT_COMMENTS_IN_PLACE, "GNM_PRINT_COMMENTS_IN_PLACE",
-                   "in-place"},
-                 { GNM_PRINT_COMMENTS_AT_END, "GNM_PRINT_COMMENTS_AT_END",
-                   "at-end"},
-                 { 0, NULL, NULL }
-         };
-         etype = g_enum_register_static ("GnmPrintCommentPlacementType",
-                                         values);
-  }
-  return etype;
+       static GType etype = 0;
+       if (etype == 0) {
+               static GEnumValue const values[] = {
+                       { GNM_PRINT_COMMENTS_NONE,
+                         "GNM_PRINT_COMMENTS_NONE",
+                         "none"},
+                       { GNM_PRINT_COMMENTS_IN_PLACE,
+                         "GNM_PRINT_COMMENTS_IN_PLACE",
+                         "in-place"},
+                       { GNM_PRINT_COMMENTS_AT_END,
+                         "GNM_PRINT_COMMENTS_AT_END",
+                         "at-end"},
+                       { 0, NULL, NULL }
+               };
+               etype = g_enum_register_static ("GnmPrintCommentPlacementType",
+                                               values);
+       }
+       return etype;
 }
 
 GType
 gnm_print_errors_get_type (void)
 {
-  static GType etype = 0;
-  if (etype == 0) {
-         static GEnumValue const values[] = {
-                 { GNM_PRINT_ERRORS_AS_DISPLAYED,
-                   "GNM_PRINT_ERRORS_AS_DISPLAYED", "as-displayed"},
-                 { GNM_PRINT_ERRORS_AS_BLANK,
-                   "GNM_PRINT_ERRORS_AS_BLANK", "as-blank"},
-                 { GNM_PRINT_ERRORS_AS_DASHES,
-                   "GNM_PRINT_ERRORS_AS_DASHES", "as-dashes"},
-                 { GNM_PRINT_ERRORS_AS_NA,
-                   "GNM_PRINT_ERRORS_AS_NA", "as-na"},
-                 { 0, NULL, NULL }
-         };
-         etype = g_enum_register_static ("GnmPrintErrorsType",
-                                         values);
-  }
-  return etype;
+       static GType etype = 0;
+       if (etype == 0) {
+               static GEnumValue const values[] = {
+                       { GNM_PRINT_ERRORS_AS_DISPLAYED,
+                         "GNM_PRINT_ERRORS_AS_DISPLAYED", "as-displayed"},
+                       { GNM_PRINT_ERRORS_AS_BLANK,
+                         "GNM_PRINT_ERRORS_AS_BLANK", "as-blank"},
+                       { GNM_PRINT_ERRORS_AS_DASHES,
+                         "GNM_PRINT_ERRORS_AS_DASHES", "as-dashes"},
+                       { GNM_PRINT_ERRORS_AS_NA,
+                         "GNM_PRINT_ERRORS_AS_NA", "as-na"},
+                       { 0, NULL, NULL }
+               };
+               etype = g_enum_register_static ("GnmPrintErrorsType",
+                                               values);
+       }
+       return etype;
 }
 
 
@@ -289,13 +293,14 @@ load_formats (void)
 
 /**
  * gnm_print_info_load_defaults:
+ * @pi: #GnmPrintInformation
  *
+ * Returns: (skip) (transfer none): @pi
  *
  * NOTE: This reads from a globally stored configuration. If a
  *       configuration is stored along with a sheet then that will
  *       override these global defaults.
  */
-
 GnmPrintInformation *
 gnm_print_info_load_defaults (GnmPrintInformation *res)
 {
@@ -364,9 +369,9 @@ gnm_print_information_new (gboolean load_defaults)
 {
        GnmPrintInformation *res = g_new0 (GnmPrintInformation, 1);
 
-       res->print_as_draft        = FALSE;
+       res->print_as_draft = FALSE;
        res->comment_placement = GNM_PRINT_COMMENTS_IN_PLACE;
-       res->error_display     = GNM_PRINT_ERRORS_AS_DISPLAYED;
+       res->error_display = GNM_PRINT_ERRORS_AS_DISPLAYED;
 
        res->start_page    = -1;
        res->n_copies      = 0;
@@ -1052,6 +1057,16 @@ gnm_print_info_dup (GnmPrintInformation const *src)
 
 #undef COPY
 
+/**
+ * print_info_get_margins:
+ * @pi: #GnmPrintInformation
+ * @top: (out) (optional): top margin.
+ * @bottom: (out) (optional): bottom margin.
+ * @left: (out) (optional): left margin.
+ * @right: (out) (optional): right margin.
+ * @edge_to_below_header: (out) (optional):  margin.
+ * @edge_to_above_footer: (out) (optional):  margin.
+ */
 void
 print_info_get_margins (GnmPrintInformation *pi,
                        double *top, double *bottom,
@@ -1296,7 +1311,7 @@ page_setup_get_paper (GtkPageSetup *page_setup)
        return g_strdup (name);
 }
 
-char  *
+char *
 print_info_get_paper (GnmPrintInformation *pi)
 {
        g_return_val_if_fail (pi != NULL, g_strdup (GTK_PAPER_NAME_A4));
@@ -1314,8 +1329,13 @@ print_info_get_paper_size (GnmPrintInformation *pi)
        return gtk_page_setup_get_paper_size (pi->page_setup);
 }
 
-
-char  const*
+/**
+ * print_info_get_paper_display_name:
+ * @pi: #GnmPrintInformation
+ *
+ * Returns: (transfer none): the name of the selected paper type
+ */
+char const *
 print_info_get_paper_display_name (GnmPrintInformation *pi)
 {
        GtkPaperSize* paper;
@@ -1352,7 +1372,7 @@ print_info_get_paper_height (GnmPrintInformation *pi, GtkUnit unit)
  *
  * Returns: (transfer none): the page setup.
  **/
-GtkPageSetup*
+GtkPageSetup *
 gnm_print_info_get_page_setup (GnmPrintInformation *pi)
 {
        g_return_val_if_fail (pi != NULL, NULL);
@@ -1364,7 +1384,7 @@ gnm_print_info_get_page_setup (GnmPrintInformation *pi)
 /**
  * gnm_print_info_set_page_setup:
  * @pi: #GnmPrintInformation
- * @page_setup: #GtkPageSetup
+ * @page_setup: (transfer full): #GtkPageSetup
  *
  * Absorb a ref to @page_setup.
  *
@@ -1376,7 +1396,8 @@ gnm_print_info_get_page_setup (GnmPrintInformation *pi)
  * 2) Why not copy the page_setup in here and make the arg const ?
  **/
 void
-gnm_print_info_set_page_setup (GnmPrintInformation *pi, GtkPageSetup *page_setup)
+gnm_print_info_set_page_setup (GnmPrintInformation *pi,
+                              GtkPageSetup *page_setup)
 {
        g_return_if_fail (pi != NULL);
 
@@ -1419,9 +1440,7 @@ print_info_set_paper_orientation (GnmPrintInformation *pi,
 /**
  * print_info_set_breaks:
  * @pi: #GnmPrintInformation
- * @breaks: #GnmPageBreaks
- *
- * NOTE : Takes ownership of @breaks.  DO NOT FREE after calling.
+ * @breaks: (transfer full): #GnmPageBreaks
  **/
 void
 print_info_set_breaks (GnmPrintInformation *pi,
@@ -1469,6 +1488,12 @@ gnm_page_breaks_new (gboolean is_vert)
        return res;
 }
 
+/**
+ * gnm_page_breaks_dup:
+ * @src: (transfer none) (nullable): #GnmPageBreak
+ *
+ * Returns: (transfer full) (nullable): A duplicate #GnmPageBreak.
+ */
 GnmPageBreaks *
 gnm_page_breaks_dup (GnmPageBreaks const *src)
 {
@@ -1488,6 +1513,10 @@ gnm_page_breaks_dup (GnmPageBreaks const *src)
                return NULL;
 }
 
+/**
+ * gnm_page_breaks_free:
+ * @breaks: (transfer none) (nullable): #GnmPageBreak
+ */
 void
 gnm_page_breaks_free (GnmPageBreaks *breaks)
 {
@@ -1510,6 +1539,13 @@ gnm_page_breaks_get_type (void)
        return t;
 }
 
+/**
+ * gnm_page_breaks_dup_non_auto_breaks:
+ * @src: (transfer none) (nullable): #GnmPageBreak
+ *
+ * Returns: (transfer full) (nullable): A duplicate #GnmPageBreak, but
+ * containing only non-auto page breaks.
+ */
 GnmPageBreaks *
 gnm_page_breaks_dup_non_auto_breaks (GnmPageBreaks const *src)
 {
@@ -1583,7 +1619,7 @@ gnm_page_breaks_get_break (GnmPageBreaks *breaks,
 
 int
 gnm_page_breaks_get_next_manual_break (GnmPageBreaks *breaks,
-                          int pos)
+                                      int pos)
 {
        guint i;
 
@@ -1601,8 +1637,7 @@ gnm_page_breaks_get_next_manual_break (GnmPageBreaks *breaks,
 }
 
 int
-gnm_page_breaks_get_next_break (GnmPageBreaks *breaks,
-                          int pos)
+gnm_page_breaks_get_next_break (GnmPageBreaks *breaks, int pos)
 {
        guint i;
 
@@ -1685,9 +1720,9 @@ gnm_page_break_type_from_str (char const *str)
 
 /**
  * gnm_page_breaks_clean:
+ * @breaks: (nullable): #GnmPageBreakType
  *
  * Remove all auto page breaks
- *
  **/
 void
 gnm_page_breaks_clean (GnmPageBreaks *breaks)
@@ -1731,7 +1766,7 @@ print_info_set_printtofile_from_settings (GnmPrintInformation *pi,
 
 void
 print_info_set_from_settings (GnmPrintInformation *pi,
-                                         GtkPrintSettings* settings)
+                             GtkPrintSettings* settings)
 {
        pi->print_range = gtk_print_settings_get_int_with_default
                (settings,
@@ -1756,7 +1791,12 @@ print_info_set_printrange (GnmPrintInformation *pi, PrintRange pr)
                pi->print_range = GNM_PRINT_ACTIVE_SHEET;
 }
 
-
+/**
+ * print_info_get_printtofile_uri:
+ * @pi: @GnmPrintInformation
+ *
+ * Returns: (transfer none): The uri used for print-to-file.
+ */
 char const *
 print_info_get_printtofile_uri (GnmPrintInformation *pi)
 {
@@ -1786,4 +1826,3 @@ print_load_repeat_range (char const *str, GnmRange *r, Sheet const *sheet)
        } else
                return FALSE;
 }
-
diff --git a/src/search.c b/src/search.c
index 6414f63..b40f59b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -525,17 +525,17 @@ gnm_search_replace_query_comment (GnmSearchReplace *sr,
 GType
 gnm_search_replace_scope_get_type (void)
 {
-  static GType etype = 0;
-  if (etype == 0) {
-    static const GEnumValue values[] = {
-      { GNM_SRS_WORKBOOK, "GNM_SRS_WORKBOOK", "workbook" },
-      { GNM_SRS_SHEET,    "GNM_SRS_SHEET",    "sheet" },
-      { GNM_SRS_RANGE,    "GNM_SRS_RANGE",    "range" },
-      { 0, NULL, NULL }
-    };
-    etype = g_enum_register_static ("GnmSearchReplaceScope", values);
-  }
-  return etype;
+       static GType etype = 0;
+       if (etype == 0) {
+               static const GEnumValue values[] = {
+                       { GNM_SRS_WORKBOOK, "GNM_SRS_WORKBOOK", "workbook" },
+                       { GNM_SRS_SHEET,    "GNM_SRS_SHEET",    "sheet" },
+                       { GNM_SRS_RANGE,    "GNM_SRS_RANGE",    "range" },
+                       { 0, NULL, NULL }
+               };
+               etype = g_enum_register_static ("GnmSearchReplaceScope", values);
+       }
+       return etype;
 }
 
 /* ------------------------------------------------------------------------- */
diff --git a/src/selection.c b/src/selection.c
index 27336fa..378db8e 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -30,6 +30,9 @@
 #include "commands.h"
 #include "value.h"
 #include "cell.h"
+#include <goffice/goffice.h>
+#include <expr.h>
+#include <graph.h>
 
 /**
  * sv_selection_calc_simplification:
@@ -89,11 +92,12 @@ sv_selection_calc_simplification (SheetView const *sv)
 
 /**
  * sv_is_singleton_selected:
- * @sv:
+ * @sv: #SheetView
  *
  * See if the 1st selected region is a singleton.
  *
- * Returns A GnmCellPos pointer if the selection is a singleton, and NULL if not.
+ * Returns: (transfer none) (nullable): A #GnmCellPos if the selection is
+ * a singleton
  **/
 GnmCellPos const *
 sv_is_singleton_selected (SheetView const *sv)
@@ -111,7 +115,7 @@ sv_is_singleton_selected (SheetView const *sv)
  * @col:
  * @row:
  *
- * Returns: TRUE if the supplied position is selected in view @sv.
+ * Returns: %TRUE if the supplied position is selected in view @sv.
  **/
 gboolean
 sv_is_pos_selected (SheetView const *sv, int col, int row)
@@ -133,7 +137,7 @@ sv_is_pos_selected (SheetView const *sv, int col, int row)
  * @sv:
  * @r:
  *
- * Returns: TRUE If @r overlaps with any part of the selection in @sv.
+ * Returns: %TRUE If @r overlaps with any part of the selection in @sv.
  **/
 gboolean
 sv_is_range_selected (SheetView const *sv, GnmRange const *r)
@@ -155,7 +159,7 @@ sv_is_range_selected (SheetView const *sv, GnmRange const *r)
  * @sv:
  * @r:
  *
- * Returns TRUE if all of @r is contained by the selection in @sv.
+ * Returns: %TRUE if all of @r is contained by the selection in @sv.
  **/
 gboolean
 sv_is_full_range_selected (SheetView const *sv, GnmRange const *r)
@@ -393,8 +397,8 @@ sv_menu_enable_insert (SheetView *sv, gboolean col, gboolean row)
  * @cc: The command context to report errors to
  * @cmd_name: A string naming the operation requiring a single range.
  *
- * Returns the first range, if a control is supplied it displays an error if
- *    there is more than one range.
+ * Returns: (transfer none): the first range, if a control is supplied it
+ * displays an error if there is more than one range.
  **/
 GnmRange const *
 selection_first_range (SheetView const *sv,
@@ -1237,7 +1241,7 @@ sheet_selection_is_allowed (Sheet const *sheet, GnmCellPos const *pos)
  * @smart_merge: iterate into merged cells only at their corners
  * @res: The result.
  *
- * Returns: TRUE if the cursor leaves the boundary region.
+ * Returns: %TRUE if the cursor leaves the boundary region.
  */
 static gboolean
 walk_boundaries (SheetView const *sv, GnmRange const * const bound,
@@ -1426,10 +1430,6 @@ sv_selection_walk_step (SheetView *sv, gboolean forward, gboolean horizontal)
        gnm_sheet_view_make_cell_visible (sv, destination.col, destination.row, FALSE);
 }
 
-#include <goffice/goffice.h>
-#include <expr.h>
-#include <graph.h>
-
 /* characterize a vector based on the last non-blank cell in the range.
  * optionally expand the vector to merge multiple string vectors */
 static gboolean
diff --git a/src/sheet-object.c b/src/sheet-object.c
index c3b9737..39ba941 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -459,7 +459,7 @@ GSF_CLASS (SheetObject, sheet_object,
  * @so: #SheetObject
  * @container: #SheetObjectViewContainer
  *
- * Returns: (transfer none): the found #SheetObjectView or %NULL.
+ * Returns: (transfer none) (nullable): the found #SheetObjectView or %NULL.
  **/
 SheetObjectView *
 sheet_object_get_view (SheetObject const *so, SheetObjectViewContainer *container)
@@ -901,8 +901,8 @@ cell_offset_calc_pt (Sheet const *sheet, int i, gboolean is_col, double offset)
 /**
  * sheet_object_default_size:
  * @so: The sheet object
- * @w: a ptr into which to store the default_width.
- * @h: a ptr into which to store the default_height.
+ * @w: (out): a ptr into which to store the default_width.
+ * @h: (out): a ptr into which to store the default_height.
  *
  * Measurements are in pts.
  **/
@@ -919,7 +919,7 @@ sheet_object_default_size (SheetObject *so, double *w, double *h)
 /**
  * sheet_object_position_pts_get:
  * @so: The sheet object
- * @coords: array of 4 doubles
+ * @coords: (out) (array fixed-size=4): coordinates
  *
  * Calculate the position of the object @so in pts from the logical position in
  * the object.
@@ -1106,7 +1106,7 @@ clear_sheet (SheetObject *so, GOUndo **pundo)
  * @rinfo: details on what should be moved.
  * @update: Should we do the bound_update now, or leave it for later.
  *             if FALSE honour the move_with_cells flag.
- * @pundo: if non-NULL add dropped objects to ::objects
+ * @pundo: (optional) (out): add dropped objects to ::objects
  *
  * Uses the relocation info and the anchors to decide whether or not, and how
  * to relocate objects when the grid moves (eg ins/del col/row).
@@ -1213,6 +1213,8 @@ sheet_objects_get (Sheet const *sheet, GnmRange const *r, GType t)
  * sheet_objects_clear:
  * @sheet: the sheet.
  * @r: (nullable): #GnmRange to look in
+ * @t #GType
+ * @pundo: (out) (nullable):
  *
  * Removes the objects in the region.
  **/
@@ -1240,7 +1242,8 @@ sheet_objects_clear (Sheet const *sheet, GnmRange const *r, GType t,
  * sheet_object_dup:
  * @so: a #SheetObject to duplicate
  *
- * Returns: (transfer full): A copy of @so that is not attached to a sheet.
+ * Returns: (transfer full) (nullable): A copy of @so that is not attached
+ * to a sheet.
  **/
 SheetObject *
 sheet_object_dup (SheetObject const *so)


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