[gnome-session] gsm: Only show extensions UI when gnome-shell crashes



commit 14fa54c0f2b86b93e00c53fe931cc81769112e05
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 26 17:13:33 2011 -0400

    gsm: Only show extensions UI when gnome-shell crashes
    
    If another required component fails, it's quite useless here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656747

 gnome-session/gsm-fail-whale-dialog.c |   35 ++++++++++++++++++--------------
 gnome-session/gsm-fail-whale-dialog.h |    3 +-
 gnome-session/gsm-manager.c           |    8 ++++++-
 gnome-session/main.c                  |    2 +-
 4 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/gnome-session/gsm-fail-whale-dialog.c b/gnome-session/gsm-fail-whale-dialog.c
index 270a925..2b90b8f 100644
--- a/gnome-session/gsm-fail-whale-dialog.c
+++ b/gnome-session/gsm-fail-whale-dialog.c
@@ -41,6 +41,7 @@ struct _GsmFailWhaleDialogPrivate
 {
         gboolean debug_mode;
         GdkRectangle geometry;
+        gboolean show_extensions;
         GsmShellExtensions *extensions;
         GtkWidget *extensions_box;
 };
@@ -329,6 +330,7 @@ build_extension_toggle (GsmShellExtensions *extensions,
 static void
 setup_window (GsmFailWhaleDialog *fail_dialog)
 {
+        GsmFailWhaleDialogPrivate *priv;
         GtkWidget *alignment;
         GtkWidget *box;
         GtkWidget *image;
@@ -339,9 +341,8 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
         GtkWidget *extensions_scroll;
         GtkWidget *extensions_vbox;
         char *markup;
-        GsmShellExtensions *extensions;
 
-        extensions = fail_dialog->priv->extensions;
+        priv = fail_dialog->priv;
 
         gtk_window_set_title (GTK_WINDOW (fail_dialog), "");
         gtk_window_set_icon_name (GTK_WINDOW (fail_dialog), GSM_ICON_COMPUTER_FAIL);
@@ -387,22 +388,24 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
         gtk_box_pack_start (GTK_BOX (box),
                             message_label, FALSE, FALSE, 0);
 
-        extensions_vbox = gtk_vbox_new (TRUE, 6);
-        gtk_widget_show (extensions_vbox);
-        fail_dialog->priv->extensions_box = extensions_vbox;
+        if (priv->show_extensions) {
+                extensions_vbox = gtk_vbox_new (TRUE, 6);
+                gtk_widget_show (extensions_vbox);
+                fail_dialog->priv->extensions_box = extensions_vbox;
 
-        extensions_scroll = gtk_scrolled_window_new (NULL, NULL);
-        gtk_widget_show (extensions_scroll);
+                extensions_scroll = gtk_scrolled_window_new (NULL, NULL);
+                gtk_widget_show (extensions_scroll);
 
-        gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (extensions_scroll),
-                                               extensions_vbox);
+                gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (extensions_scroll),
+                                                       extensions_vbox);
 
-        gtk_box_pack_start (GTK_BOX (box),
-                            extensions_scroll, FALSE, FALSE, 0);
+                gtk_box_pack_start (GTK_BOX (box),
+                                    extensions_scroll, FALSE, FALSE, 0);
 
-        gsm_shell_extensions_foreach (extensions,
-                                      build_extension_toggle,
-                                      (gpointer) fail_dialog);
+                gsm_shell_extensions_foreach (priv->extensions,
+                                              build_extension_toggle,
+                                              (gpointer) fail_dialog);
+        }
 
         button_box = gtk_hbutton_box_new ();
         gtk_container_set_border_width (GTK_CONTAINER (button_box), 20);
@@ -426,7 +429,8 @@ gsm_fail_whale_dialog_init (GsmFailWhaleDialog *fail_dialog)
 }
 
 void
-gsm_fail_whale_dialog_we_failed (gboolean debug_mode)
+gsm_fail_whale_dialog_we_failed (gboolean debug_mode,
+                                 gboolean show_extensions)
 {
         static GsmFailWhaleDialog *current_dialog = NULL;
         GsmFailWhaleDialog        *fail_dialog;
@@ -437,6 +441,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->show_extensions = show_extensions;
         setup_window (fail_dialog);
 
         current_dialog = fail_dialog;
diff --git a/gnome-session/gsm-fail-whale-dialog.h b/gnome-session/gsm-fail-whale-dialog.h
index f070d1b..44d1a5f 100644
--- a/gnome-session/gsm-fail-whale-dialog.h
+++ b/gnome-session/gsm-fail-whale-dialog.h
@@ -53,7 +53,8 @@ struct _GsmFailWhaleDialogClass
 
 GType        gsm_fail_whale_dialog_get_type   (void) G_GNUC_CONST;
 
-void         gsm_fail_whale_dialog_we_failed  (gboolean debug_mode);
+void         gsm_fail_whale_dialog_we_failed  (gboolean debug_mode,
+                                               gboolean show_extensions);
 
 G_END_DECLS
 
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index b362bab..7cba07d 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -272,7 +272,13 @@ static void
 on_required_app_failure (GsmManager  *manager,
                          GsmApp      *app)
 {
-        gsm_fail_whale_dialog_we_failed (FALSE);
+        const gchar *app_id;
+        gboolean want_extensions_ui;
+
+        app_id = gsm_app_peek_app_id (app);
+        want_extensions_ui = g_str_equal (app_id, "gnome-shell.desktop");
+        gsm_fail_whale_dialog_we_failed (FALSE,
+                                         want_extensions_ui);
 }
 
 
diff --git a/gnome-session/main.c b/gnome-session/main.c
index e57392a..cadf4c3 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);
+                gsm_fail_whale_dialog_we_failed (TRUE, TRUE);
                 gtk_main ();
                 exit (1);
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]