[gnumeric] Compilation: prefer glib functions over goffice equivalents



commit 920bdb892969a03d3cc3431409f143bcad2c57a3
Author: Morten Welinder <terra gnome org>
Date:   Tue May 8 12:58:00 2018 -0400

    Compilation: prefer glib functions over goffice equivalents

 configure.ac                         |    8 ++++----
 plugins/openoffice/openoffice-read.c |    6 +++---
 src/commands.c                       |   12 ++++++++----
 src/format-template.c                |    5 +++--
 src/sheet-object-component.c         |    2 +-
 src/sheet-object-graph.c             |    3 +--
 src/sheet-object-image.c             |    2 +-
 src/stf-parse.c                      |    7 +++++--
 src/tools/scenarios.c                |    4 ++--
 src/workbook.c                       |    4 ++--
 10 files changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1498afd..060822c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,10 +171,10 @@ libspreadsheet_reqs="
        libxml-2.0              >= 2.4.12
 "
 gnumeric_reqs="$libspreadsheet_reqs
-       glib-2.0                >= 2.38.0
-       gobject-2.0             >= 2.38.0
-       gmodule-2.0             >= 2.38.0
-       gthread-2.0             >= 2.38.0
+       glib-2.0                >= 2.40.0
+       gobject-2.0             >= 2.40.0
+       gmodule-2.0             >= 2.40.0
+       gthread-2.0             >= 2.40.0
        pango                   >= 1.24.0
        pangocairo              >= 1.24.0
 "
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index fee11b1..63f741f 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3384,9 +3384,9 @@ static OOCellStyle *
 odf_oo_cell_style_copy (OOCellStyle *oostyle)
 {
        OOCellStyle *new = odf_oo_cell_style_new (oostyle->style);
-       new->styles = go_slist_map (oostyle->styles, (GOMapFunc)odf_oo_cell_style_ref);
-       new->conditions = go_slist_map (oostyle->conditions, (GOMapFunc)g_strdup);
-       new->bases = go_slist_map (oostyle->bases, (GOMapFunc)g_strdup);
+       new->styles = g_slist_copy_deep (oostyle->styles, (GCopyFunc)odf_oo_cell_style_ref, NULL);
+       new->conditions = g_slist_copy_deep (oostyle->conditions, (GCopyFunc)g_strdup, NULL);
+       new->bases = g_slist_copy_deep (oostyle->bases, (GCopyFunc)g_strdup, NULL);
        return new;
 }
 
diff --git a/src/commands.c b/src/commands.c
index 32d7c05..0a018f3 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2926,7 +2926,9 @@ static GSList *
 get_new_objects (Sheet *sheet, GSList *old)
 {
        GSList *objs =
-               g_slist_sort (go_slist_map (sheet->sheet_objects, g_object_ref),
+               g_slist_sort (g_slist_copy_deep (sheet->sheet_objects,
+                                                (GCopyFunc)g_object_ref,
+                                                NULL),
                              by_addr);
        GSList *p = objs, *last = NULL;
 
@@ -3008,8 +3010,9 @@ cmd_paste_copy_impl (GnmCommand *cmd, WorkbookControl *wbc,
                // We cannot use the random set of objects at the target
                // location.  http://bugzilla.gnome.org/show_bug.cgi?id=308300
                g_slist_free_full (contents->objects, g_object_unref);
-               contents->objects = go_slist_map (me->orig_contents_objects,
-                                                 (GOMapFunc)sheet_object_dup);
+               contents->objects = g_slist_copy_deep
+                       (me->orig_contents_objects,
+                        (GCopyFunc)sheet_object_dup, NULL);
        } else {
                GSList *l;
                for (l = contents->objects; l; l = l->next) {
@@ -3104,7 +3107,8 @@ cmd_paste_copy (WorkbookControl *wbc,
        me->only_objects = (cr->cols < 1 || cr->rows < 1);
        me->pasted_objects = NULL;
        me->orig_contents_objects =
-               go_slist_map (cr->objects, (GOMapFunc)sheet_object_dup);
+               g_slist_copy_deep (cr->objects,
+                                  (GCopyFunc)sheet_object_dup, NULL);
        me->single_merge_to_single_merge = FALSE;
 
        /* If the input is only objects ignore all this range stuff */
diff --git a/src/format-template.c b/src/format-template.c
index d44ad3f..a74e6d5 100644
--- a/src/format-template.c
+++ b/src/format-template.c
@@ -314,8 +314,9 @@ gnm_ft_clone (GnmFT const *ft)
 
        clone->category    = ft->category;
 
-       clone->members = go_slist_map (ft->members,
-                                      (GOMapFunc)gnm_ft_member_clone);
+       clone->members =
+               g_slist_copy_deep (ft->members,
+                                  (GCopyFunc)gnm_ft_member_clone, NULL);
 
        clone->number    = ft->number;
        clone->border    = ft->border;
diff --git a/src/sheet-object-component.c b/src/sheet-object-component.c
index 81731c0..db832fe 100644
--- a/src/sheet-object-component.c
+++ b/src/sheet-object-component.c
@@ -274,7 +274,7 @@ gnm_soc_populate_menu (SheetObject *so, GPtrArray *actions)
        GNM_SO_CLASS (parent_klass)->populate_menu (so, actions);
 
        for (i = 0; i < G_N_ELEMENTS (soc_actions); i++)
-               go_ptr_array_insert (actions, (gpointer) (soc_actions + i), 1 + i);
+               g_ptr_array_insert (actions, 1 + i, (gpointer)(soc_actions + i));
 }
 
 static void
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index edde92d..12eced1 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -407,8 +407,7 @@ gnm_sog_populate_menu (SheetObject *so, GPtrArray *actions)
        GNM_SO_CLASS (parent_klass)->populate_menu (so, actions);
 
        for (i = 0; i < G_N_ELEMENTS (sog_actions); i++)
-               go_ptr_array_insert (actions, (gpointer) (sog_actions + i), 1 + i);
-
+               g_ptr_array_insert (actions, 1 + i, (gpointer) (sog_actions + i));
 }
 
 static void
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 0b742cc..67f74a4 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -345,7 +345,7 @@ gnm_soi_populate_menu (SheetObject *so, GPtrArray *actions)
        static SheetObjectAction const soi_action =
                { "document-save-as", N_("_Save As Image"), NULL, 0, soi_cb_save_as };
        gnm_soi_parent_class->populate_menu (so, actions);
-       go_ptr_array_insert (actions, (gpointer) &soi_action, 1);
+       g_ptr_array_insert (actions, 1, (gpointer) &soi_action);
 }
 
 static void
diff --git a/src/stf-parse.c b/src/stf-parse.c
index 05b64e1..e658fde 100644
--- a/src/stf-parse.c
+++ b/src/stf-parse.c
@@ -259,8 +259,10 @@ static void
 compile_terminators (StfParseOptions_t *parseoptions)
 {
        GSList *l;
-       GO_SLIST_SORT (parseoptions->terminator, (GCompareFunc)long_string_first);
 
+       parseoptions->terminator =
+               g_slist_sort (parseoptions->terminator,
+                             (GCompareFunc)long_string_first);
        parseoptions->compiled_terminator.min = 255;
        parseoptions->compiled_terminator.max = 0;
        for (l = parseoptions->terminator; l; l = l->next) {
@@ -339,7 +341,8 @@ stf_parse_options_csv_set_separators (StfParseOptions_t *parseoptions,
        parseoptions->sep.chr = g_strdup (character);
 
        g_slist_free_full (parseoptions->sep.str, g_free);
-       parseoptions->sep.str = go_slist_map (seps, (GOMapFunc)g_strdup);
+       parseoptions->sep.str =
+               g_slist_copy_deep ((GSList *)seps, (GCopyFunc)g_strdup, NULL);
 }
 
 void
diff --git a/src/tools/scenarios.c b/src/tools/scenarios.c
index 998a9a7..175d8b2 100644
--- a/src/tools/scenarios.c
+++ b/src/tools/scenarios.c
@@ -172,8 +172,8 @@ gnm_scenario_dup (GnmScenario *src, Sheet *new_sheet)
 
        dst = gnm_scenario_new (src->name, new_sheet);
        gnm_scenario_set_comment (dst, src->comment);
-       dst->items = go_slist_map (src->items,
-                                  (GOMapFunc)gnm_scenario_item_dup);
+       dst->items = g_slist_copy_deep
+               (src->items, (GCopyFunc)gnm_scenario_item_dup, NULL);
        return dst;
 }
 
diff --git a/src/workbook.c b/src/workbook.c
index 68704ee..e4b5623 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -1004,7 +1004,7 @@ workbook_sheet_attach_at_pos (Workbook *wb, Sheet *new_sheet, int pos)
        pre_sheet_index_change (wb);
 
        g_object_ref (new_sheet);
-       go_ptr_array_insert (wb->sheets, (gpointer)new_sheet, pos);
+       g_ptr_array_insert (wb->sheets, pos, (gpointer)new_sheet);
        workbook_sheet_index_update (wb, pos);
        g_hash_table_insert (wb->sheet_hash_private,
                             new_sheet->name_case_insensitive,
@@ -1178,7 +1178,7 @@ workbook_sheet_move (Sheet *sheet, int direction)
                int max_pos = MAX (old_pos, new_pos);
 
                g_ptr_array_remove_index (wb->sheets, old_pos);
-               go_ptr_array_insert (wb->sheets, sheet, new_pos);
+               g_ptr_array_insert (wb->sheets, new_pos, sheet);
 
                for (; max_pos >= min_pos ; max_pos--) {
                        Sheet *sheet = g_ptr_array_index (wb->sheets, max_pos);


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