[gtk/wip/matthiasc/css-values: 28/31] css: Don't return nonsense when comparing values



commit f2558bc632b069f9368ed46818a8364ab6e3bf7d
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 13 20:12:18 2020 -0500

    css: Don't return nonsense when comparing values
    
    Comparing icon theme values for equality is not
    very important, but an equal() implementation that
    always returns FALSE is nonsense.

 gtk/gtkcssiconthemevalue.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcssiconthemevalue.c b/gtk/gtkcssiconthemevalue.c
index 50d021f113..97284fd162 100644
--- a/gtk/gtkcssiconthemevalue.c
+++ b/gtk/gtkcssiconthemevalue.c
@@ -91,7 +91,20 @@ static gboolean
 gtk_css_value_icon_theme_equal (const GtkCssValue *value1,
                                 const GtkCssValue *value2)
 {
-  return FALSE;
+  GtkIconTheme *theme1 = value1->icontheme;
+  GtkIconTheme *theme2 = value2->icontheme;
+  GtkIconTheme *default_theme;
+
+  if (theme1 == theme2)
+    return TRUE;
+
+  if (theme1 && theme2)
+    return FALSE;
+
+  default_theme = gtk_icon_theme_get_default ();
+
+  return theme1 == default_theme ||
+         theme2 == default_theme;
 }
 
 static GtkCssValue *


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