From 44187ca3b5c5c5f8647e0db75b38ba3e22875dde Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 24 Mar 2012 01:13:50 +0100 Subject: [PATCH] cssmatcher: Use quarks for classes --- gtk/gtkcssmatcher.c | 10 +++++----- gtk/gtkcssmatcherprivate.h | 4 ++-- gtk/gtkcssselector.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c index 7c09d0ca51..e67c9eff71 100644 --- a/gtk/gtkcssmatcher.c +++ b/gtk/gtkcssmatcher.c @@ -78,15 +78,15 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher *matcher, static gboolean gtk_css_matcher_widget_path_has_class (const GtkCssMatcher *matcher, - const char *class_name) + GQuark class_name) { const GtkWidgetPath *siblings; 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 gtk_widget_path_iter_has_class (siblings, matcher->path.sibling_index, class_name); + return gtk_widget_path_iter_has_qclass (siblings, matcher->path.sibling_index, class_name); else - return gtk_widget_path_iter_has_class (matcher->path.path, matcher->path.index, class_name); + return gtk_widget_path_iter_has_qclass (matcher->path.path, matcher->path.index, class_name); } static gboolean @@ -238,7 +238,7 @@ gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher, static gboolean gtk_css_matcher_any_has_class (const GtkCssMatcher *matcher, - const char *class_name) + GQuark class_name) { return TRUE; } @@ -336,7 +336,7 @@ gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher, static gboolean gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher, - const char *class_name) + GQuark class_name) { if (matcher->superset.relevant & GTK_CSS_CHANGE_CLASS) return _gtk_css_matcher_has_class (matcher->superset.subset, class_name); diff --git a/gtk/gtkcssmatcherprivate.h b/gtk/gtkcssmatcherprivate.h index b562127eaf..121e286ce3 100644 --- a/gtk/gtkcssmatcherprivate.h +++ b/gtk/gtkcssmatcherprivate.h @@ -39,7 +39,7 @@ struct _GtkCssMatcherClass { gboolean (* has_name) (const GtkCssMatcher *matcher, const char *name); gboolean (* has_class) (const GtkCssMatcher *matcher, - const char *class_name); + GQuark class_name); gboolean (* has_id) (const GtkCssMatcher *matcher, const char *id); gboolean (* has_regions) (const GtkCssMatcher *matcher); @@ -110,7 +110,7 @@ _gtk_css_matcher_has_name (const GtkCssMatcher *matcher, static inline gboolean _gtk_css_matcher_has_class (const GtkCssMatcher *matcher, - const char *class_name) + GQuark class_name) { return matcher->klass->has_class (matcher, class_name); } diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c index 1c1ae6bb9b..c124bcff2d 100644 --- a/gtk/gtkcssselector.c +++ b/gtk/gtkcssselector.c @@ -351,14 +351,14 @@ gtk_css_selector_class_print (const GtkCssSelector *selector, GString *string) { g_string_append_c (string, '.'); - g_string_append (string, selector->data); + g_string_append (string, g_quark_to_string (GPOINTER_TO_UINT (selector->data))); } static gboolean gtk_css_selector_class_match (const GtkCssSelector *selector, const GtkCssMatcher *matcher) { - if (!_gtk_css_matcher_has_class (matcher, selector->data)) + if (!_gtk_css_matcher_has_class (matcher, GPOINTER_TO_UINT (selector->data))) return FALSE; return gtk_css_selector_match (gtk_css_selector_previous (selector), matcher); @@ -764,7 +764,7 @@ parse_selector_class (GtkCssParser *parser, GtkCssSelector *selector) selector = gtk_css_selector_new (>K_CSS_SELECTOR_CLASS, selector, - g_intern_string (name)); + GUINT_TO_POINTER (g_quark_from_string (name))); g_free (name);