[monkey-bubble: 383/753] Implemented getDirs() and getKeys().



commit a54dbb1853587c8fe5c34dba39fc1b9e871202ce
Author: Martin Baulig <martin src gnome org>
Date:   Tue Jun 5 13:22:13 2001 +0000

    Implemented getDirs() and getKeys().

 monikers/test-ditem.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/monikers/test-ditem.c b/monikers/test-ditem.c
index ac504e7..27db061 100644
--- a/monikers/test-ditem.c
+++ b/monikers/test-ditem.c
@@ -6,18 +6,54 @@ int
 main (int argc, char **argv)
 {
 	Bonobo_ConfigDatabase db = NULL;
+	Bonobo_KeyList *dirlist, *keylist;
         CORBA_Environment  ev;
 	CORBA_any *value;
+	guint i, j;
 
         CORBA_exception_init (&ev);
 
 	if (bonobo_init (&argc, argv) == FALSE)
 		g_error ("Cannot init bonobo");
 
-	db = bonobo_config_ditem_new ("/tmp/t.desktop");
+#if 1
+	db = bonobo_config_ditem_new ("~/work/test.desktop");
+#else
+        CORBA_exception_init (&ev);
+	db = bonobo_get_object ("xmldb:~/work/foo.xml", "Bonobo/ConfigDatabase", &ev);
+	g_assert (!BONOBO_EX (&ev));
+        CORBA_exception_free (&ev);
+#endif
 
 	g_assert (db != NULL);
 
+        CORBA_exception_init (&ev);
+
+	dirlist = Bonobo_ConfigDatabase_getDirs (db, "", &ev);
+	g_assert (!BONOBO_EX (&ev));
+
+	if (dirlist) {
+	    for (i = 0; i < dirlist->_length; i++) {
+		g_print ("DIR: |%s|\n", dirlist->_buffer [i]);
+
+		keylist = Bonobo_ConfigDatabase_getKeys (db, dirlist->_buffer [i], &ev);
+		g_assert (!BONOBO_EX (&ev));
+
+		if (keylist)
+		    for (j = 0; j < keylist->_length; j++)
+			g_print ("KEY (%s): |%s|\n", dirlist->_buffer [i], keylist->_buffer [j]);
+	    }
+	}
+
+	keylist = Bonobo_ConfigDatabase_getKeys (db, "/Config/Foo", &ev);
+	g_assert (!BONOBO_EX (&ev));
+
+	if (keylist)
+	    for (j = 0; j < keylist->_length; j++)
+		g_print ("TEST KEY: |%s|\n", keylist->_buffer [j]);
+
+	exit (0);
+
 	value = bonobo_pbclient_get_value (db, "/test", TC_long, &ev);
 
 	if (value) {



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