diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-12-10 12:57:10 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-12-10 12:57:10 +0100 |
commit | a1ee2b7b82154a506f6dee546975ed97a5fc9e2a (patch) | |
tree | 90a3962d58e8474e092be859d86166c974e68c2c /gtk/gtkcssmatcher.c | |
parent | 089eafb468ac1a49dfd839421346d1ad9b9c3263 (diff) | |
download | gtk+-a1ee2b7b82154a506f6dee546975ed97a5fc9e2a.tar.gz |
css: Speed up name matching
We use the new g_type_get_type_registration_serial() so that we can
cache and properly invalidate the result of g_type_from_name().
This bumps the glib requirement to 2.35.3 to get the new function.
https://bugzilla.gnome.org/show_bug.cgi?id=689847
Diffstat (limited to 'gtk/gtkcssmatcher.c')
-rw-r--r-- | gtk/gtkcssmatcher.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c index 68207387fe..ccdf5479cf 100644 --- a/gtk/gtkcssmatcher.c +++ b/gtk/gtkcssmatcher.c @@ -62,13 +62,11 @@ gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher) } static gboolean -gtk_css_matcher_widget_path_has_name (const GtkCssMatcher *matcher, - const char *name) +gtk_css_matcher_widget_path_has_type (const GtkCssMatcher *matcher, + GType type) { const GtkWidgetPath *siblings; - GType type; - - type = g_type_from_name (name); + siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index); if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index)) return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), type); @@ -179,7 +177,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = { gtk_css_matcher_widget_path_get_parent, gtk_css_matcher_widget_path_get_previous, gtk_css_matcher_widget_path_get_state, - gtk_css_matcher_widget_path_has_name, + gtk_css_matcher_widget_path_has_type, gtk_css_matcher_widget_path_has_class, gtk_css_matcher_widget_path_has_id, gtk_css_matcher_widget_path_has_regions, @@ -236,8 +234,8 @@ gtk_css_matcher_any_get_state (const GtkCssMatcher *matcher) } static gboolean -gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher, - const char *name) +gtk_css_matcher_any_has_type (const GtkCssMatcher *matcher, + GType type) { return TRUE; } @@ -283,7 +281,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = { gtk_css_matcher_any_get_parent, gtk_css_matcher_any_get_previous, gtk_css_matcher_any_get_state, - gtk_css_matcher_any_has_name, + gtk_css_matcher_any_has_type, gtk_css_matcher_any_has_class, gtk_css_matcher_any_has_id, gtk_css_matcher_any_has_regions, @@ -332,11 +330,11 @@ gtk_css_matcher_superset_get_state (const GtkCssMatcher *matcher) } static gboolean -gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher, - const char *name) +gtk_css_matcher_superset_has_type (const GtkCssMatcher *matcher, + GType type) { if (matcher->superset.relevant & GTK_CSS_CHANGE_NAME) - return _gtk_css_matcher_has_name (matcher->superset.subset, name); + return _gtk_css_matcher_has_type (matcher->superset.subset, type); else return TRUE; } @@ -402,7 +400,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = { gtk_css_matcher_superset_get_parent, gtk_css_matcher_superset_get_previous, gtk_css_matcher_superset_get_state, - gtk_css_matcher_superset_has_name, + gtk_css_matcher_superset_has_type, gtk_css_matcher_superset_has_class, gtk_css_matcher_superset_has_id, gtk_css_matcher_superset_has_regions, |