From: Fredrik Wendt Date: Sat, 28 Aug 2010 20:36:27 +0000 (+0100) Subject: fixes for bug #11210 X-Git-Url: http://git.maemo.org/git/?p=wifi-assistant;a=commitdiff_plain;h=82816bd6b35f3f092c1e0f054218ea4167c05eb5;hp=03dfbaa0a897022f0d6751a6f1e39d709f3e78d4;ds=sidebyside fixes for bug #11210 --- diff --git a/package/src/wifi_assistant/settings/application_settings.py b/package/src/wifi_assistant/settings/application_settings.py index ff161a2..e4d7c0f 100644 --- a/package/src/wifi_assistant/settings/application_settings.py +++ b/package/src/wifi_assistant/settings/application_settings.py @@ -3,7 +3,7 @@ from gnome import gconf class ApplicationSettings(): - def __init__(self, gconf_client, gconf_root_dir='/apps/maemo/wifi-assistant'): + def __init__(self, gconf_client, gconf_root_dir): self._gc = gconf_client self._gconfRootDir = gconf_root_dir self._gconfPopupKey = gconf_root_dir + '/daemon' @@ -34,7 +34,11 @@ class ApplicationSettings(): def getUsePopup(self): """Tells whether to use the daemon or not.""" - return self._gc.get_bool(self._gconfPopupKey) is True + value = self._gc.get_without_default(self._gconfPopupKey) + if value is None: + self.setUsePopup(True) + return True + return value.get_bool() is not False def setUsePopup(self, mode): diff --git a/package/test/unit/settings/application_settings_test.py b/package/test/unit/settings/application_settings_test.py index 8948d04..dc36424 100644 --- a/package/test/unit/settings/application_settings_test.py +++ b/package/test/unit/settings/application_settings_test.py @@ -42,6 +42,16 @@ class ApplicationSettingsTest(unittest.TestCase): assert self.testee.getUsePopup() is True + def test_bug_11210_popupDialogIsEnabledByDefault(self): + def empty(*args): + pass + + # run test without any default values - gconf should be empty + self._clearGConf(self.root) + + assert self.testee.getUsePopup() is True + + def dont_test_adding_two_listeners_removing_one_still_notifies_first_listener(self): firstSignal = False secondSignal = True