summaryrefslogtreecommitdiff
path: root/gtk/gtkcssmatcher.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-10-27 01:26:20 +0100
committerBenjamin Otte <otte@redhat.com>2015-10-27 01:44:50 +0100
commit101df329ae7d4df779230ac565a7507fda44025d (patch)
tree18b8afca7878b4b29b6078d3cd598f7cba48adf5 /gtk/gtkcssmatcher.c
parentaedd193c69f5857917369c083be04bd24a1e770e (diff)
downloadgtk+-101df329ae7d4df779230ac565a7507fda44025d.tar.gz
API: Add gtk_widget_path_iter_set_object_name()
... and gtk_widget_path_iter_get_object_name(). This allows applications that still use widget paths to use the new object names to get the correct styling. Mutter and webkit-gtk are examples here.
Diffstat (limited to 'gtk/gtkcssmatcher.c')
-rw-r--r--gtk/gtkcssmatcher.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index 36b6872593..71a4cba0a0 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -84,9 +84,23 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher *matcher,
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);
+ {
+ const char *path_name = gtk_widget_path_iter_get_object_name (siblings, matcher->path.sibling_index);
+
+ if (path_name == NULL)
+ return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), type);
+
+ return path_name == name;
+ }
else
- return g_type_is_a (gtk_widget_path_iter_get_object_type (matcher->path.path, matcher->path.index), type);
+ {
+ const char *path_name = gtk_widget_path_iter_get_object_name (matcher->path.path, matcher->path.index);
+
+ if (path_name == NULL)
+ return g_type_is_a (gtk_widget_path_iter_get_object_type (matcher->path.path, matcher->path.index), type);
+
+ return path_name == name;
+ }
}
static gboolean