Fix -o capture.auto_scroll: setting

Gitlab Bug #19597

The preference capture.auto_scroll was moved to a 'recent' value and marked obsolete.

It was not possible to set the recent value with -o because values marked as obsolete preferences were not checked to see if they were valid 'recent' values.

Garbage values passed to -o were not reported as unknown preferences because the 'recent' code returned PREFS_SET_OK for any value.

Changed commandline handling of -o to pass obsolete prefs to 'recent' in case they were moved there.

Return PREFS_SET_NO_SUCH_PREF for unmatched 'recent' values.
This commit is contained in:
Stephen Donnelly 2024-01-19 14:53:34 +13:00 committed by AndersBroman
parent 49ada98a88
commit 94c2f18924
2 changed files with 8 additions and 3 deletions

View File

@ -454,9 +454,12 @@ void commandline_override_prefs(int argc, char *argv[], gboolean opt_reset)
}
break;
case PREFS_SET_OBSOLETE:
cmdarg_err("-o flag \"%s\" specifies obsolete preference",
ws_optarg);
exit_application(1);
/* obsolete preference, might be a recent setting */
if (recent_set_arg(ws_optarg) != PREFS_SET_OK) {
cmdarg_err("-o flag \"%s\" specifies obsolete preference",
ws_optarg);
exit_application(1);
}
break;
default:
ws_assert_not_reached();

View File

@ -1504,6 +1504,8 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
recent.gui_additional_toolbars = prefs_get_string_list(value);
} else if (strcmp(key, RECENT_GUI_INTERFACE_TOOLBAR_SHOW) == 0) {
recent.interface_toolbars = prefs_get_string_list(value);
} else {
return PREFS_SET_NO_SUCH_PREF;
}
return PREFS_SET_OK;