From 57633551c56fe333e8a7332228c845c063a0ccc8 Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Tue, 12 Dec 2000 20:50:05 +0000 Subject: [PATCH] r=ashuk a=edburns bug=62436 Add the ability to set string, int, and bool prefs. Needs more functionality. The following files are in this bug: A classes_spec/org/mozilla/webclient/Preferences.java A classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java A src_moz/PreferencesImpl.cpp M classes_spec/org/mozilla/webclient/BrowserControlImpl.java M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java M src_moz/Makefile.in M src_moz/Makefile.win M src_moz/WrapperFactoryImpl.cpp M src_moz/motif/NativeLoaderStub.cpp M src_share/Makefile.in M src_share/Makefile.win git-svn-id: svn://10.0.0.236/branches/JAVADEV_RTM_20001102@83546 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mozilla/webclient/BrowserControlImpl.java | 18 +- .../org/mozilla/webclient/Preferences.java | 33 ++++ .../org/mozilla/webclient/test/EMWindow.java | 8 +- .../wrapper_native/PreferencesImpl.java | 163 ++++++++++++++++++ .../wrapper_native/WrapperFactoryImpl.java | 6 +- mozilla/java/webclient/src_moz/Makefile.in | 1 + mozilla/java/webclient/src_moz/Makefile.win | 1 + .../webclient/src_moz/PreferencesImpl.cpp | 122 +++++++++++++ .../webclient/src_moz/WrapperFactoryImpl.cpp | 1 + .../src_moz/motif/NativeLoaderStub.cpp | 65 ++++--- mozilla/java/webclient/src_share/Makefile.in | 2 + mozilla/java/webclient/src_share/Makefile.win | 7 +- 12 files changed, 401 insertions(+), 26 deletions(-) create mode 100644 mozilla/java/webclient/classes_spec/org/mozilla/webclient/Preferences.java create mode 100644 mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java create mode 100644 mozilla/java/webclient/src_moz/PreferencesImpl.cpp diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java index 2fe1bf1ce8a..f2264208616 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/BrowserControlImpl.java @@ -70,6 +70,7 @@ private WindowControl windowControl = null; private Navigation navigation = null; private History history = null; private static Bookmarks bookmarks = null; +private static Preferences prefs = null; // // Constructors and Initializers @@ -126,8 +127,8 @@ void delete() ((ImplObject)windowControl).delete(); windowControl = null; - // since bookmarks is static, we must not deallocate it here. That - // is done in the static method appTerminate + // since bookmarks and prefs are static, we must not deallocate them + // here. That is done in the static method appTerminate } @@ -152,6 +153,10 @@ static void appTerminate() throws Exception ((ImplObject)bookmarks).delete(); bookmarks = null; } + if (null != prefs) { + ((ImplObject)prefs).delete(); + prefs = null; + } wrapperFactory.terminate(); } @@ -269,6 +274,13 @@ public Object queryInterface(String interfaceName) throws ClassNotFoundException } return bookmarks; } + if (PREFERENCES_NAME.equals(interfaceName)) { + if (null == prefs) { + prefs = (Preferences) + wrapperFactory.newImpl(PREFERENCES_NAME, this); + } + return prefs; + } // extensibility mechanism: just see if wrapperFactory can make one! return wrapperFactory.newImpl(interfaceName, this); } @@ -284,7 +296,7 @@ public static void main(String [] args) Assert.setEnabled(true); Log.setApplicationName("BrowserControlImpl"); Log.setApplicationVersion("0.0"); - Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.3 2000-07-22 02:48:23 edburns%acm.org Exp $"); + Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.3.8.1 2000-12-12 20:49:52 edburns%acm.org Exp $"); } diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/Preferences.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/Preferences.java new file mode 100644 index 00000000000..de438e7365d --- /dev/null +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/Preferences.java @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is RaptorCanvas. + * + * The Initial Developer of the Original Code is Kirk Baker and + * Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are + * Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All + * Rights Reserved. + * + * Contributor(s): Ed Burns + */ + +package org.mozilla.webclient; + +import java.util.Properties; + +public interface Preferences +{ + public void setPref(String prefName, String prefValue); + public Properties getPrefs(); +} +// end of interface Preferences + diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java index 92bc42c4a4e..f3136602e09 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java @@ -57,7 +57,7 @@ import java.io.FileInputStream; * This is a test application for using the BrowserControl. * - * @version $Id: EMWindow.java,v 1.24.2.9 2000-12-12 01:11:15 edburns%acm.org Exp $ + * @version $Id: EMWindow.java,v 1.24.2.10 2000-12-12 20:50:01 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlFactory @@ -76,6 +76,7 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc private Navigation navigation = null; private CurrentPage currentPage; private History history; + private static Preferences prefs; private Bookmarks bookmarks; private BookmarksFrame bookmarksFrame = null; private TreeModel bookmarksTree; @@ -295,6 +296,11 @@ private UniversalDialog uniDialog = null; browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME); history = (History) browserControl.queryInterface(BrowserControl.HISTORY_NAME); + prefs = (Preferences) + browserControl.queryInterface(BrowserControl.PREFERENCES_NAME); + prefs.setPref("network.cookie.warnAboutCookies", "true"); + prefs.setPref("browser.cache.disk_cache_size", "0"); + //prefs.setPref("network.proxy.http", "webcache-mpk.eng.sun.com"); } catch (Exception e) { diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java new file mode 100644 index 00000000000..69e4e5b8025 --- /dev/null +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/PreferencesImpl.java @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is RaptorCanvas. + * + * The Initial Developer of the Original Code is Kirk Baker and + * Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are + * Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All + * Rights Reserved. + * + * Contributor(s): Ed Burns + */ + +package org.mozilla.webclient.wrapper_native; + +import org.mozilla.util.Assert; +import org.mozilla.util.Log; +import org.mozilla.util.ParameterCheck; + +import org.mozilla.webclient.BrowserControl; +import org.mozilla.webclient.WrapperFactory; +import org.mozilla.webclient.Preferences; + +import java.util.Properties; + +import org.mozilla.webclient.UnimplementedException; + +public class PreferencesImpl extends ImplObjectNative implements Preferences +{ +// +// Constants +// + +// +// Class Variables +// + +// +// Instance Variables +// + +// Attribute Instance Variables + +// Relationship Instance Variables + +// +// Constructors and Initializers +// + +public PreferencesImpl(WrapperFactory yourFactory, + BrowserControl yourBrowserControl) +{ + super(yourFactory, yourBrowserControl); +} + +/** + + * Since this class is a singleton, we don't expect this method to be + * called until the app is done with bookmarks for a considerable amount + * of time. + +// PENDING(): Write test case to see that a cycle of Preferences +// allocation/destruction/new instance allocation works correctly. + + */ + +public void delete() +{ +} + +// +// Class methods +// + +// +// General Methods +// + +// +// Methods from Preferences +// + +public void setPref(String prefName, String prefValue) +{ + if (null == prefName) { + return; + } + if (null == prefValue) { + return; + } + // determine the type of pref value: String, boolean, integer + try { + Integer intVal = Integer.valueOf(prefValue); + nativeSetIntPref(prefName, intVal.intValue()); + } + catch (NumberFormatException e) { + // it's not an integer + if (prefValue.equals("true") || prefValue.equals("false")) { + Boolean boolVal = Boolean.valueOf(prefValue); + nativeSetBoolPref(prefName, boolVal.booleanValue()); + } + else { + // it must be a string + nativeSetUnicharPref(prefName, prefValue); + } + } +} + +public Properties getPrefs() +{ + return null; +} + + +// +// native methods +// + +public native void nativeSetUnicharPref(String prefName, String prefValue); +public native void nativeSetIntPref(String prefName, int prefValue); +public native void nativeSetBoolPref(String prefName, boolean prefValue); + +// ----VERTIGO_TEST_START + +// +// Test methods +// + +public static void main(String [] args) +{ + Assert.setEnabled(true); + + Log.setApplicationName("PreferencesImpl"); + Log.setApplicationVersion("0.0"); + Log.setApplicationVersionDate("$Id: PreferencesImpl.java,v 1.1.2.1 2000-12-12 20:49:55 edburns%acm.org Exp $"); + + try { + org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]); + org.mozilla.webclient.BrowserControl control = + org.mozilla.webclient.BrowserControlFactory.newBrowserControl(); + Assert.assert(control != null); + + Preferences wc = (Preferences) + control.queryInterface(org.mozilla.webclient.BrowserControl.WINDOW_CONTROL_NAME); + Assert.assert(wc != null); + } + catch (Exception e) { + System.out.println("got exception: " + e.getMessage()); + } +} + +// ----VERTIGO_TEST_END + +} // end of class PreferencesImpl diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java index 88e689f1cd4..d886399519b 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/wrapper_native/WrapperFactoryImpl.java @@ -140,6 +140,10 @@ public Object newImpl(String interfaceName, result = new BookmarksImpl(this, browserControl); return result; } + if (BrowserControl.PREFERENCES_NAME == interfaceName) { + result = new PreferencesImpl(this, browserControl); + return result; + } } return result; @@ -222,7 +226,7 @@ public static void main(String [] args) WrapperFactory me = new WrapperFactoryImpl(); Log.setApplicationName("WrapperFactoryImpl"); Log.setApplicationVersion("0.0"); - Log.setApplicationVersionDate("$Id: WrapperFactoryImpl.java,v 1.3 2000-11-02 23:33:13 edburns%acm.org Exp $"); + Log.setApplicationVersionDate("$Id: WrapperFactoryImpl.java,v 1.3.2.1 2000-12-12 20:49:55 edburns%acm.org Exp $"); } diff --git a/mozilla/java/webclient/src_moz/Makefile.in b/mozilla/java/webclient/src_moz/Makefile.in index 3435f90581b..e7be368232a 100644 --- a/mozilla/java/webclient/src_moz/Makefile.in +++ b/mozilla/java/webclient/src_moz/Makefile.in @@ -61,6 +61,7 @@ CPPSRCS = \ wsRDFObserver.cpp \ WindowControlImpl.cpp \ WindowControlActionEvents.cpp \ + PreferencesImpl.cpp \ WrapperFactoryImpl.cpp \ motif/MotifBrowserControlCanvas.cpp \ motif/gtkmozilla.cpp \ diff --git a/mozilla/java/webclient/src_moz/Makefile.win b/mozilla/java/webclient/src_moz/Makefile.win index dcaeaeef704..3f63b31fc7c 100644 --- a/mozilla/java/webclient/src_moz/Makefile.win +++ b/mozilla/java/webclient/src_moz/Makefile.win @@ -51,6 +51,7 @@ OBJS = \ .\$(OBJDIR)\RDFTreeNode.obj \ .\$(OBJDIR)\RDFActionEvents.obj \ .\$(OBJDIR)\wsRDFObserver.obj \ + .\$(OBJDIR)\PreferencesImpl.obj \ .\$(OBJDIR)\ISupportsPeer.obj \ $(NULL) diff --git a/mozilla/java/webclient/src_moz/PreferencesImpl.cpp b/mozilla/java/webclient/src_moz/PreferencesImpl.cpp new file mode 100644 index 00000000000..cc7b31cd346 --- /dev/null +++ b/mozilla/java/webclient/src_moz/PreferencesImpl.cpp @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is RaptorCanvas. + * + * The Initial Developer of the Original Code is Kirk Baker and + * Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are + * Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All + * Rights Reserved. + * + * Contributor(s): Ed Burns + */ + +#include "PreferencesImpl.h" +#include "nsIPref.h" + +#include "ns_util.h" + +static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetUnicharPref +(JNIEnv *env, jobject obj, jstring prefName, jstring prefValue) +{ + nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + const char * prefNameChars = (char *) ::util_GetStringUTFChars(env, + prefName); + const jchar * prefValueChars = (jchar *) ::util_GetStringChars(env, + prefValue); + nsresult rv = NS_ERROR_FAILURE; + + if (!prefs) { + ::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: can't get prefs service"); + return; + } + if (nsnull == prefNameChars) { + ::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref name"); + return; + } + if (nsnull == prefValueChars) { + ::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: unable to extract Java string for pref value"); + return; + } + rv = prefs->SetUnicharPref(prefNameChars, (const PRUnichar *) prefValueChars); + ::util_ReleaseStringUTFChars(env, prefName, prefNameChars); + ::util_ReleaseStringChars(env, prefName, prefValueChars); + + if (NS_FAILED(rv)) { + // PENDING(edburns): set a more specific kind of pref + ::util_ThrowExceptionToJava(env, "nativeSetUnicharPref: can't set pref"); + } + + return; +} + + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetIntPref +(JNIEnv *env, jobject obj, jstring prefName, jint prefValue) +{ + nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + const char * prefNameChars = (char *) ::util_GetStringUTFChars(env, + prefName); + nsresult rv = NS_ERROR_FAILURE; + + if (!prefs) { + ::util_ThrowExceptionToJava(env, "nativeSetIntPref: can't get prefs service"); + return; + } + if (nsnull == prefNameChars) { + ::util_ThrowExceptionToJava(env, "nativeSetIntPref: unable to extract Java string"); + return; + } + rv = prefs->SetIntPref(prefNameChars, (PRInt32) prefValue); + ::util_ReleaseStringUTFChars(env, prefName, prefNameChars); + + if (NS_FAILED(rv)) { + // PENDING(edburns): set a more specific kind of pref + ::util_ThrowExceptionToJava(env, "nativeSetIntPref: can't set pref"); + } + + return; +} + + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetBoolPref +(JNIEnv *env, jobject obj, jstring prefName, jboolean prefValue) +{ + nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + const char * prefNameChars = (char *) ::util_GetStringUTFChars(env, + prefName); + nsresult rv = NS_ERROR_FAILURE; + + if (!prefs) { + ::util_ThrowExceptionToJava(env, "nativeSetBoolPref: can't get prefs service"); + return; + } + if (nsnull == prefNameChars) { + ::util_ThrowExceptionToJava(env, "nativeSetBoolPref: unable to extract Java string"); + return; + } + rv = prefs->SetBoolPref(prefNameChars, (PRBool) prefValue); + ::util_ReleaseStringUTFChars(env, prefName, prefNameChars); + + if (NS_FAILED(rv)) { + // PENDING(edburns): set a more specific kind of pref + ::util_ThrowExceptionToJava(env, "nativeSetBoolPref: can't set pref"); + } + + return; +} + diff --git a/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp b/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp index 244b86f3e3b..68561cf5cbe 100644 --- a/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp +++ b/mozilla/java/webclient/src_moz/WrapperFactoryImpl.cpp @@ -43,6 +43,7 @@ const char *gImplementedInterfaces[] = { "webclient.History", "webclient.EventRegistration", "webclient.Bookmarks", + "webclient.Preferences", nsnull }; diff --git a/mozilla/java/webclient/src_moz/motif/NativeLoaderStub.cpp b/mozilla/java/webclient/src_moz/motif/NativeLoaderStub.cpp index 4d1358320ad..26fcf39a2ca 100644 --- a/mozilla/java/webclient/src_moz/motif/NativeLoaderStub.cpp +++ b/mozilla/java/webclient/src_moz/motif/NativeLoaderStub.cpp @@ -39,6 +39,7 @@ #include // JNI Headers #include "BookmarksImpl.h" +#include "PreferencesImpl.h" #include "CurrentPageImpl.h" #include "HistoryImpl.h" #include "ISupportsPeer.h" @@ -111,6 +112,10 @@ void (* nativeProcessEvents) (JNIEnv *, jobject, jint); // from BookmarksImpl.h jint (* nativeGetBookmarks) (JNIEnv *, jobject, jint); jint (* nativeNewRDFNode) (JNIEnv *, jobject, jint, jstring, jboolean); +// from PreferencesImpl.h +void (* nativeSetUnicharPref) (JNIEnv *env, jobject obj, jstring, jstring); +void (* nativeSetIntPref) (JNIEnv *env, jobject obj, jstring, jint); +void (* nativeSetBoolPref) (JNIEnv *env, jobject obj, jstring, jboolean); // from CurrentPageImpl.h void (* nativeCopyCurrentSelectionToSystemClipboard) (JNIEnv *, jobject, jint); void (* nativeFindInPage) (JNIEnv *, jobject, jint, jstring, jboolean, jboolean); @@ -152,8 +157,7 @@ jint (* nativeNextElement) (JNIEnv *, jobject, jint, jint); jint (* nativeGetChildAt) (JNIEnv *, jobject, jint, jint, jint); jint (* nativeGetChildCount) (JNIEnv *, jobject, jint, jint); jint (* nativeGetIndex) (JNIEnv *, jobject, jint, jint, jint); -void (* nativeInsertElementAt) (JNIEnv *, jobject, jint, jint, jint, jobject, jint); -jint (* nativeNewFolder) (JNIEnv *, jobject, jint, jint, jobject); +void (* nativeInsertElementAt) (JNIEnv *, jobject, jint, jint, jint, jint); jboolean (* nativeIsContainer) (JNIEnv *, jobject, jint, jint); jboolean (* nativeIsLeaf) (JNIEnv *, jobject, jint, jint); jstring (* nativeToString) (JNIEnv *, jobject, jint, jint); @@ -231,14 +235,10 @@ void locateBrowserControlStubFunctions(void * dll) { if (!nativeGetIndex) { printf("got dlsym error %s\n", dlerror()); } - nativeInsertElementAt = (void (*) (JNIEnv *, jobject, jint, jint, jint, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeInsertElementAt"); + nativeInsertElementAt = (void (*) (JNIEnv *, jobject, jint, jint, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeInsertElementAt"); if (!nativeInsertElementAt) { printf("got dlsym error %s\n", dlerror()); } - nativeNewFolder = (jint (*) (JNIEnv *, jobject, jint, jint, jobject)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeNewFolder"); - if (!nativeNewFolder) { - printf("got dlsym error %s\n", dlerror()); - } nativeIsContainer = (jboolean (*) (JNIEnv *, jobject, jint, jint)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeIsContainer"); if (!nativeIsContainer) { printf("got dlsym error %s\n", dlerror()); @@ -394,6 +394,18 @@ void locateBrowserControlStubFunctions(void * dll) { if (!nativeNewRDFNode) { printf("got dlsym error %s\n", dlerror()); } + nativeSetUnicharPref = (void (*) (JNIEnv *env, jobject obj, jstring, jstring)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_PrefrencesImpl_nativeSetUnicharPref"); + if (!nativeSetUnicharPref) { + printf("got dlsym error %s\n", dlerror()); + } + nativeSetIntPref = (void (*) (JNIEnv *env, jobject obj, jstring, jint)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_PrefrencesImpl_nativeSetIntPref"); + if (!nativeSetIntPref) { + printf("got dlsym error %s\n", dlerror()); + } + nativeSetBoolPref = (void (*) (JNIEnv *env, jobject obj, jstring, jboolean)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_PrefrencesImpl_nativeSetBoolPref"); + if (!nativeSetBoolPref) { + printf("got dlsym error %s\n", dlerror()); + } nativeAddListener = (void (*) (JNIEnv *, jobject, jint, jobject, jstring)) dlsym(dll, "Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeAddListener"); if (!nativeAddListener) { @@ -503,6 +515,30 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_ return (* nativeNewRDFNode) (env, obj, webShellPtr, url, isFolder); } +// PreferencesImpl.h + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetUnicharPref +(JNIEnv *env, jobject obj, jstring prefName, jstring prefValue) +{ + (* nativeSetUnicharPref) (env, obj, prefName, prefValue); +} + + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetIntPref +(JNIEnv *env, jobject obj, jstring prefName, jint prefValue) +{ + (* nativeSetIntPref) (env, obj, prefName, prefValue); +} + + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_PreferencesImpl_nativeSetBoolPref +(JNIEnv *env, jobject obj, jstring prefName, jboolean prefValue) +{ + (* nativeSetBoolPref) (env, obj, prefName, prefValue); +} // CurrentPageImpl /* @@ -891,20 +927,9 @@ Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeGetIndex JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeInsertElementAt (JNIEnv *env, jobject obj, jint webShellPtr, jint parentRDFNode, - jint childRDFNode, jobject childProps, jint childIndex) { + jint childRDFNode, jint childIndex) { (* nativeInsertElementAt) (env, obj, webShellPtr, parentRDFNode, - childRDFNode, childProps, childIndex); -} - -/* - * Class: org_mozilla_webclient_wrapper_0005fnative_RDFTreeNode - * Method: nativeNewFolder - * Signature: (III)V - */ -JNIEXPORT jint JNICALL -Java_org_mozilla_webclient_wrapper_1native_RDFTreeNode_nativeNewFolder -(JNIEnv *env, jobject obj, jint webShellPtr, jint parentRDFNode, jobject childProps) { - return (* nativeNewFolder) (env, obj, webShellPtr, parentRDFNode, childProps); + childRDFNode, childIndex); } /* diff --git a/mozilla/java/webclient/src_share/Makefile.in b/mozilla/java/webclient/src_share/Makefile.in index 4b71da46797..35bb5b7153e 100644 --- a/mozilla/java/webclient/src_share/Makefile.in +++ b/mozilla/java/webclient/src_share/Makefile.in @@ -60,6 +60,7 @@ endif JAVAH_CLS= \ "-o BookmarksImpl.h org.mozilla.webclient.wrapper_native.BookmarksImpl" \ + "-o PreferencesImpl.h org.mozilla.webclient.wrapper_native.PreferencesImpl" \ "-o CurrentPageImpl.h org.mozilla.webclient.wrapper_native.CurrentPageImpl" \ "-o HistoryImpl.h org.mozilla.webclient.wrapper_native.HistoryImpl" \ "-o WrapperFactoryImpl.h org.mozilla.webclient.wrapper_native.WrapperFactoryImpl" \ @@ -73,6 +74,7 @@ JAVAH_CLS= \ JAVAH_FILES=\ BookmarksImpl.h \ + PreferencesImpl.h \ CurrentPageImpl.h \ HistoryImpl.h \ WrapperFactoryImpl.h \ diff --git a/mozilla/java/webclient/src_share/Makefile.win b/mozilla/java/webclient/src_share/Makefile.win index d025e8c5a13..8edc772b7a7 100644 --- a/mozilla/java/webclient/src_share/Makefile.win +++ b/mozilla/java/webclient/src_share/Makefile.win @@ -82,12 +82,16 @@ JAVAC_CLASSPATH=$(JAVAC_CLASSPATH);$(CLASSPATH) !CMDSWITCHES -S # generate the jni header -export:: BookmarksImpl.h CurrentPageImpl.h HistoryImpl.h WrapperFactoryImpl.h WindowControlImpl.h NavigationImpl.h NativeEventThread.h RDFEnumeration.h RDFTreeNode.h ISupportsPeer.h +export:: BookmarksImpl.h PreferencesImpl.h CurrentPageImpl.h HistoryImpl.h WrapperFactoryImpl.h WindowControlImpl.h NavigationImpl.h NativeEventThread.h RDFEnumeration.h RDFTreeNode.h ISupportsPeer.h BookmarksImpl.h: @echo Assuming class org.mozilla.webclient.wrapper_native.BookmarksImpl is in $(JAVAH_FLAGS) $(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.wrapper_native.BookmarksImpl +PreferencesImpl.h: + @echo Assuming class org.mozilla.webclient.wrapper_native.PreferencesImpl is in $(JAVAH_FLAGS) + $(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.wrapper_native.PreferencesImpl + CurrentPageImpl.h: @echo Assuming class org.mozilla.webclient.wrapper_native.CurrentPageImpl is in $(JAVAH_FLAGS) @@ -132,6 +136,7 @@ install:: $(LIBRARY) clobber_all:: clobber rm -f BookmarksImpl.h + rm -f PreferencesImpl.h rm -f CurrentPageImpl.h rm -f HistoryImpl.h rm -f WrapperFactoryImpl.h