diff options
Diffstat (limited to 'libjava/classpath/native/jni/gconf-peer')
-rw-r--r-- | libjava/classpath/native/jni/gconf-peer/.cvsignore | 6 | ||||
-rw-r--r-- | libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c | 117 | ||||
-rw-r--r-- | libjava/classpath/native/jni/gconf-peer/Makefile.in | 11 |
3 files changed, 115 insertions, 19 deletions
diff --git a/libjava/classpath/native/jni/gconf-peer/.cvsignore b/libjava/classpath/native/jni/gconf-peer/.cvsignore new file mode 100644 index 00000000000..799fc97856d --- /dev/null +++ b/libjava/classpath/native/jni/gconf-peer/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +*.lo +*.la +Makefile +Makefile.in diff --git a/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c b/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c index a442226cae6..42986c33a89 100644 --- a/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c +++ b/libjava/classpath/native/jni/gconf-peer/GConfNativePeer.c @@ -108,8 +108,8 @@ static jclass get_jlist_reference (JNIEnv * env, jclass jlist_class); * Method: init_class * Signature: ()V */ -JNIEXPORT void -JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1class +JNIEXPORT void JNICALL +Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1class (JNIEnv *env, jclass clazz) { if (reference_count == 0) @@ -127,8 +127,8 @@ JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1class * Method: init_id_chache * Signature: ()V */ -JNIEXPORT void -JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache +JNIEXPORT void JNICALL +Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache (JNIEnv *env, jclass clazz __attribute__ ((unused))) { reference_count++; @@ -157,16 +157,19 @@ JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_init_1id_1cache /* * Class: gnu_java_util_prefs_gconf_GConfNativePeer - * Method: gconf_client_gconf_client_all_keys + * Method: gconf_client_all_keys * Signature: (Ljava/lang/String;)Ljava/util/List; */ JNIEXPORT jobject JNICALL -Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1keys +Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1all_1keys (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node) { /* TODO: check all the calls to gdk_threads_enter/leave */ const char *dir = NULL; + const char *_val = NULL; + const char *_val_unescaped = NULL; + GError *err = NULL; GSList *entries = NULL; GSList *tmp; @@ -208,12 +211,18 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all tmp = entries; while (tmp != NULL) { - const char *_val = gconf_entry_get_key (tmp->data); + _val = gconf_entry_get_key (tmp->data); _val = strrchr (_val, '/'); ++_val; + + _val_unescaped = gconf_unescape_key (_val, strlen (_val)); + (*env)->CallBooleanMethod (env, jlist, jlist_add_id, - (*env)->NewStringUTF (env, _val)); + (*env)->NewStringUTF (env, _val_unescaped)); + tmp = g_slist_next (tmp); + + g_free ((gpointer) _val_unescaped); } /* clean up things */ @@ -226,14 +235,17 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all /* * Class: gnu_java_util_prefs_gconf_GConfNativePeer - * Method: gconf_client_gconf_client_all_nodes + * Method: gconf_client_all_nodes * Signature: (Ljava/lang/String;)Ljava/util/List; */ JNIEXPORT jobject JNICALL -Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all_1nodes +Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1all_1nodes (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring node) { const char *dir = NULL; + const char *_val = NULL; + const char *_val_unescaped = NULL; + GError *err = NULL; GSList *entries = NULL; GSList *tmp; @@ -274,12 +286,19 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1gconf_1client_1all tmp = entries; while (tmp != NULL) { - const char *_val = tmp->data; + _val = tmp->data; + _val = strrchr (_val, '/'); ++_val; + + _val_unescaped = gconf_unescape_key (_val, strlen (_val)); + (*env)->CallBooleanMethod (env, jlist, jlist_add_id, - (*env)->NewStringUTF (env, _val)); + (*env)->NewStringUTF (env, _val_unescaped)); + tmp = g_slist_next (tmp); + + g_free ((gpointer) _val_unescaped); } /* clean up things */ @@ -421,7 +440,7 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1set_1string gdk_threads_leave (); if (err != NULL) { - g_error_free (err); + g_error_free (err); err = NULL; result = JNI_FALSE; } @@ -511,8 +530,8 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1dir_1exists * Method: finalize_class * Signature: ()V */ -JNIEXPORT void -JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_finalize_1class +JNIEXPORT void JNICALL +Java_gnu_java_util_prefs_gconf_GConfNativePeer_finalize_1class (JNIEnv *env, jclass clazz __attribute__ ((unused))) { if (reference_count == 0) @@ -534,6 +553,74 @@ JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_finalize_1class reference_count--; } +/* + * Class: gnu_java_util_prefs_gconf_GConfNativePeer + * Method: Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1escape_1key + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jstring JNICALL +Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1escape_1key + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring plain) +{ + const char *escaped = NULL; + const char *_plain = NULL; + jstring result = NULL; + + _plain = JCL_jstring_to_cstring (env, plain); + if (_plain == NULL) + { + return NULL; + } + + gdk_threads_enter (); + escaped = gconf_escape_key (_plain, strlen (_plain)); + gdk_threads_leave (); + + JCL_free_cstring (env, plain, _plain); + /* check for NULL, if so prevent string creation */ + if (escaped != NULL) + { + result = (*env)->NewStringUTF (env, escaped); + g_free ((gpointer) escaped); + } + + return result; +} + +/* + * Class: gnu_java_util_prefs_gconf_GConfNativePeer + * Method: Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1unescape_1key + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jstring JNICALL +Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1unescape_1key + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring escaped) +{ + const char *plain = NULL; + const char *_escaped = NULL; + jstring result = NULL; + + _escaped = JCL_jstring_to_cstring (env, escaped); + if (_escaped == NULL) + { + return NULL; + } + + gdk_threads_enter (); + plain = gconf_unescape_key (_escaped, strlen (_escaped)); + gdk_threads_leave (); + + JCL_free_cstring (env, escaped, _escaped); + /* check for NULL, if so prevent string creation */ + if (plain != NULL) + { + result = (*env)->NewStringUTF (env, plain); + g_free ((gpointer) plain); + } + + return result; +} + /* ***** END: NATIVE FUNCTIONS ***** */ /* ***** PRIVATE FUNCTIONS IMPLEMENTATION ***** */ diff --git a/libjava/classpath/native/jni/gconf-peer/Makefile.in b/libjava/classpath/native/jni/gconf-peer/Makefile.in index 2e95e299d60..2e4074c778f 100644 --- a/libjava/classpath/native/jni/gconf-peer/Makefile.in +++ b/libjava/classpath/native/jni/gconf-peer/Makefile.in @@ -42,12 +42,14 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \ $(top_srcdir)/../../config/lead-dot.m4 \ + $(top_srcdir)/../../config/no-executables.m4 \ $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \ $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \ $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -185,6 +187,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@ +JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@ +JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@ JAY = @JAY@ JAY_SKELETON = @JAY_SKELETON@ JIKES = @JIKES@ @@ -306,7 +310,6 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -toolexeclibdir = @toolexeclibdir@ vm_classes = @vm_classes@ nativeexeclib_LTLIBRARIES = libgconfpeer.la libgconfpeer_la_SOURCES = GConfNativePeer.c |