[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 02/04: Add commands for all logout actions.

noreply at xfce.org noreply at xfce.org
Sat Sep 8 17:50:43 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 072a6bc80cdaf31c08850a74668f4e6d220ee2f6
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Aug 31 12:53:25 2018 -0400

    Add commands for all logout actions.
---
 panel-plugin/plugin.cpp   |  4 ++++
 panel-plugin/settings.cpp | 59 +++++++++++++++++++++++++++++++++++++++--------
 panel-plugin/settings.h   |  7 ++++--
 panel-plugin/window.cpp   | 27 +++++++++-------------
 panel-plugin/window.h     |  4 ++--
 5 files changed, 71 insertions(+), 30 deletions(-)

diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index a9675ed..2d6ac10 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -96,6 +96,10 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
 	// Load settings
 	wm_settings = new Settings;
 	wm_settings->button_title = get_button_title_default();
+	for (int i = Settings::CommandSwitchUser; i < Settings::CommandLogOut; ++i)
+	{
+		wm_settings->command[i]->set_shown(false);
+	}
 	wm_settings->load(xfce_resource_lookup(XFCE_RESOURCE_CONFIG, "xfce4/whiskermenu/defaults.rc"));
 	wm_settings->load(xfce_panel_plugin_lookup_rc_file(m_plugin));
 	m_opacity = wm_settings->menu_opacity;
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index ab30abd..097457d 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -36,9 +36,12 @@ static const char* const settings_command[Settings::CountCommands][2] = {
 	{ "command-settings",   "show-command-settings"   },
 	{ "command-lockscreen", "show-command-lockscreen" },
 	{ "command-switchuser", "show-command-switchuser" },
-	{ "command-logout",     "show-command-logout"     },
-	{ "command-shutdown",   "show-command-shutdown"   },
+	{ "command-logoutuser", "show-command-logoutuser" },
 	{ "command-restart",    "show-command-restart"    },
+	{ "command-shutdown",   "show-command-shutdown"   },
+	{ "command-suspend",    "show-command-suspend"    },
+	{ "command-hibernate",  "show-command-hibernate"  },
+	{ "command-logout",     "show-command-logout"     },
 	{ "command-menueditor", "show-command-menueditor" },
 	{ "command-profile",    "show-command-profile"    }
 };
@@ -119,14 +122,50 @@ Settings::Settings() :
 	favorites.push_back("exo-mail-reader.desktop");
 	favorites.push_back("exo-web-browser.desktop");
 
-	command[CommandSettings] = new Command("preferences-desktop", _("All _Settings"), "xfce4-settings-manager", _("Failed to open settings manager."));
-	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."));
+	command[CommandSettings] = new Command("preferences-desktop",
+			_("All _Settings"),
+			"xfce4-settings-manager",
+			_("Failed to open settings manager."));
+	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[CommandLogOutUser] = new Command("system-log-out",
+			_("Log _Out"),
+			"xfce4-session-logout --logout --fast",
+			_("Failed to log out."));
+	command[CommandRestart] = new Command("system-reboot",
+			_("_Restart"),
+			"xfce4-session-logout --reboot --fast",
+			_("Failed to restart."));
+	command[CommandShutDown] = new Command("system-shutdown",
+			_("Shut _Down"),
+			"xfce4-session-logout --halt --fast",
+			_("Failed to shut down."));
+	command[CommandSuspend] = new Command("system-suspend",
+			_("Suspe_nd"),
+			"xfce4-session-logout --suspend",
+			_("Failed to suspend."));
+	command[CommandHibernate] = new Command("system-hibernate",
+			_("_Hibernate"),
+			"xfce4-session-logout --hibernate",
+			_("Failed to hibernate."));
+	command[CommandLogOut] = new Command("system-log-out",
+			_("Log Ou_t..."),
+			"xfce4-session-logout",
+			_("Failed to log out."));
+	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."));
 
 	search_actions.push_back(new SearchAction(_("Man Pages"), "#", "exo-open --launch TerminalEmulator man %s", false, true));
 	search_actions.push_back(new SearchAction(_("Web Search"), "?", "exo-open --launch WebBrowser https://duckduckgo.com/?q=%u", false, true));
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index 5cab80a..90b04d5 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -90,9 +90,12 @@ public:
 		CommandSettings = 0,
 		CommandLockScreen,
 		CommandSwitchUser,
-		CommandLogOut,
-		CommandShutdown,
+		CommandLogOutUser,
 		CommandRestart,
+		CommandShutDown,
+		CommandSuspend,
+		CommandHibernate,
+		CommandLogOut,
 		CommandMenuEditor,
 		CommandProfile,
 		CountCommands
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index e14fffd..d4f0b0e 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -138,14 +138,9 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
 	g_free(username);
 
 	// Create action buttons
-	m_commands_button[0] = wm_settings->command[Settings::CommandSettings]->get_button();
-	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();
-	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)
+	for (int i = 0; i < 9; ++i)
 	{
+		m_commands_button[i] = wm_settings->command[i]->get_button();
 		m_command_slots[i] = g_signal_connect_slot<GtkButton*>(m_commands_button[i], "clicked", &Window::hide, this);
 	}
 
@@ -197,7 +192,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 < 6; ++i)
+	for (int i = 0; i < 9; ++i)
 	{
 		gtk_box_pack_start(m_commands_box, m_commands_button[i], false, false, 0);
 	}
@@ -269,7 +264,7 @@ WhiskerMenu::Window::Window(Plugin* plugin) :
 
 WhiskerMenu::Window::~Window()
 {
-	for (int i = 0; i < 6; ++i)
+	for (int i = 0; i < 9; ++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]);
@@ -300,7 +295,7 @@ void WhiskerMenu::Window::hide()
 	unset_pressed_category();
 
 	// Hide command buttons to remove active border
-	for (int i = 0; i < 6; ++i)
+	for (int i = 0; i < 9; ++i)
 	{
 		gtk_widget_set_visible(m_commands_button[i], false);
 	}
@@ -545,7 +540,7 @@ void WhiskerMenu::Window::show(const Position position)
 		{
 			gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_START);
 
-			for (int i = 0; i < 6; ++i)
+			for (int i = 0; i < 9; ++i)
 			{
 				gtk_box_reorder_child(m_commands_box, m_commands_button[i], i);
 			}
@@ -559,9 +554,9 @@ void WhiskerMenu::Window::show(const Position position)
 		{
 			gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_END);
 
-			for (int i = 0; i < 6; ++i)
+			for (int i = 0; i < 9; ++i)
 			{
-				gtk_box_reorder_child(m_commands_box, m_commands_button[i], 5 - i);
+				gtk_box_reorder_child(m_commands_box, m_commands_button[i], 8 - i);
 			}
 			gtk_box_reorder_child(m_commands_box, m_commands_spacer, 4);
 
@@ -573,7 +568,7 @@ void WhiskerMenu::Window::show(const Position position)
 		{
 			gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_START);
 
-			for (int i = 0; i < 6; ++i)
+			for (int i = 0; i < 9; ++i)
 			{
 				gtk_box_reorder_child(m_commands_box, m_commands_button[i], i);
 			}
@@ -588,9 +583,9 @@ void WhiskerMenu::Window::show(const Position position)
 		{
 			gtk_widget_set_halign(GTK_WIDGET(m_username), GTK_ALIGN_END);
 
-			for (int i = 0; i < 6; ++i)
+			for (int i = 0; i < 9; ++i)
 			{
-				gtk_box_reorder_child(m_commands_box, m_commands_button[i], 5 - i);
+				gtk_box_reorder_child(m_commands_box, m_commands_button[i], 8 - 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 0f90b1b..d66de8d 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[6];
-	gulong m_command_slots[6];
+	GtkWidget* m_commands_button[9];
+	gulong m_command_slots[9];
 
 	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