[goffice] Don' use g_array_unref. [#627056]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Don' use g_array_unref. [#627056]
- Date: Mon, 16 Aug 2010 16:42:02 +0000 (UTC)
commit 49d065f17e157e168e54e8befe9a427a846827a8
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Aug 16 18:42:40 2010 +0200
Don' use g_array_unref. [#627056]
ChangeLog | 6 ++++++
goffice/graph/gog-theme.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d4a738c..1cd9677 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-16 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-theme.c (gog_theme_finalize),
+ (map_area_series_solid_palette), (name_end), (elem_start): use g_ptr_array
+ instead of g_array and don't use recent glib additions. [#627056]
+
2010-08-15 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-theme.c (build_predefined_themes): fixed typo (no
diff --git a/goffice/graph/gog-theme.c b/goffice/graph/gog-theme.c
index 7334b7b..c9f161f 100644
--- a/goffice/graph/gog-theme.c
+++ b/goffice/graph/gog-theme.c
@@ -184,7 +184,7 @@ struct _GogTheme {
GHashTable *elem_hash_by_class;
GHashTable *class_aliases;
GOStyle *default_style;
- GArray *palette;
+ GPtrArray *palette;
};
typedef GObjectClass GogThemeClass;
@@ -237,8 +237,8 @@ gog_theme_finalize (GObject *obj)
g_hash_table_destroy (theme->class_aliases);
if (theme->palette) {
for (i = 0; i < theme->palette->len; i++)
- g_object_unref (g_array_index (theme->palette, GObject*, i));
- g_array_unref (theme->palette);
+ g_object_unref (g_ptr_array_index (theme->palette, i));
+ g_ptr_array_free (theme->palette, TRUE);
}
(parent_klass->finalize) (obj);
@@ -598,7 +598,7 @@ map_area_series_solid_palette (GOStyle *style, unsigned ind, GogTheme const *the
src = theme->default_style;
else {
ind %= theme->palette->len;
- src = g_array_index (theme->palette, GOStyle*, ind);
+ src = g_ptr_array_index (theme->palette, ind);
}
if (src)
go_style_apply_theme (style, src, style->interesting_fields);
@@ -977,7 +977,7 @@ name_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (state->lang == NULL) {
GOStyle *style;
state->theme = gog_theme_new (name);
- state->theme->palette = g_array_new (FALSE, FALSE, sizeof (GOStyle*));
+ state->theme->palette = g_ptr_array_new ();
/* initialize a dummy GogSeries style */
style = go_style_new ();
style->line.dash_type = GO_LINE_SOLID;
@@ -1040,7 +1040,7 @@ elem_start (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
go_persist_prep_sax (GO_PERSIST (style), xin, attrs);
if (class_name && !strcmp (class_name, "GogSeries"))
- state->theme->palette = g_array_append_val (state->theme->palette, style);
+ g_ptr_array_add (state->theme->palette, style);
else
gog_theme_add_element (state->theme, style, NULL, class_name, role);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]