More auto-mnemonics tweaks

When auto-mnemonics are on, hide mnemonics with insensitive target.
This commit is contained in:
Matthias Clasen 2009-12-20 18:29:47 -05:00
parent 6f421d1450
commit 72e41b41f5

View File

@ -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;