[gtk+] Add deprecation warnings for pseudo states



commit c998fae5ac68745660e6b984f66c175ff0468d30
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 24 18:08:20 2015 -0500

    Add deprecation warnings for pseudo states
    
    Emit a deprecation error in the cases where we have
    a CSS name for a custom pseudo class.

 gtk/gtkcssselector.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index e41dc0f..d5517e8 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1177,23 +1177,23 @@ parse_selector_pseudo_class (GtkCssParser   *parser,
     { "only-child",   0,                           POSITION_ONLY,     0, 0 },
     { "sorted",       0,                           POSITION_SORTED,   0, 0 },
     { "active",       GTK_STATE_FLAG_ACTIVE, },
-    { "prelight",     GTK_STATE_FLAG_PRELIGHT, },
     { "hover",        GTK_STATE_FLAG_PRELIGHT, },
+    { "prelight",     GTK_STATE_FLAG_PRELIGHT, },
     { "selected",     GTK_STATE_FLAG_SELECTED, },
-    { "insensitive",  GTK_STATE_FLAG_INSENSITIVE, },
     { "disabled",     GTK_STATE_FLAG_INSENSITIVE, },
-    { "inconsistent", GTK_STATE_FLAG_INCONSISTENT, },
+    { "insensitive",  GTK_STATE_FLAG_INSENSITIVE, },
     { "indeterminate",GTK_STATE_FLAG_INCONSISTENT, },
-    { "focused",      GTK_STATE_FLAG_FOCUSED, },
+    { "inconsistent", GTK_STATE_FLAG_INCONSISTENT, },
     { "focus",        GTK_STATE_FLAG_FOCUSED, },
+    { "focused",      GTK_STATE_FLAG_FOCUSED, },
     { "backdrop",     GTK_STATE_FLAG_BACKDROP, },
     { "dir(ltr)",     GTK_STATE_FLAG_DIR_LTR, },
     { "dir(rtl)",     GTK_STATE_FLAG_DIR_RTL, },
     { "link",         GTK_STATE_FLAG_LINK, },
     { "visited",      GTK_STATE_FLAG_VISITED, },
     { "checked",      GTK_STATE_FLAG_CHECKED, },
-    { "dnd",          GTK_STATE_FLAG_DROP_ACTIVE, },
-    { "drop(active)", GTK_STATE_FLAG_DROP_ACTIVE, }
+    { "drop(active)", GTK_STATE_FLAG_DROP_ACTIVE, },
+    { "dnd",          GTK_STATE_FLAG_DROP_ACTIVE, }
 
   };
   guint i;
@@ -1213,6 +1213,14 @@ parse_selector_pseudo_class (GtkCssParser   *parser,
                                                       : &GTK_CSS_SELECTOR_PSEUDOCLASS_STATE,
                                                selector);
               selector->state.state = pseudo_classes[i].state_flag;
+              if (pseudo_classes[i].state_flag == pseudo_classes[i - 1].state_flag)
+                {
+                  _gtk_css_parser_error_full (parser,
+                                              GTK_CSS_PROVIDER_ERROR_DEPRECATED,
+                                              "The :%s pseudo-class is deprecated. Use :%s instead.",
+                                              pseudo_classes[i].name,
+                                              pseudo_classes[i - 1].name);
+                }
             }
           else
             {


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