glom r1472 - in trunk: . glom/libglom/document
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1472 - in trunk: . glom/libglom/document
- Date: Wed, 26 Mar 2008 16:44:50 +0000 (GMT)
Author: murrayc
Date: Wed Mar 26 16:44:50 2008
New Revision: 1472
URL: http://svn.gnome.org/viewvc/glom?rev=1472&view=rev
Log:
2008-03-26 Murray Cumming <murrayc murrayc com>
* glom/libglom/document/document_glom.cc:
* glom/libglom/document/document_glom.h:
Remove append_newline().
save_before(): Stop using append_newline() - it never worked anyway.
Use add_indenting_white_space_to_node() which was just added to Bakery.
This makes the .glom files have nice readable indenting again.
Modified:
trunk/ChangeLog
trunk/glom/libglom/document/document_glom.cc
trunk/glom/libglom/document/document_glom.h
Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc (original)
+++ trunk/glom/libglom/document/document_glom.cc Wed Mar 26 16:44:50 2008
@@ -223,9 +223,8 @@
set_dtd_root_node_name("glom_document");
- //Don't add newlines automatically, because we have text nodes that this might affect:
- //It doesn't seem to work anyway.
- //set_write_formatted(); //Make the output more human-readable, just in case.
+ //We don't use set_write_formatted() because it doesn't handle text nodes well.
+ //We use add_indenting_white_space_to_node() instead later.
//Set default database name:
//This is also the XML attribute default value,
@@ -1180,11 +1179,6 @@
return Gnome::Gda::Value();
}
-void Document_Glom::append_newline(xmlpp::Element* parent_node)
-{
- parent_node->add_child_text("\n");
-}
-
Document_Glom::type_listTableInfo Document_Glom::get_tables(bool plus_system_prefs) const
{
type_listTableInfo result;
@@ -3056,7 +3050,6 @@
set_node_attribute_value_as_bool(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_TRY_OTHER_PORTS, m_connection_try_other_ports, true /* default */);
set_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_USER, m_connection_user);
set_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_DATABASE, m_connection_database);
- append_newline(nodeRoot);
//Remove existing tables:
xmlpp::Node::NodeList listNodes = nodeRoot->get_children(GLOM_NODE_TABLE);
@@ -3154,12 +3147,8 @@
//Translations:
save_before_translations(elemField, *field);
-
- append_newline(elemFields);
} /* fields */
- append_newline(nodeTable);
-
//Relationships:
//Add new <relationships> node:
xmlpp::Element* elemRelationships = nodeTable->add_child(GLOM_NODE_RELATIONSHIPS);
@@ -3180,14 +3169,9 @@
//Translations:
save_before_translations(elemRelationship, *relationship);
-
- append_newline(elemRelationships);
}
}
- append_newline(nodeTable);
-
-
//Layouts:
xmlpp::Element* nodeDataLayouts = nodeTable->add_child(GLOM_NODE_DATA_LAYOUTS);
@@ -3205,14 +3189,9 @@
for(type_list_layout_groups::const_iterator iterGroups = groups.begin(); iterGroups != groups.end(); ++iterGroups)
{
save_before_layout_group(nodeGroups, *iterGroups);
- append_newline(nodeGroups);
}
-
- append_newline(nodeDataLayouts);
}
- append_newline(nodeTable);
-
//Reports:
xmlpp::Element* nodeReports = nodeTable->add_child(GLOM_NODE_REPORTS);
@@ -3229,14 +3208,10 @@
if(report->m_layout_group)
{
save_before_layout_group(nodeGroups, report->m_layout_group);
- append_newline(nodeGroups);
}
//Translations:
save_before_translations(nodeReport, *report);
-
- append_newline(nodeReports);
- append_newline(nodeReports);
}
//Print Layouts:
@@ -3267,21 +3242,13 @@
if(print_layout->m_layout_group)
{
save_before_layout_group(nodeGroups, print_layout->m_layout_group, true /* x,y positions too. */);
- append_newline(nodeGroups);
}
//Translations:
save_before_translations(nodePrintLayout, *print_layout);
-
- append_newline(nodePrintLayout);
}
-
- append_newline(nodeTable);
- append_newline(nodeTable);
}
- append_newline(nodeRoot);
-
} //for m_tables
@@ -3318,9 +3285,6 @@
}
}
- append_newline(nodeRoot);
-
-
//Remove existing library modules::
listNodes = nodeRoot->get_children(GLOM_NODE_LIBRARY_MODULES);
for(xmlpp::Node::NodeList::iterator iter = listNodes.begin(); iter != listNodes.end(); ++iter)
@@ -3340,10 +3304,12 @@
set_node_attribute_value(nodeModule, GLOM_ATTRIBUTE_LIBRARY_MODULE_SCRIPT, script);
}
- append_newline(nodeRoot);
-
}
+
+ //We don't use set_write_formatted() because it doesn't handle text nodes well.
+ add_indenting_white_space_to_node();
+
return Bakery::Document_XML::save_before();
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
Modified: trunk/glom/libglom/document/document_glom.h
==============================================================================
--- trunk/glom/libglom/document/document_glom.h (original)
+++ trunk/glom/libglom/document/document_glom.h Wed Mar 26 16:44:50 2008
@@ -406,8 +406,6 @@
Glib::ustring get_child_text_node(const xmlpp::Element* node, const Glib::ustring& child_node_name) const;
void set_child_text_node(xmlpp::Element* node, const Glib::ustring& child_node_name, const Glib::ustring& text);
- void append_newline(xmlpp::Element* parent_node);
-
AppState m_app_state;
type_signal_userlevel_changed m_signal_userlevel_changed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]