Skip to content

Commit efb3a34

Browse files
committed
SystemMenu: Rename PowerDialog => ShutdownDialog
1 parent e5ea243 commit efb3a34

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

Services/SystemMenu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(SOURCES
22
main.cpp
3-
PowerDialog.cpp
3+
ShutdownDialog.cpp
44
)
55

66
serenity_bin(SystemMenu)

Services/SystemMenu/PowerDialog.cpp renamed to Services/SystemMenu/ShutdownDialog.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27+
#include "ShutdownDialog.h"
2728
#include <AK/String.h>
2829
#include <AK/Vector.h>
2930
#include <LibGUI/BoxLayout.h>
@@ -34,33 +35,31 @@
3435
#include <LibGUI/Widget.h>
3536
#include <LibGfx/Font.h>
3637

37-
#include "PowerDialog.h"
38-
39-
struct PowerOption {
38+
struct Option {
4039
String title;
4140
Vector<char const*> cmd;
4241
bool enabled;
4342
bool default_action;
4443
};
4544

46-
static const Vector<PowerOption> options = {
45+
static const Vector<Option> options = {
4746
{ "Shut down", { "/bin/shutdown", "--now", nullptr }, true, true },
4847
{ "Restart", { "/bin/reboot", nullptr }, true, false },
4948
{ "Log out", {}, false, false },
5049
{ "Sleep", {}, false, false },
5150
};
5251

53-
Vector<char const*> PowerDialog::show()
52+
Vector<char const*> ShutdownDialog::show()
5453
{
55-
auto rc = PowerDialog::construct()->exec();
56-
if(rc == ExecResult::ExecOK)
54+
auto rc = ShutdownDialog::construct()->exec();
55+
if (rc == ExecResult::ExecOK)
5756
return options[rc].cmd;
5857

5958
return {};
6059
}
6160

62-
PowerDialog::PowerDialog()
63-
: GUI::Dialog(nullptr)
61+
ShutdownDialog::ShutdownDialog()
62+
: Dialog(nullptr)
6463
{
6564
Gfx::Rect rect({ 0, 0, 180, 180 + ((static_cast<int>(options.size()) - 3) * 16) });
6665
rect.center_within(GUI::Desktop::the().rect());
@@ -114,6 +113,6 @@ PowerDialog::PowerDialog()
114113
cancel_button.set_text("Cancel");
115114
}
116115

117-
PowerDialog::~PowerDialog()
116+
ShutdownDialog::~ShutdownDialog()
118117
{
119118
}

Services/SystemMenu/PowerDialog.h renamed to Services/SystemMenu/ShutdownDialog.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
*/
2626

2727
#include <AK/Vector.h>
28-
#include <LibCore/Object.h>
2928
#include <LibGUI/Dialog.h>
3029

31-
class PowerDialog : public GUI::Dialog {
32-
C_OBJECT(PowerDialog)
30+
class ShutdownDialog : public GUI::Dialog {
31+
C_OBJECT(ShutdownDialog);
32+
3333
public:
3434
static Vector<char const*> show();
3535

3636
private:
37-
PowerDialog();
38-
~PowerDialog();
37+
ShutdownDialog();
38+
virtual ~ShutdownDialog() override;
3939

4040
int m_selected_option { -1 };
4141
};

Services/SystemMenu/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
#include "PowerDialog.h"
27+
#include "ShutdownDialog.h"
2828
#include <AK/FileSystemPath.h>
2929
#include <AK/QuickSort.h>
3030
#include <LibCore/ConfigFile.h>
@@ -203,7 +203,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
203203
}));
204204
system_menu->add_separator();
205205
system_menu->add_action(GUI::Action::create("Exit...", [](auto&) {
206-
Vector<char const*> command = PowerDialog::show();
206+
auto command = ShutdownDialog::show();
207207

208208
if (command.size() == 0)
209209
return;

0 commit comments

Comments
 (0)