aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-prefs.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-06 04:28:09 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-06 04:28:09 +0800
commit768eae4a4874a7fe0eada98423f61d84f6416bde (patch)
tree707977820ddbc47121fb107c8569cbb5bb2ef566 /embed/mozilla/mozilla-prefs.cpp
parent4e522c23a0650605cf8270f381ca10f2f35bbf78 (diff)
downloadgsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.gz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.bz2
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.lz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.xz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.zst
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.zip
*** empty log message ***
Diffstat (limited to 'embed/mozilla/mozilla-prefs.cpp')
-rw-r--r--embed/mozilla/mozilla-prefs.cpp55
1 files changed, 35 insertions, 20 deletions
diff --git a/embed/mozilla/mozilla-prefs.cpp b/embed/mozilla/mozilla-prefs.cpp
index e5b8c68e2..55f9dcc6b 100644
--- a/embed/mozilla/mozilla-prefs.cpp
+++ b/embed/mozilla/mozilla-prefs.cpp
@@ -22,17 +22,50 @@
#include <nsIPrefService.h>
#include <nsIServiceManager.h>
#include <nsMemory.h>
+#include <nsILocalFile.h>
+#include <nsString.h>
#include <glib/gmessages.h>
#include <glib/gstrfuncs.h>
+void
+mozilla_prefs_load (const char *filename)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsILocalFile> prefsLocalFile;
+ rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(filename), PR_TRUE, getter_AddRefs (prefsLocalFile));
+ g_return_if_fail (NS_SUCCEEDED(rv));
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ g_return_if_fail (prefService != nsnull);
+
+ nsCOMPtr<nsIFile> prefsFile;
+ prefsLocalFile->QueryInterface(NS_GET_IID(nsIFile), (void **)&prefsFile);
+ g_return_if_fail (prefsFile != nsnull);
+
+ prefService->ReadUserPrefs (prefsFile);
+}
+
gboolean
-mozilla_prefs_save (void)
+mozilla_prefs_save (const char *filename)
{
+ nsresult rv;
+
+ nsCOMPtr<nsILocalFile> prefsLocalFile;
+ rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(filename), PR_TRUE, getter_AddRefs (prefsLocalFile));
+ g_return_val_if_fail (NS_SUCCEEDED(rv), FALSE);
+
nsCOMPtr<nsIPrefService> prefService =
do_GetService (NS_PREFSERVICE_CONTRACTID);
g_return_val_if_fail (prefService != nsnull, FALSE);
- nsresult rv = prefService->SavePrefFile (nsnull);
+ nsCOMPtr<nsIFile> prefsFile;
+ prefsLocalFile->QueryInterface(NS_GET_IID(nsIFile), (void **)&prefsFile);
+ g_return_val_if_fail (prefsFile != nsnull, FALSE);
+
+ rv = prefService->SavePrefFile (prefsFile);
+
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
}
@@ -165,21 +198,3 @@ mozilla_prefs_get_string(const char *preference_name)
return result;
}
-gboolean
-mozilla_prefs_remove (const char *preference_name)
-{
- g_return_val_if_fail (preference_name != NULL, FALSE);
-
- nsCOMPtr<nsIPrefService> prefService =
- do_GetService (NS_PREFSERVICE_CONTRACTID);
- nsCOMPtr<nsIPrefBranch> pref;
- prefService->GetBranch ("", getter_AddRefs(pref));
-
- if (pref)
- {
- nsresult rv = pref->ClearUserPref (preference_name);
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
- }
-
- return FALSE;
-}