diff options
author | Garrett Regier <garrettregier@gmail.com> | 2015-09-11 17:49:59 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-09-11 18:26:11 +0200 |
commit | 41b386cd6a84957dd9820083fa594090660c6a5d (patch) | |
tree | acaff7d5678360b58f5b3af546f7c4f2dc0c3a65 /gtk/gtkcssnodedeclaration.c | |
parent | 44460cd7207692e73f4374865a34314800ec2856 (diff) | |
download | gtk+-41b386cd6a84957dd9820083fa594090660c6a5d.tar.gz |
cssnode: Optimize listing of classes
Avoid creating the GList of strings when the GQuarks
will just be determined again. Instead have
gtk_style_context_list_classes() do it specifically.
Diffstat (limited to 'gtk/gtkcssnodedeclaration.c')
-rw-r--r-- | gtk/gtkcssnodedeclaration.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/gtk/gtkcssnodedeclaration.c b/gtk/gtkcssnodedeclaration.c index 221faef7b0..c16189b1fe 100644 --- a/gtk/gtkcssnodedeclaration.c +++ b/gtk/gtkcssnodedeclaration.c @@ -335,22 +335,13 @@ gtk_css_node_declaration_has_class (const GtkCssNodeDeclaration *decl, } } -GList * -gtk_css_node_declaration_list_classes (const GtkCssNodeDeclaration *decl) +const GQuark * +gtk_css_node_declaration_get_classes (const GtkCssNodeDeclaration *decl, + guint *n_classes) { - GQuark *classes; - GList *result; - guint i; - - classes = get_classes (decl); - result = NULL; - - for (i = 0; i < decl->n_classes; i++) - { - result = g_list_prepend (result, GUINT_TO_POINTER (classes[i])); - } + *n_classes = decl->n_classes; - return result; + return get_classes (decl); } static gboolean @@ -589,8 +580,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS classes = get_classes (decl); for (i = 0; i < decl->n_classes; i++) { - gtk_widget_path_iter_add_class (path, pos, - g_quark_to_string (classes[i])); + gtk_widget_path_iter_add_qclass (path, pos, classes[i]); } /* Set widget state */ |