From e0560dfc3c391b5b063a37d2974860540785ae73 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 7 Aug 2006 20:29:41 +0000 Subject: Simply CallGetService to get the pref branch. 2006-08-07 Christian Persch * embed/mozilla/mozilla-notifiers.cpp: Simply CallGetService to get the pref branch. --- ChangeLog | 6 ++++++ embed/mozilla/mozilla-notifiers.cpp | 20 ++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 928d05819..d3ed957b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-07 Christian Persch + + * embed/mozilla/mozilla-notifiers.cpp: + + Simply CallGetService to get the pref branch. + 2006-08-07 Christian Persch * embed/mozilla/mozilla-embed-single.cpp: diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index 5fc67f337..610b0cbb3 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -553,13 +553,19 @@ notify_cb (GConfClient *client, GValue value = { 0, }; g_return_if_fail (gcentry != NULL); - g_return_if_fail (data != NULL); + g_assert (data != NULL); if (data->func (gcentry, &value, data->user_data)) { mozilla_pref_set (data->mozilla_pref, &value); g_value_unset (&value); } + else + { + /* Reset the pref */ + NS_ENSURE_TRUE (gPrefBranch, ); + gPrefBranch->ClearUserPref (data->mozilla_pref); + } } extern "C" guint @@ -1088,19 +1094,9 @@ mozilla_notifiers_init (void) eel_gconf_monitor_add ("/system/proxy"); eel_gconf_monitor_add ("/system/http_proxy"); - /* Cache the pref branch */ - nsresult rv; - nsCOMPtr prefService - (do_GetService (NS_PREFSERVICE_CONTRACTID, &rv)); - if (NS_FAILED (rv)) - { - g_warning ("Failed to get the pref service!\n"); - return FALSE; - } - /* the pref service conveniently implements the root pref branch */ gPrefBranch = nsnull; - rv = CallQueryInterface (prefService, &gPrefBranch); + nsresult rv = CallGetService (NS_PREFSERVICE_CONTRACTID, &gPrefBranch); if (NS_FAILED (rv) || !gPrefBranch) { g_warning ("Failed to get the pref service!\n"); -- cgit v1.2.3