[gedit] Use style context save/restore instead of removing the class



commit 80f2a3a3e81cb4bdd937fad5dc604a33729f4a03
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Aug 15 21:22:53 2015 +0200

    Use style context save/restore instead of removing the class
    
    This is actually the real cuplrit of the performance regression
    fixed by the previous commit. Now that we do it just once it
    does not matter in practice, but let's do it anyway because
    it is the right way of doing things and so that we recall in
    case we need to go back at setting the class in the cell func

 gedit/gedit-open-document-selector.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-open-document-selector.c b/gedit/gedit-open-document-selector.c
index 0f27535..b6077b7 100644
--- a/gedit/gedit-open-document-selector.c
+++ b/gedit/gedit-open-document-selector.c
@@ -1092,16 +1092,18 @@ setup_treeview (GeditOpenDocumentSelector *selector)
        gtk_style_context_add_class (context, "open-document-selector-treeview");
 
        /* Name label foreground and font size styling */
+       gtk_style_context_save (context);
        gtk_style_context_add_class (context, "open-document-selector-name-label");
        gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &selector->name_label_color);
        gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, "font-size", &selector->name_font_size, NULL);
-       gtk_style_context_remove_class (context, "open-document-selector-name-label");
+       gtk_style_context_restore (context);
 
        /* Path label foreground and font size styling */
+       gtk_style_context_save (context);
        gtk_style_context_add_class (context, "open-document-selector-path-label");
        gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &selector->path_label_color);
        gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, "font-size", &selector->path_font_size, NULL);
-       gtk_style_context_remove_class (context, "open-document-selector-path-label");
+       gtk_style_context_restore (context);
 
        gtk_tree_view_column_set_cell_data_func (column,
                                                 selector->name_renderer,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]