[Xfce4-commits] <xfce4-panel:master> Ask to start panel when opening preferences without instance.
Nick Schermer
noreply at xfce.org
Sat Jun 12 19:36:01 CEST 2010
Updating branch refs/heads/master
to f739eb1461cc1b5276c4163366cb940c25775fdc (commit)
from d139268f6404ef58a1d3138d2510e45e34ad9b9b (commit)
commit f739eb1461cc1b5276c4163366cb940c25775fdc
Author: Nick Schermer <nick at xfce.org>
Date: Sat Jun 12 19:05:09 2010 +0200
Ask to start panel when opening preferences without instance.
This makes it a lot easier for users to start the panel
after it is somehow lost from the session, just click the
panel preferences button in the settings manager.
panel/main.c | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/panel/main.c b/panel/main.c
index fe4f63d..f2b8d6e 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -47,6 +47,7 @@
#include <panel/panel-application.h>
#include <panel/panel-dbus-service.h>
#include <panel/panel-dbus-client.h>
+#include <panel/panel-preferences-dialog.h>
@@ -227,6 +228,8 @@ main (gint argc, gchar **argv)
goto dbus_return;
}
+ launch_panel:
+
/* start session management */
sm_client = xfce_sm_client_get ();
xfce_sm_client_set_restart_style (sm_client, XFCE_SM_CLIENT_RESTART_IMMEDIATELY);
@@ -246,6 +249,10 @@ main (gint argc, gchar **argv)
application = panel_application_get ();
+ /* open dialog if we started from launch_panel */
+ if (opt_preferences >= 0)
+ panel_preferences_dialog_show (panel_application_get_nth_window (application, opt_preferences));
+
gtk_main ();
/* make sure there are no incomming events when we close */
@@ -295,9 +302,31 @@ dbus_return:
/* show understandable message for this common error */
if (error->code == DBUS_GERROR_NAME_HAS_NO_OWNER)
{
- g_clear_error (&error);
- /* I18N: %s is replaced with xfce4-panel */
- g_set_error (&error, 0, 0, _("No running instance of %s was found"), G_LOG_DOMAIN);
+ /* normally start the panel */
+ if (opt_preferences >= 0)
+ {
+ g_clear_error (&error);
+
+ if (xfce_dialog_confirm (NULL, GTK_STOCK_EXECUTE, NULL,
+ _("Do you want to start the Xfce panel? If you do, make sure "
+ "you save the session on logout, so the panel is "
+ "automatically started the next time you login."),
+ _("No running instance of %s was found"), G_LOG_DOMAIN))
+ {
+ panel_debug (PANEL_DEBUG_DOMAIN_MAIN, "start panel of asking user");
+ goto launch_panel;
+ }
+ else
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ /* I18N: %s is replaced with xfce4-panel */
+ g_clear_error (&error);
+ g_set_error (&error, 0, 0, _("No running instance of %s was found."), G_LOG_DOMAIN);
+ }
}
/* show error dialog */
More information about the Xfce4-commits
mailing list