[geany/geany] 76d6e9: Revert "Fix GTK frame clock warnings with our about dialog"

Colomban Wendling git-noreply at xxxxx
Mon Sep 22 17:29:26 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:29:26 UTC
Commit:      76d6e9faa900773bcc45e0f947b532c9a5233af0
             https://github.com/geany/geany/commit/76d6e9faa900773bcc45e0f947b532c9a5233af0

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

This reverts commit ec7071062c5dc39d5f893a830b3c26968a579251.

Apparently the selected state of an event box doesn't necessary mean it
will be styled with a selection background color.  This e.g. isn't the
case in GTK 3.14's Adwaita (default) theme.

So, revert the commit that removed custom style overrides.  Next commit
will fix the GTK 3.10 problem this reverted commit fixed.


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

Modified: src/about.c
38 lines changed, 36 insertions(+), 2 deletions(-)
===================================================================
@@ -120,6 +120,8 @@ 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);
 
 
@@ -187,8 +189,10 @@ 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);
-	gtk_widget_set_state(header_eventbox, GTK_STATE_SELECTED);
-	gtk_widget_set_state(header_label, GTK_STATE_SELECTED);
+	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_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), header_eventbox, FALSE, FALSE, 0);
 
 	/* create notebook */
@@ -452,6 +456,36 @@ 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