File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 20
20
#include < stdio.h>
21
21
22
22
class NetworkWidget final : public GUI::ImageWidget {
23
- C_OBJECT (NetworkWidget);
23
+ C_OBJECT_ABSTRACT (NetworkWidget)
24
+
25
+ public:
26
+ static ErrorOr<NonnullRefPtr<NetworkWidget>> try_create (bool notifications)
27
+ {
28
+ NonnullRefPtr<Gfx::Bitmap> connected_icon = TRY (Gfx::Bitmap::try_load_from_file (" /res/icons/16x16/network.png" ));
29
+ NonnullRefPtr<Gfx::Bitmap> disconnected_icon = TRY (Gfx::Bitmap::try_load_from_file (" /res/icons/16x16/network-disconnected.png" ));
30
+ return adopt_nonnull_ref_or_enomem (new (nothrow) NetworkWidget (notifications, move (connected_icon), move (disconnected_icon)));
31
+ }
24
32
25
33
private:
26
- NetworkWidget (bool notifications)
34
+ NetworkWidget (bool notifications, NonnullRefPtr<Gfx::Bitmap> connected_icon, NonnullRefPtr<Gfx::Bitmap> disconnected_icon)
35
+ : m_connected_icon(move(connected_icon))
36
+ , m_disconnected_icon(move(disconnected_icon))
27
37
{
28
38
m_notifications = notifications;
29
39
update_widget ();
@@ -153,8 +163,8 @@ class NetworkWidget final : public GUI::ImageWidget {
153
163
String m_adapter_info;
154
164
bool m_connected = false ;
155
165
bool m_notifications = true ;
156
- RefPtr <Gfx::Bitmap> m_connected_icon = Gfx::Bitmap::try_load_from_file( " /res/icons/16x16/network.png " ).release_value_but_fixme_should_propagate_errors() ;
157
- RefPtr <Gfx::Bitmap> m_disconnected_icon = Gfx::Bitmap::try_load_from_file( " /res/icons/16x16/network-disconnected.png " ).release_value_but_fixme_should_propagate_errors() ;
166
+ NonnullRefPtr <Gfx::Bitmap> m_connected_icon;
167
+ NonnullRefPtr <Gfx::Bitmap> m_disconnected_icon;
158
168
};
159
169
160
170
ErrorOr<int > serenity_main (Main::Arguments arguments)
You can’t perform that action at this time.
0 commit comments