}
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);
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 */
}
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;
}
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
}
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;
}
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