Fix custom about dialog style overriding

Don't assume changing the style inside a style-set handler results in
recursion, as it would be wrong if the next signal emission was
triggered asynchronously.  Instead, only modify the style if it isn't
already as we want it.

This fixes the about dialog's style-set handlers on GTK 3.10 which
didn't liked constant style updating.
This commit is contained in:
Colomban Wendling 2014-09-22 19:25:03 +02:00
parent 76d6e9faa9
commit 20c31b62ff

View File

@ -458,31 +458,17 @@ void about_dialog_show(void)
static void header_eventbox_style_set(GtkWidget *widget)
{
static gint recursive = 0;
GtkStyle *style;
if (recursive > 0)
return;
++recursive;
style = gtk_widget_get_style(widget);
GtkStyle *style = gtk_widget_get_style(widget);
if (! gdk_color_equal(&style->bg[GTK_STATE_NORMAL], &style->bg[GTK_STATE_SELECTED]))
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
--recursive;
}
static void header_label_style_set(GtkWidget *widget)
{
static gint recursive = 0;
GtkStyle *style;
if (recursive > 0)
return;
++recursive;
style = gtk_widget_get_style(widget);
GtkStyle *style = gtk_widget_get_style(widget);
if (! gdk_color_equal(&style->fg[GTK_STATE_NORMAL], &style->fg[GTK_STATE_SELECTED]))
gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
--recursive;
}