[gtk+] More auto-mnemonics tweaks



commit 72e41b41f506e0172bf12b4277918f11f06511a5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 20 18:29:47 2009 -0500

    More auto-mnemonics tweaks
    
    When auto-mnemonics are on, hide mnemonics with insensitive target.

 gtk/gtklabel.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 475d842..9a3dbbb 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1582,9 +1582,6 @@ mnemonics_visible_apply (GtkWidget *widget,
 
   label = GTK_LABEL (widget);
 
-  if (!label->use_underline)
-    return;
-
   priv = GTK_LABEL_GET_PRIVATE (label);
 
   mnemonics_visible = mnemonics_visible != FALSE;
@@ -2491,6 +2488,7 @@ gtk_label_set_pattern_internal (GtkLabel    *label,
   GtkLabelPrivate *priv = GTK_LABEL_GET_PRIVATE (label);
   PangoAttrList *attrs;
   gboolean enable_mnemonics;
+  gboolean auto_mnemonics;
 
   g_return_if_fail (GTK_IS_LABEL (label));
 
@@ -2499,10 +2497,14 @@ gtk_label_set_pattern_internal (GtkLabel    *label,
 
   g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
 		"gtk-enable-mnemonics", &enable_mnemonics,
+		"gtk-auto-mnemonics", &auto_mnemonics,
 		NULL);
 
   if (enable_mnemonics && priv->mnemonics_visible && pattern &&
-      GTK_WIDGET_IS_SENSITIVE (label))
+      (!auto_mnemonics ||
+       (GTK_WIDGET_IS_SENSITIVE (label) &&
+        (!label->mnemonic_widget ||
+         GTK_WIDGET_IS_SENSITIVE (label->mnemonic_widget)))))
     attrs = gtk_label_pattern_to_attrs (label, pattern);
   else
     attrs = NULL;



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