|
@@ -211,13 +211,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
|
|
|
NonnullRefPtrVector<GUI::Window> applet_windows;
|
|
|
|
|
|
- auto create_applet = [&](GraphType graph_type, StringView spec) {
|
|
|
+ auto create_applet = [&](GraphType graph_type, StringView spec) -> ErrorOr<void> {
|
|
|
auto parts = spec.split_view(',');
|
|
|
|
|
|
dbgln("Create applet: {} with spec '{}'", (int)graph_type, spec);
|
|
|
|
|
|
if (parts.size() != 2)
|
|
|
- return;
|
|
|
+ return Error::from_string_literal("ResourceGraph: Applet spec is not composed of exactly 2 comma-separated parts"sv);
|
|
|
|
|
|
auto name = parts[0];
|
|
|
auto graph_color = Gfx::Color::from_string(parts[1]);
|
|
@@ -227,15 +227,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
window->set_window_type(GUI::WindowType::Applet);
|
|
|
window->resize(GraphWidget::history_size + 2, 15);
|
|
|
|
|
|
- window->set_main_widget<GraphWidget>(graph_type, graph_color, Optional<Gfx::Color> {});
|
|
|
+ auto graph_widget = TRY(window->try_set_main_widget<GraphWidget>(graph_type, graph_color, Optional<Gfx::Color> {}));
|
|
|
window->show();
|
|
|
applet_windows.append(move(window));
|
|
|
+
|
|
|
+ return {};
|
|
|
};
|
|
|
|
|
|
if (cpu)
|
|
|
- create_applet(GraphType::CPU, cpu);
|
|
|
+ TRY(create_applet(GraphType::CPU, cpu));
|
|
|
if (memory)
|
|
|
- create_applet(GraphType::Memory, memory);
|
|
|
+ TRY(create_applet(GraphType::Memory, memory));
|
|
|
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
|
|
TRY(Core::System::unveil("/proc/stat", "r"));
|