[glade/wip/matthiasc/shortcuts: 5/6] string list: Avoid GTK+ warnings



commit 0d31345616cb867a21eaa3b883b4f9a437b1ea74
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Nov 18 11:52:07 2015 -0500

    string list: 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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758300

 plugins/gtk+/glade-string-list.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/glade-string-list.c b/plugins/gtk+/glade-string-list.c
index 292dfbc..c4175a6 100644
--- a/plugins/gtk+/glade-string-list.c
+++ b/plugins/gtk+/glade-string-list.c
@@ -522,7 +522,10 @@ cell_data_func (GtkTreeViewColumn   *column,
 
       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);
+          gtk_style_context_restore (context);
          g_object_set (renderer, 
                        "style", PANGO_STYLE_ITALIC,
                        "foreground-rgba", &color,
@@ -530,7 +533,7 @@ cell_data_func (GtkTreeViewColumn   *column,
        }
       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]