[geany/geany] 20c31b: Fix custom about dialog style overriding

Colomban Wendling git-noreply at xxxxx
Mon Sep 22 17:32:44 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 22 Sep 2014 17:32:44 UTC
Commit:      20c31b62ff0289ba51954e10f315c8bd96eb9ce3
             https://github.com/geany/geany/commit/20c31b62ff0289ba51954e10f315c8bd96eb9ce3

Log Message:
-----------
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.


Modified Paths:
--------------
    src/about.c

Modified: src/about.c
26 lines changed, 6 insertions(+), 20 deletions(-)
===================================================================
@@ -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);
-	gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
-	--recursive;
+	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]);
 }
 
 
 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);
-	gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
-	--recursive;
+	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]);
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list