X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkcssmatcher.c;h=ccdf5479cf853575e5e1fd3615a05c09f9a8b0e9;hb=45ad8a06ad511ad95a74172172b9fe459bc666ad;hp=e67c9eff719ecccca281945c7a4c3a97fa3606e5;hpb=44187ca3b5c5c5f8647e0db75b38ba3e22875dde;p=~andy%2Fgtk diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c index e67c9eff7..ccdf5479c 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,24 +177,30 @@ 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, gtk_css_matcher_widget_path_has_region, gtk_css_matcher_widget_path_has_position, + FALSE }; -void +gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher, const GtkWidgetPath *path, GtkStateFlags state) { + if (gtk_widget_path_length (path) == 0) + return FALSE; + matcher->path.klass = >K_CSS_MATCHER_WIDGET_PATH; matcher->path.path = path; matcher->path.state_flags = state; matcher->path.index = gtk_widget_path_length (path) - 1; matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index); + + return TRUE; } /* GTK_CSS_MATCHER_WIDGET_ANY */ @@ -230,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; } @@ -277,12 +281,13 @@ 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, gtk_css_matcher_any_has_region, gtk_css_matcher_any_has_position, + TRUE }; void @@ -325,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; } @@ -395,12 +400,13 @@ 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, gtk_css_matcher_superset_has_region, gtk_css_matcher_superset_has_position, + FALSE }; void