Remove an unnecessary warning

Don't warn if there's more than one mnemonic label for a widget,
and skip invisible labels.

Bug 665015
This commit is contained in:
Matthias Clasen 2011-12-30 02:01:15 -05:00
parent d7e8388e9d
commit 2637240abe

View File

@ -197,20 +197,21 @@ find_label (GtkWidget *widget)
GList *labels; GList *labels;
GtkWidget *label; GtkWidget *label;
GtkWidget *temp_widget; GtkWidget *temp_widget;
GList *ptr;
labels = gtk_widget_list_mnemonic_labels (widget); labels = gtk_widget_list_mnemonic_labels (widget);
label = NULL; label = NULL;
if (labels) ptr = labels;
while (ptr)
{ {
if (labels->data) if (ptr->data && gtk_widget_get_visible (GTK_WIDGET (ptr->data)))
{ {
if (labels->next) label = ptr->data;
g_warning ("Widget (%s) has more than one label", G_OBJECT_TYPE_NAME (widget)); break;
else
label = labels->data;
} }
g_list_free (labels); ptr = ptr->next;
} }
g_list_free (labels);
/* Ignore a label within a button; bug #136602 */ /* Ignore a label within a button; bug #136602 */
if (label && GTK_IS_BUTTON (widget)) if (label && GTK_IS_BUTTON (widget))