Auto merge of #12178 - frewsxcv:prefs, r=emilio

Refactor `util::prefs` operations to be methods on static struct.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12178)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-03 08:19:04 -07:00 committed by GitHub
commit b0a8ce5341
30 changed files with 167 additions and 163 deletions

View file

@ -36,7 +36,7 @@ use util::geometry::ScreenPx;
use util::opts;
#[cfg(not(target_os = "android"))]
use util::opts::RenderApi;
use util::prefs;
use util::prefs::PREFS;
use util::resource_files;
#[cfg(target_os = "windows")] use winapi;
@ -822,7 +822,7 @@ impl WindowMethods for Window {
}
(NONE, Key::Escape) => {
if let Some(true) = prefs::get_pref("shell.builtin-key-shortcuts.enabled").as_boolean() {
if let Some(true) = PREFS.get("shell.builtin-key-shortcuts.enabled").as_boolean() {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
}
}
@ -865,7 +865,7 @@ impl WindowMethods for Window {
self.scroll_window(-LINE_HEIGHT, 0.0, TouchEventType::Move);
}
(CMD_OR_CONTROL, Key::R) => {
if let Some(true) = prefs::get_pref("shell.builtin-key-shortcuts.enabled").as_boolean() {
if let Some(true) = PREFS.get("shell.builtin-key-shortcuts.enabled").as_boolean() {
self.event_queue.borrow_mut().push(WindowEvent::Reload);
}
}