summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-11-18 11:50:55 -0500
committerMatthias Clasen <mclasen@redhat.com>2015-11-20 13:57:22 -0500
commitc1547cb602aa7ee95882cd451cef7a04c6854632 (patch)
tree8fe841d758dcf99b697e590e18e8db8937166984
parent71ca0bf294511174ffaf209e59c436bf383bd431 (diff)
downloadglade-c1547cb602aa7ee95882cd451cef7a04c6854632.tar.gz
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
-rw-r--r--gladeui/glade-signal-editor.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index 0bec9337..c776bc1f 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,