[geany/geany] ec7071: Fix GTK frame clock warnings with our about dialog

Colomban Wendling git-noreply at xxxxx
Sat Jun 21 16:35:17 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 21 Jun 2014 16:35:17 UTC
Commit:      ec7071062c5dc39d5f893a830b3c26968a579251
             https://github.com/geany/geany/commit/ec7071062c5dc39d5f893a830b3c26968a579251

Log Message:
-----------
Fix GTK frame clock warnings with our about dialog

We used to set the widget's style in a style-set handler, and despite
guarding ourselves from recursive invocations, the GTK frame clock
introduced by GTK 3.8 didn't like it very much.

So, replace the manual color modification by a simpler global widget
state modification, making the code simpler and smaller, yet achieving
the same result (or so I hope and see).


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

Modified: src/about.c
38 lines changed, 2 insertions(+), 36 deletions(-)
===================================================================
@@ -120,8 +120,6 @@ static const gchar *contributors =
 "Tyler Mulligan, Walery Studennikov, Yura Siamashka";
 
 
-static void header_eventbox_style_set(GtkWidget *widget);
-static void header_label_style_set(GtkWidget *widget);
 static void homepage_clicked(GtkButton *button, gpointer data);
 
 
@@ -189,10 +187,8 @@ static GtkWidget *create_dialog(void)
 	gtk_label_set_markup(GTK_LABEL(header_label), buffer);
 	gtk_widget_show(header_label);
 	gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE, FALSE, 0);
-	header_eventbox_style_set(header_eventbox);
-	header_label_style_set(header_label);
-	g_signal_connect_after(header_eventbox, "style-set", G_CALLBACK(header_eventbox_style_set), NULL);
-	g_signal_connect_after(header_label, "style-set", G_CALLBACK(header_label_style_set), NULL);
+	gtk_widget_set_state(header_eventbox, GTK_STATE_SELECTED);
+	gtk_widget_set_state(header_label, GTK_STATE_SELECTED);
 	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), header_eventbox, FALSE, FALSE, 0);
 
 	/* create notebook */
@@ -456,36 +452,6 @@ 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;
-}
-
-
-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;
-}
-
-
 static void homepage_clicked(GtkButton *button, gpointer data)
 {
 	utils_open_browser(data);



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