[goffice] GogObject: mess with explicitly_typed_role.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GogObject: mess with explicitly_typed_role.
- Date: Wed, 21 Jan 2015 18:19:25 +0000 (UTC)
commit bdc50b6f137277837f48edc4df37d58ca6368560
Author: Morten Welinder <terra gnome org>
Date: Wed Jan 21 13:18:45 2015 -0500
GogObject: mess with explicitly_typed_role.
It's unclear why we need this.
ChangeLog | 8 +++++++-
goffice/graph/gog-object.c | 19 +++++++------------
2 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9bcfeab..444a837 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-21 Morten Welinder <terra gnome org>
+
+ * goffice/graph/gog-object.c (gog_object_add_by_role): Only
+ consider this explicitly_typed_role if the child type is not the
+ default.
+
2015-01-19 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-axis.c (gog_axis_class_init): fixed typo in default map
@@ -19163,7 +19169,7 @@
2003-08-21 Jody Goldberg <jody gnome org>
* graph/gog-object-xml.c (gog_object_new_from_xml) : don't mark newly
- reconstituted objects as explititly typed unless they really were.
+ reconstituted objects as explicitly typed unless they really were.
(gog_dataset_save) : patch leak.
* graph/gog-object.c (gog_object_dup) : new.
diff --git a/goffice/graph/gog-object.c b/goffice/graph/gog-object.c
index ca56e03..f9ace6d 100644
--- a/goffice/graph/gog-object.c
+++ b/goffice/graph/gog-object.c
@@ -1749,14 +1749,13 @@ gog_object_set_parent (GogObject *child, GogObject *parent,
* @child: (transfer full) (allow-none): #GogObject
*
* Absorb a ref to @child if it is non-NULL.
- * Returns: (transfer none): @child or a newly created object with @role. Callers do _not_ own
- * the reference.
+ * Returns: (transfer none): @child or a newly created object with @role.
**/
GogObject *
gog_object_add_by_role (GogObject *parent, GogObjectRole const *role, GogObject *child)
{
GType is_a;
- gboolean const explicitly_typed_role = (child != NULL);
+ gboolean explicitly_typed_role;
g_return_val_if_fail (role != NULL, NULL);
g_return_val_if_fail (GOG_OBJECT (parent) != NULL, NULL);
@@ -1765,15 +1764,11 @@ gog_object_add_by_role (GogObject *parent, GogObjectRole const *role, GogObject
g_return_val_if_fail (is_a != 0, NULL);
-
-#if 0
- /* do not perform a not allowed addition */
- if (role->can_add != NULL && !(role->can_add) (parent)) {
- if (child)
- g_object_unref (child);
- return NULL;
- }
-#endif
+ /*
+ * It's unclear why we need this flag; just set is to indicate a non-default
+ * type. We used to set for any pre-allocated child.
+ */
+ explicitly_typed_role = (child && G_OBJECT_TYPE (child) != is_a);
if (child == NULL) {
child = (role->allocate)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]