
Go to the source code of this file.
Functions | |
| gboolean | mozilla_save_prefs (void) |
| gboolean | mozilla_pref_remove (const gchar *preferenceName) |
| gboolean | mozilla_pref_set_char (const char *preferenceName, const char *newValue) |
| gboolean | mozilla_pref_set_boolean (const char *preferenceName, gboolean newValue) |
| gboolean | mozilla_pref_set_int (const char *preferenceName, int newValue) |
| gchar * | mozilla_pref_get_char (const char *preferenceName) |
| gboolean | mozilla_pref_get_boolean (const gchar *preferenceName, gboolean defaultValue) |
| gint | mozilla_pref_get_int (const char *preferenceName) |
browser - interface with gecko for setting/getting preference values (the startup preferences of the browser app should be put in a "*.js" file in the mozilla three) <File description>="">
<File description>="">
Definition in file mozillaPreferences.h.
| gboolean mozilla_pref_get_boolean | ( | const gchar * | preferenceName, | |
| gboolean | defaultValue | |||
| ) |
get a boolean mozilla preference
| preferenceName | ID of the mozilla reference | |
| defaultValue | value that will be returned in case of error |
| gchar* mozilla_pref_get_char | ( | const char * | preferenceName | ) |
get a string mozilla preference (calling app should handle free)
| preferenceName | ID of the mozilla reference |
Definition at line 166 of file mozillaPreferences.cpp.
00167 { 00168 gchar *value = NULL; 00169 gchar *result = NULL; 00170 00171 g_return_val_if_fail(preferenceName != NULL, FALSE); 00172 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00173 nsCOMPtr < nsIPrefBranch > pref; 00174 prefService->GetBranch("", getter_AddRefs(pref)); 00175 00176 if (pref) 00177 { 00178 pref->GetCharPref(preferenceName, &value); 00179 } 00180 00181 if (value) 00182 { 00183 result = g_strdup(value); 00184 nsMemory::Free(value); 00185 } 00186 00187 return result; 00188 }
| gint mozilla_pref_get_int | ( | const char * | preferenceName | ) |
get an integer mozilla preference
| preferenceName | ID of the mozilla reference |
Definition at line 145 of file mozillaPreferences.cpp.
00146 { 00147 int value = -1; 00148 00149 g_return_val_if_fail(preferenceName != NULL, FALSE); 00150 00151 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00152 nsCOMPtr < nsIPrefBranch > pref; 00153 prefService->GetBranch("", getter_AddRefs(pref)); 00154 00155 if (pref) 00156 { 00157 pref->GetIntPref(preferenceName, &value); 00158 } 00159 00160 return value; 00161 }
| gboolean mozilla_pref_remove | ( | const gchar * | preferenceName | ) |
remove a mozilla preference, reverting to the default value
| preferenceName | ID of the mozilla reference |
| gboolean mozilla_pref_set_boolean | ( | const char * | preferenceName, | |
| gboolean | newValue | |||
| ) |
set a boolean mozilla preference
| preferenceName | ID of the mozilla reference | |
| newValue | new boolean value |
Definition at line 79 of file mozillaPreferences.cpp.
00080 { 00081 g_return_val_if_fail(preferenceName != NULL, FALSE); 00082 00083 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00084 nsCOMPtr < nsIPrefBranch > pref; 00085 prefService->GetBranch("", getter_AddRefs(pref)); 00086 00087 if (pref) 00088 { 00089 nsresult rv = pref->SetBoolPref(preferenceName, newValue ? PR_TRUE : PR_FALSE); 00090 00091 return NS_SUCCEEDED(rv) ? TRUE : FALSE; 00092 } 00093 00094 return FALSE; 00095 }
| gboolean mozilla_pref_set_char | ( | const char * | preferenceName, | |
| const char * | newValue | |||
| ) |
set a string mozilla preference
| preferenceName | ID of the mozilla reference | |
| newValue | new string value |
Definition at line 52 of file mozillaPreferences.cpp.
00053 { 00054 g_return_val_if_fail(preferenceName != NULL, FALSE); 00055 00056 /*It is legitimate to pass in a NULL value sometimes. So let's not 00057 *assert and just check and return. 00058 */ 00059 if (!newValue) 00060 return FALSE; 00061 00062 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00063 nsCOMPtr < nsIPrefBranch > pref; 00064 prefService->GetBranch("", getter_AddRefs(pref)); 00065 00066 if (pref) 00067 { 00068 nsresult rv = pref->SetCharPref(preferenceName, newValue); 00069 00070 return NS_SUCCEEDED(rv) ? TRUE : FALSE; 00071 } 00072 00073 return FALSE; 00074 }
| gboolean mozilla_pref_set_int | ( | const char * | preferenceName, | |
| int | newValue | |||
| ) |
set a integer mozilla preference
| preferenceName | ID of the mozilla reference | |
| newValue | new integer value |
Definition at line 100 of file mozillaPreferences.cpp.
00101 { 00102 g_return_val_if_fail(preferenceName != NULL, FALSE); 00103 00104 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00105 nsCOMPtr < nsIPrefBranch > pref; 00106 prefService->GetBranch("", getter_AddRefs(pref)); 00107 00108 if (pref) 00109 { 00110 nsresult rv = pref->SetIntPref(preferenceName, newValue); 00111 00112 return NS_SUCCEEDED(rv) ? TRUE : FALSE; 00113 } 00114 return FALSE; 00115 }
| gboolean mozilla_save_prefs | ( | void | ) |
store the preference changes
| void |
Definition at line 39 of file mozillaPreferences.cpp.
00040 { 00041 nsCOMPtr < nsIPrefService > prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); 00042 g_return_val_if_fail(prefService != nsnull, FALSE); 00043 00044 nsresult rv = prefService->SavePrefFile(nsnull); 00045 00046 return NS_SUCCEEDED(rv) ? TRUE : FALSE; 00047 }
1.5.6