[gtk+] cssmatcher: Actually match names for widget paths



commit 517cea36ed31a2326bc453701ef17e98b0a8ccca
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 27 03:11:21 2015 +0100

    cssmatcher: Actually match names for widget paths
    
    The type is always 0 when we use names. So this would always return
    FALSE. Oops.

 gtk/gtkcssmatcher.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index 71a4cba..8dd26d5 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -79,16 +79,17 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher     *matcher,
 {
   const GtkWidgetPath *siblings;
 
-  if (type == 0)
-    return FALSE;
-
   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))
     {
       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);
+        {
+          if (type == 0)
+            return FALSE;
+          return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), 
type);
+        }
 
       return path_name == name;
     }
@@ -97,7 +98,11 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher     *matcher,
       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);
+        {
+          if (type == 0)
+            return FALSE;
+          return g_type_is_a (gtk_widget_path_iter_get_object_type (matcher->path.path, 
matcher->path.index), type);
+        }
 
       return path_name == name;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]