diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-05-20 18:47:30 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-20 18:47:30 +0800 |
commit | 672d06e7f172da3fdcdafb1411d42092ef9f2087 (patch) | |
tree | e9bc88605cbdd0eadfbae101740e32233faa43f3 /embed/mozilla/mozilla-notifiers.cpp | |
parent | b5959ba28d003e0945ae587761f2e891266dcdfd (diff) | |
download | gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar.gz gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar.bz2 gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar.lz gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar.xz gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.tar.zst gsoc2013-epiphany-672d06e7f172da3fdcdafb1411d42092ef9f2087.zip |
Fix some warnings. Go back hardcoding defaults in the code, mozilla pref
2003-05-20 Marco Pesenti Gritti <marco@it.gnome.org>
* embed/downloader-view.c: (downloader_view_build_ui):
* embed/mozilla/Makefile.am:
* embed/mozilla/default-prefs.js:
* embed/mozilla/mozilla-embed-single.cpp:
* embed/mozilla/mozilla-notifiers.cpp:
* embed/mozilla/mozilla-prefs.cpp:
* embed/mozilla/mozilla-prefs.h:
* lib/ephy-dnd.c: (ephy_dnd_node_list_extract_nodes):
* src/bookmarks/ephy-bookmarks-editor.c:
(ephy_bookmarks_editor_construct):
* src/ephy-history-window.c: (ephy_history_window_construct):
Fix some warnings.
Go back hardcoding defaults in the code, mozilla pref api sucks :/
Cleanup mozilla prefs code, we can use mozilla api directly now,
no need for a wrapper like in galeon1.
Diffstat (limited to 'embed/mozilla/mozilla-notifiers.cpp')
-rw-r--r-- | embed/mozilla/mozilla-notifiers.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index 0ef4b18d0..1dd53a385 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -24,7 +24,6 @@ #include "ephy-embed-single.h" #include "mozilla-notifiers.h" #include "eel-gconf-extensions.h" -#include "mozilla-prefs.h" #include "MozRegisterComponents.h" #include "ephy-prefs.h" #include "ephy-embed-prefs.h" @@ -37,6 +36,9 @@ #include <stdlib.h> #include <sys/utsname.h> #include "nsBuildID.h" +#include "nsCOMPtr.h" +#include "nsIPrefService.h" +#include "nsIServiceManager.h" static void mozilla_own_colors_notifier(GConfClient *client, @@ -188,6 +190,64 @@ custom_notifiers [] = {NULL, NULL} }; +static gboolean +mozilla_prefs_set_string(const char *preference_name, const char *new_value) +{ + g_return_val_if_fail (preference_name != NULL, FALSE); + g_return_val_if_fail (new_value != NULL, FALSE); + nsCOMPtr<nsIPrefService> prefService = + do_GetService (NS_PREFSERVICE_CONTRACTID); + nsCOMPtr<nsIPrefBranch> pref; + prefService->GetBranch ("", getter_AddRefs(pref)); + + if (pref) + { + nsresult rv = pref->SetCharPref (preference_name, new_value); + return NS_SUCCEEDED (rv) ? TRUE : FALSE; + } + + return FALSE; +} + +static gboolean +mozilla_prefs_set_boolean (const char *preference_name, + gboolean new_boolean_value) +{ + 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->SetBoolPref (preference_name, + new_boolean_value ? PR_TRUE : PR_FALSE); + return NS_SUCCEEDED (rv) ? TRUE : FALSE; + } + return FALSE; +} + +static gboolean +mozilla_prefs_set_int (const char *preference_name, int new_int_value) +{ + 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->SetIntPref (preference_name, new_int_value); + return NS_SUCCEEDED (rv) ? TRUE : FALSE; + } + + return FALSE; +} + static void mozilla_font_size_notifier (GConfClient *client, guint cnxn_id, |