summaryrefslogtreecommitdiff
blob: bf4649e75ed8331ec361e0fbaa89ceb402f5af2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Patch author: Timo Kluck <tkluck@infty.nl>  Wed, 21 Sep 2011 17:51:28 +0200

Patch to silently ignore padding and shadow tags in Ubuntu metacity themes.

https://bugs.launchpad.net/bugs/800315
https://bugs.gentoo.org/show_bug.cgi?id=396673

diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c
index 9063541..63a881f 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -90,7 +90,9 @@ typedef enum
   STATE_WINDOW,
   /* things we don't use any more but we can still parse: */
   STATE_MENU_ICON,
-  STATE_FALLBACK
+  STATE_FALLBACK,
+  /* an ubuntu specific ignore-this-element state */
+  UBUNTU_STATE_IGNORE  
 } ParseState;
 
 typedef struct
@@ -1306,7 +1308,19 @@ parse_toplevel_element (GMarkupParseContext  *context,
        */
       push_state (info, STATE_FALLBACK);
     }
-   else
+  else if (ELEMENT_IS ("shadow"))
+    {
+       /* ubuntu specific, workaround for light-themes: silently ignore shadow tag.
+        */
+      push_state (info, UBUNTU_STATE_IGNORE);
+    }
+  else if (ELEMENT_IS ("padding"))
+    {
+       /* ubuntu specific, workaround for light-themes: silently ignore padding tag.
+        */
+      push_state (info, UBUNTU_STATE_IGNORE);
+    }
+  else
     {
       set_error (error, context,
                  G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
@@ -3027,6 +3041,18 @@ parse_style_element (GMarkupParseContext  *context,
       
       push_state (info, STATE_BUTTON);
     }
+  else if (ELEMENT_IS ("shadow"))
+    {
+       /* ubuntu specific, workaround for light-themes: silently ignore shadow tag.
+        */
+      push_state (info, UBUNTU_STATE_IGNORE);
+    }
+  else if (ELEMENT_IS ("padding"))
+    {
+       /* ubuntu specific, workaround for light-themes: silently ignore padding tag.
+        */
+      push_state (info, UBUNTU_STATE_IGNORE);
+    }
   else
     {
       set_error (error, context,
@@ -3671,6 +3697,8 @@ start_element_handler (GMarkupParseContext *context,
                  _("Element <%s> is not allowed inside a <%s> element"),
                  element_name, "fallback");
       break;
+    case UBUNTU_STATE_IGNORE:
+      break;
     }
 }
 
@@ -3960,6 +3988,9 @@ end_element_handler (GMarkupParseContext *context,
       pop_state (info);
       g_assert (peek_state (info) == STATE_THEME);
       break;
+    case UBUNTU_STATE_IGNORE:
+      pop_state (info);
+      break;
     }
 
   pop_required_version (info);
@@ -4165,6 +4196,9 @@ text_handler (GMarkupParseContext *context,
     case STATE_FALLBACK:
       NO_TEXT ("fallback");
       break;
+    case UBUNTU_STATE_IGNORE:
+      NO_TEXT ("ignored_element");
+      break;
     }
 }