[libgda/LIBGDA_4.2] Take into account the GDA_TREE_DUMP_ALL_ATTRIBUTES



commit bf24a2ea341a23464f12d4a0f091b2f87508cd52
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon May 9 18:47:07 2011 +0200

    Take into account the GDA_TREE_DUMP_ALL_ATTRIBUTES
    
    to dump all the attributes of each node of a GdaTree

 doc/C/libgda-4.0-docs.sgml |    7 ++++++-
 libgda/gda-tree-node.c     |   38 ++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/doc/C/libgda-4.0-docs.sgml b/doc/C/libgda-4.0-docs.sgml
index 67fb94d..256eba9 100644
--- a/doc/C/libgda-4.0-docs.sgml
+++ b/doc/C/libgda-4.0-docs.sgml
@@ -601,11 +601,16 @@
 		<link linkend="gda-data-model-dump">gda_data_model_dump()</link> will also include a description of
 	      the data model's attributes</para>
 	    </listitem>
-	  <listitem>
+	    <listitem>
               <para>GDA_CONFIG_SYNCHRONOUS: if set, and if the Gnome Keyring is used to store DSN authentification information,
 		then the requests to the Gnome Keyring will be made synchronously. This is usefull if Libgda is used in a program where
 		there is no main loop (otherwise no authentification will be fetched).</para>
             </listitem>
+	    <listitem>
+              <para>GDA_TREE_DUMP_ALL_ATTRIBUTES: if set, then 
+		<link linkend="gda-tree-dump">gda_tree_dump()</link> will dump all the attributes of each
+		node in the tree</para>
+	    </listitem>
 	  </itemizedlist>
 	</para>
       </sect1>
diff --git a/libgda/gda-tree-node.c b/libgda/gda-tree-node.c
index b8e9f81..da692d6 100644
--- a/libgda/gda-tree-node.c
+++ b/libgda/gda-tree-node.c
@@ -379,7 +379,6 @@ gda_tree_node_get_property (GObject *object,
 	}	
 }
 
-#ifdef GDA_DEBUG_NO
 static void
 attributes_foreach_func (const gchar *att_name, const GValue *value, GString *string)
 {
@@ -387,8 +386,6 @@ attributes_foreach_func (const gchar *att_name, const GValue *value, GString *st
 	g_string_append_printf (string, " %s=%s", att_name, str);
 	g_free (str);
 }
-#endif
-
 
 static gchar *
 gda_tree_node_dump_header (GdaTreeNode *node)
@@ -397,23 +394,24 @@ gda_tree_node_dump_header (GdaTreeNode *node)
 
 	cvalue = gda_attributes_manager_get (gda_tree_node_attributes_manager, node,
 					     GDA_ATTRIBUTE_NAME);
-#ifdef GDA_DEBUG_NO
-	GString *string;
-	string = g_string_new ("");
-	if (cvalue)
-		g_string_append (string, g_value_get_string (cvalue));
-	else
-		g_string_append (string, "Unnamed node");
-	g_string_append_c (string, ':');
-	gda_attributes_manager_foreach (gda_tree_node_attributes_manager, node,
-					(GdaAttributesManagerFunc) attributes_foreach_func, string);
-	return g_string_free (string, FALSE);
-#else
-	if (cvalue)
-		return g_strdup (g_value_get_string (cvalue));
-	else
-		return g_strdup_printf ("Unnamed node");
-#endif
+	if (g_getenv ("GDA_TREE_DUMP_ALL_ATTRIBUTES")) {
+		GString *string;
+		string = g_string_new ("");
+		if (cvalue && (G_VALUE_TYPE (cvalue) == G_TYPE_STRING))
+			g_string_append (string, g_value_get_string (cvalue));
+		else
+			g_string_append (string, "Unnamed node");
+		g_string_append_c (string, ':');
+		gda_attributes_manager_foreach (gda_tree_node_attributes_manager, node,
+						(GdaAttributesManagerFunc) attributes_foreach_func, string);
+		return g_string_free (string, FALSE);
+	}
+	else {
+		if (cvalue)
+			return g_strdup (g_value_get_string (cvalue));
+		else
+			return g_strdup_printf ("Unnamed node");
+	}
 }
 
 



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