[monkey-bubble: 471/753] New function.



commit cfe7f3eba67a00a3f43ad4b81a5ad15fd3e95687
Author: Martin Baulig <baulig suse de>
Date:   Fri Jun 15 22:44:54 2001 +0000

    New function.
    
    2001-06-16  Martin Baulig  <baulig suse de>
    
    	* bonobo-config-ditem-utils.c (bonobo_config_ditem_get_subtype):
    	New function.
    
    	* bonobo-config-ditem.c (real_get_type): New static function; this
    	uses bonobo_config_ditem_get_subtype() if we're accessing structure
    	fields.
    	(dir_lookup_entry, dir_lookup_subdir): Implemented `create'.

 monikers/ChangeLog    |   10 +++
 monikers/test-ditem.c |  159 +++++++++++++++++++-----------------------------
 2 files changed, 73 insertions(+), 96 deletions(-)
---
diff --git a/monikers/ChangeLog b/monikers/ChangeLog
index 650df4d..5014004 100644
--- a/monikers/ChangeLog
+++ b/monikers/ChangeLog
@@ -1,3 +1,13 @@
+2001-06-16  Martin Baulig  <baulig suse de>
+
+	* bonobo-config-ditem-utils.c (bonobo_config_ditem_get_subtype):
+	New function.
+
+	* bonobo-config-ditem.c (real_get_type): New static function; this
+	uses bonobo_config_ditem_get_subtype() if we're accessing structure
+	fields.
+	(dir_lookup_entry, dir_lookup_subdir): Implemented `create'.
+
 2001-06-10  Cody Russell  <bratsche gnome org>
 
 	* desktop-item-boot.c, test-ditem.c: Add #include <stdlib.h> for exit().
diff --git a/monikers/test-ditem.c b/monikers/test-ditem.c
index 68f14eb..929f221 100644
--- a/monikers/test-ditem.c
+++ b/monikers/test-ditem.c
@@ -81,9 +81,34 @@ test_ditem (Bonobo_ConfigDatabase db)
 	gnome_desktop_item_save (ditem, NULL);
 #endif
 
-	// gnome_desktop_item_save (ditem, "~/work/foo.desktop");
+	gnome_desktop_item_save (ditem, "~/work/foo.desktop");
 }
 
+#if 0
+static void G_GNUC_UNUSED
+test_builtin (void)
+{
+	Bonobo_ConfigDatabase db, parent_db;
+	CORBA_Environment ev;
+	CORBA_TypeCode type;
+	BonoboArg *value;
+	gchar *string;
+
+	db = bonobo_config_ditem_new ("/home/martin/work/test.desktop");
+	g_assert (db != CORBA_OBJECT_NIL);
+
+	CORBA_exception_init (&ev);
+	parent_db = bonobo_get_object ("xmldb:~/work/foo.xmldb", "Bonobo/ConfigDatabase", &ev);
+	g_assert (!BONOBO_EX (&ev) && parent_db != CORBA_OBJECT_NIL);
+	CORBA_exception_free (&ev);
+
+	CORBA_exception_init (&ev);
+	Bonobo_ConfigDatabase_addDatabase (db, parent_db, "", &ev);
+	g_assert (!BONOBO_EX (&ev));
+	CORBA_exception_free (&ev);
+}
+#endif
+
 int
 main (int argc, char **argv)
 {
@@ -93,6 +118,7 @@ main (int argc, char **argv)
         CORBA_Environment  ev;
 	CORBA_TypeCode type;
 	CORBA_any *value;
+	gchar *string;
 	guint i, j;
 
         CORBA_exception_init (&ev);
@@ -104,6 +130,8 @@ main (int argc, char **argv)
 
 	bonobo_activate ();
 
+	// test_builtin ();
+
 	// db = bonobo_config_ditem_new ("~/work/test.desktop");
 
         CORBA_exception_init (&ev);
@@ -167,115 +195,54 @@ main (int argc, char **argv)
         CORBA_exception_free (&ev);
 
         CORBA_exception_init (&ev);
-	Bonobo_ConfigDatabase_sync (db, &ev);
-        CORBA_exception_free (&ev);
+	type = bonobo_pbclient_get_type (db, "/Foo/Test", &ev);
+	if (type)
+		g_message (G_STRLOC ": type is %d - %s (%s)", type->kind, type->name, type->repo_id);
+	CORBA_exception_free (&ev);
 
         CORBA_exception_init (&ev);
-	value = bonobo_pbclient_get_value (db, "/Desktop Entry", TC_GNOME_DesktopEntry, &ev);
-	g_message (G_STRLOC ": %p", value);
-	if (value)
-		printf ("got value as string (%s)\n", BONOBO_ARG_GET_STRING (value));
+	value = bonobo_pbclient_get_value (db, "/Foo/Test", TC_CORBA_long, &ev);
+	if (value) {
+		g_message (G_STRLOC ": got value as long %d", BONOBO_ARG_GET_LONG (value));
+		BONOBO_ARG_SET_LONG (value, 512);
+		bonobo_pbclient_set_value (db, "/Foo/Test", value, &ev);
+	}
+	bonobo_arg_release (value);
         CORBA_exception_free (&ev);
 
         CORBA_exception_init (&ev);
-	value = bonobo_pbclient_get_value (db, "/Desktop Entry",
-					   TC_GNOME_LocalizedStringList, &ev);
-	g_message (G_STRLOC ": %p", value);
-	if (value)
-		printf ("got value as string (%s)\n", BONOBO_ARG_GET_STRING (value));
-        CORBA_exception_free (&ev);
-
-	exit (0);
+	type = bonobo_pbclient_get_type (db, "/Desktop Entry/Terminal", &ev);
+	if (type)
+		g_message (G_STRLOC ": type is %d - %s (%s)", type->kind, type->name, type->repo_id);
+	CORBA_exception_free (&ev);
 
         CORBA_exception_init (&ev);
+	type = bonobo_pbclient_get_type (db, "/Desktop Entry/Name", &ev);
+	if (type)
+		g_message (G_STRLOC ": type is %d - %s (%s)", type->kind, type->name, type->repo_id);
+	CORBA_exception_free (&ev);
 
-	value = bonobo_pbclient_get_value (db, "/storagetype",
-					   TC_Bonobo_StorageType, &ev);
-	if (value) {
-		printf ("got value\n");
-	}
         CORBA_exception_init (&ev);
+	type = bonobo_pbclient_get_type (db, "/Desktop Entry/URL", &ev);
+	if (type)
+		g_message (G_STRLOC ": type is %d - %s (%s)", type->kind, type->name, type->repo_id);
+	CORBA_exception_free (&ev);
 
-	value = bonobo_arg_new (TC_CORBA_long);
-	BONOBO_ARG_SET_LONG (value, 5);
-	
-	Bonobo_ConfigDatabase_setValue (db, "/test", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level2", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level21", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level3/level3", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/bonobo/test1", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	value = bonobo_arg_new (TC_Bonobo_StorageType);
-	
-	Bonobo_ConfigDatabase_setValue (db, "/storagetype", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	value = bonobo_arg_new (TC_CORBA_string);
-	BONOBO_ARG_SET_STRING (value, "a simple test");
-	Bonobo_ConfigDatabase_setValue (db, "a/b/c/d", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_removeDir (db, "/", &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	value = bonobo_arg_new (TC_CORBA_long);
-	BONOBO_ARG_SET_LONG (value, 5);
-	
-	Bonobo_ConfigDatabase_setValue (db, "/test", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level2", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level21", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-	Bonobo_ConfigDatabase_setValue (db, "/test/level3/level3", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
-
-
-	value = bonobo_arg_new (TC_Bonobo_StorageType);
-	Bonobo_ConfigDatabase_setValue (db, "/storagetype", value, &ev);
-	g_assert (!BONOBO_EX (&ev));
+	string = bonobo_pbclient_get_string (db, "/Desktop Entry/URL", NULL);
+	g_message (G_STRLOC ": |%s|", string);
+	bonobo_pbclient_set_string (db, "/Desktop Entry/URL", "http://www.gnome.org/";, NULL);
 
+	CORBA_exception_init (&ev);
 	Bonobo_ConfigDatabase_sync (db, &ev);
 	g_assert (!BONOBO_EX (&ev));
+        CORBA_exception_free (&ev);
 
-
-	/*
-	{
-		BonoboConfigBag     *config_bag;
-		Bonobo_Unknown       bag, v;
-		char *name;
-
-		config_bag = bonobo_config_bag_new (db, "/bonobo");
-
-		g_assert (config_bag);
-
-		bag = BONOBO_OBJREF (config_bag);
-
-		prop =Bonobo_PropertyBag_getPropertyByName (bag, "test1", &ev);
-		g_assert (!BONOBO_EX (&ev));
-	    
-	
-		printf("TEST3\n");
-		name = Bonobo_Property_getName (prop, &ev);
-		printf("TEST3e %s\n", name);
-		g_assert (!BONOBO_EX (&ev));
-
-
-	}
-	*/
-		
+        CORBA_exception_init (&ev);
+	value = bonobo_pbclient_get_value (db, "/Desktop Entry", TC_GNOME_DesktopEntry, &ev);
+	g_message (G_STRLOC ": %p", value);
+	if (value)
+		printf ("got value as GNOME::DesktopEntry\n");
+        CORBA_exception_free (&ev);
 
 	exit (0);
 }



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