[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 01/04: Add shutdown and restart commands
noreply at xfce.org
noreply at xfce.org
Sat Sep 8 17:50:42 CEST 2018
This is an automated email from the git hooks/post-receive script.
g o t t c o d e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 5f29d86fbd4791a4c2148b4d8e1c1f6f53e6eb86
Author: Peter Feichtinger <shippo at gmx.at>
Date: Thu Aug 30 15:42:39 2018 +0200
Add shutdown and restart commands
---
panel-plugin/settings.cpp | 4 ++++
panel-plugin/settings.h | 2 ++
panel-plugin/window.cpp | 22 ++++++++++++----------
panel-plugin/window.h | 4 ++--
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index 0b17b64..ab30abd 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -37,6 +37,8 @@ static const char* const settings_command[Settings::CountCommands][2] = {
{ "command-lockscreen", "show-command-lockscreen" },
{ "command-switchuser", "show-command-switchuser" },
{ "command-logout", "show-command-logout" },
+ { "command-shutdown", "show-command-shutdown" },
+ { "command-restart", "show-command-restart" },
{ "command-menueditor", "show-command-menueditor" },
{ "command-profile", "show-command-profile" }
};
@@ -121,6 +123,8 @@ Settings::Settings() :
command[CommandLockScreen] = new Command("system-lock-screen", _("_Lock Screen"), "xflock4", _("Failed to lock screen."));
command[CommandSwitchUser] = new Command("system-users", _("Switch _Users"), "gdmflexiserver", _("Failed to switch users."));
command[CommandLogOut] = new Command("system-log-out", _("Log _Out"), "xfce4-session-logout", _("Failed to log out."));
+ command[CommandShutdown] = new Command("system-shutdown", _("Shut _Down"), "xfce4-session-logout -h", _("Failed to shut down."));
+ command[CommandRestart] = new Command("system-restart", _("_Restart"), "xfce4-session-logout -r", _("Failed to restart."));
command[CommandMenuEditor] = new Command("xfce4-menueditor", _("_Edit Applications"), "menulibre", _("Failed to launch menu editor."));
command[CommandProfile] = new Command("avatar-default", _("Edit _Profile"), "mugshot", _("Failed to edit profile."));
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index 7b9e2ce..5cab80a 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -91,6 +91,8 @@ public:
CommandLockScreen,
CommandSwitchUser,
CommandLogOut,
+ CommandShutdown,
+ CommandRestart,
CommandMenuEditor,
CommandProfile,
CountCommands
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index 3593943..e14fffd 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -142,7 +142,9 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
m_commands_button[1] = wm_settings->command[Settings::CommandLockScreen]->get_button();
m_commands_button[2] = wm_settings->command[Settings::CommandSwitchUser]->get_button();
m_commands_button[3] = wm_settings->command[Settings::CommandLogOut]->get_button();
- for (int i = 0; i < 4; ++i)
+ m_commands_button[4] = wm_settings->command[Settings::CommandShutdown]->get_button();
+ m_commands_button[5] = wm_settings->command[Settings::CommandRestart]->get_button();
+ for (int i = 0; i < 6; ++i)
{
m_command_slots[i] = g_signal_connect_slot<GtkButton*>(m_commands_button[i], "clicked", &Window::hide, this);
}
@@ -195,7 +197,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
m_commands_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
m_commands_spacer = gtk_label_new(NULL);
gtk_box_pack_start(m_commands_box, m_commands_spacer, true, true, 0);
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
gtk_box_pack_start(m_commands_box, m_commands_button[i], false, false, 0);
}
@@ -267,7 +269,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
WhiskerMenu::Window::~Window()
{
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
g_signal_handler_disconnect(m_commands_button[i], m_command_slots[i]);
gtk_container_remove(GTK_CONTAINER(m_commands_box), m_commands_button[i]);
@@ -298,7 +300,7 @@ void WhiskerMenu::Window::hide()
unset_pressed_category();
// Hide command buttons to remove active border
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
gtk_widget_set_visible(m_commands_button[i], false);
}
@@ -543,7 +545,7 @@ void WhiskerMenu::Window::show(const Position position)
{
gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_START);
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
gtk_box_reorder_child(m_commands_box, m_commands_button[i], i);
}
@@ -557,9 +559,9 @@ void WhiskerMenu::Window::show(const Position position)
{
gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_END);
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
- gtk_box_reorder_child(m_commands_box, m_commands_button[i], 3 - i);
+ gtk_box_reorder_child(m_commands_box, m_commands_button[i], 5 - i);
}
gtk_box_reorder_child(m_commands_box, m_commands_spacer, 4);
@@ -571,7 +573,7 @@ void WhiskerMenu::Window::show(const Position position)
{
gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_START);
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
gtk_box_reorder_child(m_commands_box, m_commands_button[i], i);
}
@@ -586,9 +588,9 @@ void WhiskerMenu::Window::show(const Position position)
{
gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_END);
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 6; ++i)
{
- gtk_box_reorder_child(m_commands_box, m_commands_button[i], 3 - i);
+ gtk_box_reorder_child(m_commands_box, m_commands_button[i], 5 - i);
}
gtk_box_reorder_child(m_commands_box, m_commands_spacer, 4);
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index 2177b39..0f90b1b 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -126,8 +126,8 @@ private:
ResizerWidget* m_resizer;
GtkWidget* m_commands_spacer;
- GtkWidget* m_commands_button[4];
- gulong m_command_slots[4];
+ GtkWidget* m_commands_button[6];
+ gulong m_command_slots[6];
GtkEntry* m_search_entry;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list