[glade/wip/matthiasc/shortcuts: 4/6] signal editor: Avoid GTK+ warnings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/wip/matthiasc/shortcuts: 4/6] signal editor: Avoid GTK+ warnings
- Date: Sat, 21 Nov 2015 17:34:03 +0000 (UTC)
commit c1547cb602aa7ee95882cd451cef7a04c6854632
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Nov 18 11:50:55 2015 -0500
signal editor: Avoid GTK+ warnings
GTK+ warns nowadays if the state passed to gtk_style_context_get_*
does not match the state of the context. Avoid this by setting
the state beforehand. This is just a bandaid fix; the drawing
should be redone in terms of gtk_render_ APIs instead of poking
at colors.
https://bugzilla.gnome.org/show_bug.cgi?id=758299
gladeui/glade-signal-editor.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index 0bec933..c776bc1 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -973,17 +973,21 @@ glade_signal_editor_handler_cell_data_func (GtkTreeViewColumn *column,
dummy = glade_signal_is_dummy (signal);
if (dummy)
{
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_INSENSITIVE, &color);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, gtk_style_context_get_state (context) |
GTK_STATE_FLAG_INSENSITIVE);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &color);
g_object_set (renderer,
"style", PANGO_STYLE_ITALIC,
"foreground-rgba", &color,
NULL);
+ gtk_style_context_restore (context);
}
else
{
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_NORMAL,
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
&color);
g_object_set (renderer,
"style", PANGO_STYLE_NORMAL,
@@ -1030,8 +1034,11 @@ glade_signal_editor_detail_cell_data_func (GtkTreeViewColumn *column,
dummy = glade_signal_is_dummy (signal);
if (dummy || !glade_signal_get_detail (signal))
{
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_INSENSITIVE, &color);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, gtk_style_context_get_state (context) |
GTK_STATE_FLAG_INSENSITIVE);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &color);
g_object_set (renderer,
"style", PANGO_STYLE_ITALIC,
"foreground-rgba", &color,
@@ -1039,8 +1046,8 @@ glade_signal_editor_detail_cell_data_func (GtkTreeViewColumn *column,
}
else
{
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_NORMAL,
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
&color);
g_object_set (renderer,
"style", PANGO_STYLE_NORMAL,
@@ -1096,17 +1103,22 @@ glade_signal_editor_data_cell_data_func (GtkTreeViewColumn *column,
if (dummy || !glade_signal_get_userdata (signal))
{
- gtk_style_context_get_color (context, GTK_STATE_FLAG_INSENSITIVE, &color);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, gtk_style_context_get_state (context) |
GTK_STATE_FLAG_INSENSITIVE);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &color);
g_object_set (renderer,
"style", PANGO_STYLE_ITALIC,
"foreground-rgba", &color,
NULL);
+ gtk_style_context_restore (context);
}
else
{
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_NORMAL,
- &color);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &color);
g_object_set (renderer,
"style", PANGO_STYLE_NORMAL,
"foreground-rgba", &color,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]