🔧 Use enum to declare ProgressState

As recommended in #6768, this commit adds an enum for progress states for windows.
This commit is contained in:
Felix Rieseberg 2016-08-09 16:05:44 -07:00
parent ab0d726594
commit 8b85ee8a20
8 changed files with 36 additions and 13 deletions

View file

@ -587,9 +587,21 @@ void Window::SetFocusable(bool focusable) {
void Window::SetProgressBar(double progress, mate::Arguments* args) {
mate::Dictionary options;
std::string mode;
NativeWindow::ProgressState state = NativeWindow::PROGRESS_NORMAL;
args->GetNext(&options) && options.Get("mode", &mode);
window_->SetProgressBar(progress, mode);
if (mode == "error") {
state = NativeWindow::PROGRESS_ERROR;
} else if (mode == "paused") {
state = NativeWindow::PROGRESS_PAUSED;
} else if (mode == "indeterminate") {
state = NativeWindow::PROGRESS_INDETERMINATE;
} else if (mode == "none") {
state = NativeWindow::PROGRESS_NONE;
}
window_->SetProgressBar(progress, state);
}
void Window::SetOverlayIcon(const gfx::Image& overlay,