Config UI: leave other_browser_cmd unset instead of configuring an empty value
authorSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 09:17:11 +0000 (02:17 -0700)
committerSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 09:17:11 +0000 (02:17 -0700)
It used to be that when the user cleared the value of other_browser_cmd
in the UI, the setting would be removed from the config file instead of
writing an empty value.  Restore this behavior.

config-ui/browser-switchboard-cp.c

index d4fcc8d..0c768e1 100644 (file)
@@ -175,10 +175,12 @@ static void save_config(void) {
                new_cfg.default_browser = get_default_browser();
                new_cfg.flags |= SWB_CONFIG_DEFAULT_BROWSER_SET;
        }
-       if ((orig_cfg.other_browser_cmd &&
-            strcmp(get_other_browser_cmd(), orig_cfg.other_browser_cmd)) ||
-           (!orig_cfg.other_browser_cmd &&
-            strlen(get_other_browser_cmd()) > 0)) {
+       if (strlen(get_other_browser_cmd()) == 0) {
+               new_cfg.other_browser_cmd = NULL;
+               new_cfg.flags &= ~SWB_CONFIG_OTHER_BROWSER_CMD_SET;
+       } else if (!(orig_cfg.other_browser_cmd &&
+                    !strcmp(get_other_browser_cmd(),
+                            orig_cfg.other_browser_cmd))) {
                new_cfg.other_browser_cmd = get_other_browser_cmd();
                new_cfg.flags |= SWB_CONFIG_OTHER_BROWSER_CMD_SET;
        }