[gnome-session] Fail whale: respect lockdown
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Fail whale: respect lockdown
- Date: Sun, 28 Aug 2011 20:48:19 +0000 (UTC)
commit 44995eb51e295d09f49849d32b76577fd4c09e94
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 28 16:46:34 2011 -0400
Fail whale: respect lockdown
When logout is disabled, don't show a logout button in
the fail whale. No point in showing shell extension toggles
then, either.
https://bugzilla.gnome.org/show_bug.cgi?id=645477
gnome-session/gsm-fail-whale-dialog.c | 24 ++++++++++++++++--------
gnome-session/gsm-fail-whale-dialog.h | 1 +
gnome-session/gsm-manager.c | 4 +++-
gnome-session/main.c | 2 +-
4 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/gnome-session/gsm-fail-whale-dialog.c b/gnome-session/gsm-fail-whale-dialog.c
index 2b90b8f..a241467 100644
--- a/gnome-session/gsm-fail-whale-dialog.c
+++ b/gnome-session/gsm-fail-whale-dialog.c
@@ -40,6 +40,7 @@
struct _GsmFailWhaleDialogPrivate
{
gboolean debug_mode;
+ gboolean allow_logout;
GdkRectangle geometry;
gboolean show_extensions;
GsmShellExtensions *extensions;
@@ -377,7 +378,9 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
- if (priv->show_extensions && gsm_shell_extensions_n_extensions (priv->extensions) > 0)
+ if (!priv->allow_logout)
+ message_label = gtk_label_new (_("A problem has occurred and the system can't recover. Please contact a system administrator"));
+ else if (priv->show_extensions && gsm_shell_extensions_n_extensions (priv->extensions) > 0)
message_label = gtk_label_new (_("A problem has occurred and the system can't recover. Some of the extensions below may have caused this.\nPlease try disabling some of these, and then log out and try again."));
else
message_label = gtk_label_new (_("A problem has occurred and the system can't recover.\nPlease log out and try again."));
@@ -388,7 +391,7 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
gtk_box_pack_start (GTK_BOX (box),
message_label, FALSE, FALSE, 0);
- if (priv->show_extensions) {
+ if (priv->allow_logout && priv->show_extensions) {
extensions_vbox = gtk_vbox_new (TRUE, 6);
gtk_widget_show (extensions_vbox);
fail_dialog->priv->extensions_box = extensions_vbox;
@@ -413,12 +416,14 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
gtk_box_pack_end (GTK_BOX (box),
button_box, FALSE, FALSE, 0);
- button = gtk_button_new_with_mnemonic (_("_Log Out"));
- gtk_widget_show (button);
- gtk_box_pack_end (GTK_BOX (button_box),
- button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (on_logout_clicked), fail_dialog);
+ if (priv->allow_logout) {
+ button = gtk_button_new_with_mnemonic (_("_Log Out"));
+ gtk_widget_show (button);
+ gtk_box_pack_end (GTK_BOX (button_box),
+ button, FALSE, FALSE, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (on_logout_clicked), fail_dialog);
+ }
}
static void
@@ -430,7 +435,9 @@ gsm_fail_whale_dialog_init (GsmFailWhaleDialog *fail_dialog)
void
gsm_fail_whale_dialog_we_failed (gboolean debug_mode,
+ gboolean allow_logout,
gboolean show_extensions)
+
{
static GsmFailWhaleDialog *current_dialog = NULL;
GsmFailWhaleDialog *fail_dialog;
@@ -441,6 +448,7 @@ gsm_fail_whale_dialog_we_failed (gboolean debug_mode,
fail_dialog = g_object_new (GSM_TYPE_FAIL_WHALE_DIALOG, NULL);
fail_dialog->priv->debug_mode = debug_mode;
+ fail_dialog->priv->allow_logout = allow_logout;
fail_dialog->priv->show_extensions = show_extensions;
setup_window (fail_dialog);
diff --git a/gnome-session/gsm-fail-whale-dialog.h b/gnome-session/gsm-fail-whale-dialog.h
index 44d1a5f..efe1f6b 100644
--- a/gnome-session/gsm-fail-whale-dialog.h
+++ b/gnome-session/gsm-fail-whale-dialog.h
@@ -54,6 +54,7 @@ struct _GsmFailWhaleDialogClass
GType gsm_fail_whale_dialog_get_type (void) G_GNUC_CONST;
void gsm_fail_whale_dialog_we_failed (gboolean debug_mode,
+ gboolean allow_logout,
gboolean show_extensions);
G_END_DECLS
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 12699a9..b531197 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -274,14 +274,16 @@ on_required_app_failure (GsmManager *manager,
{
const gchar *app_id;
gboolean want_extensions_ui;
+ gboolean allow_logout;
app_id = gsm_app_peek_app_id (app);
want_extensions_ui = g_str_equal (app_id, "gnome-shell.desktop");
+ allow_logout = !_log_out_is_locked_down (manager);
gsm_fail_whale_dialog_we_failed (FALSE,
+ allow_logout,
want_extensions_ui);
}
-
static gboolean
_debug_client (const char *id,
GsmClient *client,
diff --git a/gnome-session/main.c b/gnome-session/main.c
index cadf4c3..154e829 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -314,7 +314,7 @@ main (int argc, char **argv)
}
if (please_fail) {
- gsm_fail_whale_dialog_we_failed (TRUE, TRUE);
+ gsm_fail_whale_dialog_we_failed (TRUE, TRUE, TRUE);
gtk_main ();
exit (1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]