diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-11-18 11:50:55 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-11-25 22:22:05 -0500 |
commit | 3604a2a9fc2ce36e09c0d6a2d26ef8aeaec0c179 (patch) | |
tree | 80d17a8893d0a82f018dedeb79a2ad8195e69ccf /gladeui/glade-signal-editor.c | |
parent | 23d5293d22a69f366699b78b6fafba7ec9b9af73 (diff) | |
download | glade-3604a2a9fc2ce36e09c0d6a2d26ef8aeaec0c179.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
Diffstat (limited to 'gladeui/glade-signal-editor.c')
-rw-r--r-- | gladeui/glade-signal-editor.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c index 0bec9337..407251fa 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,17 +1034,21 @@ 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, 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, @@ -1096,17 +1104,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, |