[Xfce4-commits] <xfce4-panel:master> Allow to quit the panel if no session manager is running.
Nick Schermer
noreply at xfce.org
Mon Jul 26 21:08:01 CEST 2010
Updating branch refs/heads/master
to 4af96ff4667c143cd2d8d4b1c2a8921a02ca4654 (commit)
from e2d4d108db54af970a8c3911d6847680e5da24b5 (commit)
commit 4af96ff4667c143cd2d8d4b1c2a8921a02ca4654
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jul 26 21:05:39 2010 +0200
Allow to quit the panel if no session manager is running.
This way users without xfce4-panel can quit they X server because
startxfce4 relies on a running panel for that.
panel/panel-application.c | 17 +++++++++++++++--
plugins/actions/actions.c | 13 +++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 5120c3a..e3e059f 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -1413,17 +1413,30 @@ panel_application_logout (void)
{
XfceSMClient *sm_client;
GError *error = NULL;
+ const gchar *command = "xfce4-session-logout";
/* first try to session client to logout else fallback and spawn xfce4-session-logout */
sm_client = xfce_sm_client_get ();
if (xfce_sm_client_is_connected (sm_client))
{
xfce_sm_client_request_shutdown (sm_client, XFCE_SM_CLIENT_SHUTDOWN_HINT_ASK);
+
+ return;
+ }
+ else if (g_getenv ("SESSION_MANAGER") == NULL)
+ {
+ if (xfce_dialog_confirm (NULL, GTK_STOCK_QUIT, NULL,
+ _("If you have started Xfce without session manager, this will close the X server."),
+ _("Are you sure you want to quit the panel?")))
+ command = "xfce4-panel --quit";
+ else
+ return;
}
- else if (!g_spawn_command_line_async ("xfce4-session-logout", &error))
+
+ if (!g_spawn_command_line_async (command, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\""),
- "xfce4-session-logout");
+ command);
g_error_free (error);
}
}
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 620879c..7aaa7a0 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -404,6 +404,19 @@ actions_plugin_button_spawn_command (const gchar *command)
{
GError *error = NULL;
+ if (g_getenv ("SESSION_MANAGER") == NULL)
+ {
+ /* TRANSLATORS: no session manager is launched, so avoid any
+ * problems and ask the user to quit the panel so users without
+ * xfce4-session can still close the xserver */
+ if (xfce_dialog_confirm (NULL, GTK_STOCK_QUIT, NULL,
+ _("If you have started Xfce without session manager, this will close the X server."),
+ _("Are you sure you want to quit the panel?")))
+ command = "xfce4-panel --quit";
+ else
+ return;
+ }
+
if (!g_spawn_command_line_async (command, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\""), command);
More information about the Xfce4-commits
mailing list