I've update the GConf backend to use the GConfClient api instead of
directly invoking GConfEngine.
This change was needed as since the last update of the GConf daemon in
Fedora I was flooded of g_warning messages telling me that I should
never use GConfEngine directly...
I introduced GConfEngine because of some synchronization issues, but I
also moved the code that was giving me troubles outside of the native
peer (read as: java methods are now synchronized).
If you experience threading issues, please tell me. I've tested with few
apps and everything seems ok, but I would like to know if there are
issues on Maemo and OpenMoko (Robert Schuster: ping!).
This update is compatible with OpenJDK.
I'm working on adding few more gadgets to this backend, like automatic
notification if the preferences are changed by another GConfClient (I'm
talking about changes outside the java scope; currently the changes are
visible by the application, but notification is not sent across
registered listener).
As a final note, yesterday I forgot to remove one header file from
include, this patch fixes that.
Thanks,
Mario
2008-02-09 Mario Torre <[EMAIL PROTECTED]>
* include/java_util_VMTimeZone.h: Removed.
* native/jni/gconf-peer/GConfNativePeer.c: all native methods, replaced
GConfEngine with GConfClient and use GConfClient API instead.
--
Lima Software - http://www.limasoftware.net/
GNU Classpath Developer - http://www.classpath.org/
Fedora Ambassador - http://fedoraproject.org/wiki/MarioTorre
Jabber: [EMAIL PROTECTED]
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/
### Eclipse Workspace Patch 1.0
#P classpath
Index: include/java_util_VMTimeZone.h
===================================================================
RCS file: include/java_util_VMTimeZone.h
diff -N include/java_util_VMTimeZone.h
--- include/java_util_VMTimeZone.h 31 Aug 2004 21:06:48 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#ifndef __java_util_VMTimeZone__
-#define __java_util_VMTimeZone__
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-JNIEXPORT jstring JNICALL Java_java_util_VMTimeZone_getSystemTimeZoneId (JNIEnv *env, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __java_util_VMTimeZone__ */
Index: native/jni/gconf-peer/GConfNativePeer.c
===================================================================
RCS file: /sources/classpath/classpath/native/jni/gconf-peer/GConfNativePeer.c,v
retrieving revision 1.10
diff -u -r1.10 GConfNativePeer.c
--- native/jni/gconf-peer/GConfNativePeer.c 23 Nov 2007 22:02:15 -0000 1.10
+++ native/jni/gconf-peer/GConfNativePeer.c 9 Feb 2008 18:49:40 -0000
@@ -55,8 +55,8 @@
/** Reference count */
static int reference_count = 0;
-/** GConfEngine backend */
-static GConfEngine *engine = NULL;
+/** GConfClient backend */
+static GConfClient *client = NULL;
/** java.util.ArrayList class */
static jclass jlist_class = NULL;
@@ -70,7 +70,7 @@
/* ***** PRIVATE FUNCTIONS DELCARATION ***** */
/**
- * Gets the reference of the default GConfEngine..
+ * Gets the reference of the default GConfClient..
* The client reference should be released with g_object_unref after use.
*/
static void init_gconf (void);
@@ -133,12 +133,12 @@
init_gconf ();
- /* if engine is null, there is probably an out of memory */
- if (engine == NULL)
+ /* if client is null, there is probably an out of memory */
+ if (client == NULL)
{
/* release the string and throw a runtime exception */
throw_exception (env,
- "Unable to initialize GConfEngine in native code\n");
+ "Unable to initialize GConfClient in native code\n");
return;
}
@@ -179,7 +179,7 @@
return NULL;
}
- entries = gconf_engine_all_entries (engine, dir, &err);
+ entries = gconf_client_all_entries (client, dir, &err);
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -253,7 +253,7 @@
return NULL;
}
- entries = gconf_engine_all_dirs (engine, dir, &err);
+ entries = gconf_client_all_dirs (client, dir, &err);
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -312,7 +312,7 @@
{
GError *err = NULL;
- gconf_engine_suggest_sync (engine, &err);
+ gconf_client_suggest_sync (client, &err);
if (err != NULL)
{
throw_exception_by_name (env, "java/util/prefs/BackingStoreException",
@@ -341,7 +341,7 @@
return JNI_FALSE;
}
- result = gconf_engine_unset (engine, _key, &err);
+ result = gconf_client_unset (client, _key, &err);
if (err != NULL)
{
result = JNI_FALSE;
@@ -374,7 +374,7 @@
return NULL;
}
- _value = gconf_engine_get_string (engine, _key, &err);
+ _value = gconf_client_get_string (client, _key, &err);
JCL_free_cstring (env, key, _key);
if (err != NULL)
{
@@ -394,7 +394,7 @@
g_free ((gpointer) _value);
}
- gconf_engine_suggest_sync (engine, NULL);
+ gconf_client_suggest_sync (client, NULL);
return result;
}
@@ -423,7 +423,7 @@
return JNI_FALSE;
}
- result = gconf_engine_set_string (engine, _key, _value, &err);
+ result = gconf_client_set_string (client, _key, _value, &err);
if (err != NULL)
{
g_error_free (err);
@@ -455,7 +455,7 @@
return value;
/* on error return false */
- value = gconf_engine_dir_exists (engine, dir, &err);
+ value = gconf_client_dir_exists (client, dir, &err);
if (err != NULL)
value = JNI_FALSE;
@@ -476,7 +476,7 @@
if (reference_count == 0)
{
/* last reference, free all resources and return */
- g_object_unref (G_OBJECT (engine));
+ g_object_unref (G_OBJECT (client));
(*env)->DeleteGlobalRef (env, jlist_class);
@@ -571,7 +571,7 @@
static void init_gconf (void)
{
- engine = gconf_engine_get_default ();
+ client = gconf_client_get_default ();
}
static gboolean set_jlist_class (JNIEnv *env)