? p
Index: profile-editor.c
===================================================================
RCS file: /cvs/gnome/gnome-terminal/src/profile-editor.c,v
retrieving revision 1.59
diff -U5 -r1.59 profile-editor.c
--- profile-editor.c	6 Oct 2006 10:47:39 -0000	1.59
+++ profile-editor.c	17 Oct 2006 07:48:01 -0000
@@ -1313,19 +1313,34 @@
   /*   gtk_widget_show_all (editor);*/
   gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void
+widget_and_labels_set_sensitive (GtkWidget *widget, gboolean sensitive)
+{
+  GList *labels, *i;
+
+  labels = gtk_widget_list_mnemonic_labels (widget);
+  for (i = labels; i; i = i->next)
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (i->data), sensitive);
+    }
+  g_list_free (labels);
+
+  gtk_widget_set_sensitive (widget, sensitive);
+}
+
+static void
 set_insensitive (GtkWidget  *editor,
                  const char *widget_name,
                  gboolean    setting)
 {
   GtkWidget *w;  
 
   w = profile_editor_get_widget (editor, widget_name);
 
-  gtk_widget_set_sensitive (w, !setting);
+  widget_and_labels_set_sensitive (w, !setting);
 }
 
 static void
 profile_editor_update_sensitivity (GtkWidget       *editor,
                                    TerminalProfile *profile)
@@ -1347,52 +1362,35 @@
   mask = terminal_profile_get_locked_settings (profile);
 
   /* This one can't be short-circuited by the cache, since
    * it depends on settings
    */
-  w = profile_editor_get_widget (editor, "custom-command-entry");
-  gtk_widget_set_sensitive (w,
-                            !((mask->custom_command) ||
-                              !terminal_profile_get_use_custom_command (profile))); 
+  set_insensitive (editor, "custom-command-entry",
+                   mask->custom_command ||
+                     !terminal_profile_get_use_custom_command (profile));
 
   w = profile_editor_get_widget (editor, "custom-command-entry-label");
   gtk_widget_set_sensitive (w,
                             !((mask->custom_command) ||
                               !terminal_profile_get_use_custom_command (profile))); 
   if (terminal_profile_get_background_type (profile) == TERMINAL_BACKGROUND_IMAGE)
     {
-      w = profile_editor_get_widget (editor, "background-image-filechooser");
-      gtk_widget_set_sensitive (w, !(mask->background_image_file));
-      w = profile_editor_get_widget (editor, "background-image-filechooser-label");
-      gtk_widget_set_sensitive (w, !(mask->background_image_file));
-      w = profile_editor_get_widget (editor, "scroll-background-checkbutton");
-      gtk_widget_set_sensitive (w, !(mask->scroll_background));
-      w = profile_editor_get_widget (editor, "darken-background-vbox");
-      gtk_widget_set_sensitive (w, !(mask->background_darkness));
+      set_insensitive (editor, "background-image-filechooser", mask->background_image_file);
+      set_insensitive (editor, "scroll-background-checkbutton", mask->scroll_background);
+      set_insensitive (editor, "darken-background-vbox", mask->background_darkness);
     }
   else if (terminal_profile_get_background_type (profile) == TERMINAL_BACKGROUND_TRANSPARENT) 
-  {
-      w = profile_editor_get_widget (editor, "darken-background-vbox");
-      gtk_widget_set_sensitive (w, !(mask->background_darkness));
-      w = profile_editor_get_widget (editor, "background-image-filechooser");
-      gtk_widget_set_sensitive (w, FALSE);
-      w = profile_editor_get_widget (editor, "background-image-filechooser-label");
-      gtk_widget_set_sensitive (w, FALSE);
-      w = profile_editor_get_widget (editor, "scroll-background-checkbutton");
-      gtk_widget_set_sensitive (w, FALSE);
-      
+    {
+      set_insensitive (editor, "background-image-filechooser", TRUE);
+      set_insensitive (editor, "scroll-background-checkbutton", TRUE);
+      set_insensitive (editor, "darken-background-vbox", mask->background_darkness);
     }
   else
     {
-      w = profile_editor_get_widget (editor, "background-image-filechooser");
-      gtk_widget_set_sensitive (w, FALSE);
-      w = profile_editor_get_widget (editor, "background-image-filechooser-label");
-      gtk_widget_set_sensitive (w, FALSE);
-      w = profile_editor_get_widget (editor, "scroll-background-checkbutton");
-      gtk_widget_set_sensitive (w, FALSE);
-      w = profile_editor_get_widget (editor, "darken-background-vbox");
-      gtk_widget_set_sensitive (w, FALSE);
+      set_insensitive (editor, "background-image-filechooser", TRUE);
+      set_insensitive (editor, "scroll-background-checkbutton", TRUE);
+      set_insensitive (editor, "darken-background-vbox", TRUE);
     }
 
   if (!terminal_profile_get_use_system_font (profile))
     {
       if (terminal_widget_supports_pango_fonts ())
@@ -1400,12 +1398,11 @@
       else
         set_insensitive (editor, "font-hbox", mask->x_font);
     }
   else
     {
-      w = profile_editor_get_widget (editor, "font-hbox");
-      gtk_widget_set_sensitive (w, FALSE);
+      set_insensitive (editor, "font-hbox", TRUE);
     }
 
 
   if (terminal_profile_get_use_theme_colors (profile))
     {

