summaryrefslogtreecommitdiffstats
path: root/src/id-clash.cpp
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2019-05-23 08:06:12 +0000
committerShlomi Fish <shlomif@shlomifish.org>2019-06-06 12:57:27 +0000
commitcb8c36249e983866378e7915e6605ef92d247923 (patch)
tree53ec0a0745250375aaeb4b5a52f821380ccb614a /src/id-clash.cpp
parentCI: Avoid failure due to sorting issue (diff)
downloadinkscape-cb8c36249e983866378e7915e6605ef92d247923.tar.gz
inkscape-cb8c36249e983866378e7915e6605ef92d247923.zip
Refactoring: call setAttribute() directly.
Call this->setAttribute(...) directly instead of this->getRepr()->setAttribute(...). This avoids clutter and mental indirection. See http://wiki.inkscape.org/wiki/index.php?title=Refactoring_projects&oldid=112116 and https://en.wikipedia.org/wiki/Law_of_Demeter . --- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
Diffstat (limited to '')
-rw-r--r--src/id-clash.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/id-clash.cpp b/src/id-clash.cpp
index 75154391b..95c43166c 100644
--- a/src/id-clash.cpp
+++ b/src/id-clash.cpp
@@ -227,7 +227,7 @@ change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc,
}
// Change to the new ID
- elem->getRepr()->setAttribute("id", new_id);
+ elem->setAttribute("id", new_id);
// Make a note of this change, if we need to fix up refs to it
if (refmap.find(old_id) != refmap.end())
id_changes->push_back(id_changeitem_type(elem, old_id));
@@ -259,7 +259,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes)
switch (it->type) {
case REF_HREF: {
gchar *new_uri = g_strdup_printf("#%s", obj->getId());
- it->elem->getRepr()->setAttribute(it->attr, new_uri);
+ it->elem->setAttribute(it->attr, new_uri);
g_free(new_uri);
break;
}
@@ -269,7 +269,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes)
}
case REF_URL: {
gchar *url = g_strdup_printf("url(#%s)", obj->getId());
- it->elem->getRepr()->setAttribute(it->attr, url);
+ it->elem->setAttribute(it->attr, url);
g_free(url);
break;
}
@@ -280,7 +280,7 @@ fix_up_refs(refmap_type const &refmap, const id_changelist_type &id_changes)
g_free(url);
Glib::ustring style_string;
sp_repr_css_write_string(style, style_string);
- it->elem->getRepr()->setAttribute("style", style_string);
+ it->elem->setAttribute("style", style_string);
break;
}
}
@@ -327,7 +327,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj)
switch (it->type) {
case REF_HREF: {
gchar *new_uri = g_strdup_printf("#%s", to_obj->getId());
- it->elem->getRepr()->setAttribute(it->attr, new_uri);
+ it->elem->setAttribute(it->attr, new_uri);
g_free(new_uri);
break;
}
@@ -337,7 +337,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj)
}
case REF_URL: {
gchar *url = g_strdup_printf("url(#%s)", to_obj->getId());
- it->elem->getRepr()->setAttribute(it->attr, url);
+ it->elem->setAttribute(it->attr, url);
g_free(url);
break;
}
@@ -348,7 +348,7 @@ change_def_references(SPObject *from_obj, SPObject *to_obj)
g_free(url);
Glib::ustring style_string;
sp_repr_css_write_string(style, style_string);
- it->elem->getRepr()->setAttribute("style", style_string);
+ it->elem->setAttribute("style", style_string);
break;
}
}
@@ -394,7 +394,7 @@ void rename_id(SPObject *elem, Glib::ustring const &new_name)
}
g_free (id);
// Change to the new ID
- elem->getRepr()->setAttribute("id", new_name2);
+ elem->setAttribute("id", new_name2);
// Make a note of this change, if we need to fix up refs to it
id_changelist_type id_changes;
if (refmap.find(old_id) != refmap.end()) {