]> Dogcows Code - chaz/openbox/blobdiff - plugins/resistance.c
ECKS EM ELL
[chaz/openbox] / plugins / resistance.c
index bafd362c0ec8c62a5cf77a204898d0ff6874b1de..ee6f6e1e6c5794ce5b9d1f1d555dcbae17ed7a65 100644 (file)
@@ -9,23 +9,14 @@
 static int resistance;
 static gboolean resist_windows;
 
-static void parse_assign(char *name, ParseToken *value)
+static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
 {
-    if (!g_ascii_strcasecmp(name, "strength")) {
-        if (value->type != TOKEN_INTEGER)
-            yyerror("invalid value");
-        else {
-            if (value->data.integer >= 0)
-                resistance = value->data.integer;
-        }
-    } else if  (!g_ascii_strcasecmp(name, "windows")) {
-        if (value->type != TOKEN_BOOL)
-            yyerror("invalid value");
-        else
-            resist_windows = value->data.bool;
-    } else
-        yyerror("invalid option");
-    parse_free_token(value);
+    xmlNodePtr n;
+
+    if ((n = parse_find_node("strength", node)))
+        resistance = parse_int(doc, n);
+    if ((n = parse_find_node("windows", node)))
+        resist_windows = parse_bool(doc, n);
 }
 
 void plugin_setup_config()
@@ -33,7 +24,7 @@ void plugin_setup_config()
     resistance = 10;
     resist_windows = TRUE;
 
-    parse_reg_section("resistance", NULL, parse_assign);
+    parse_register("resistance", parse_xml, NULL);
 }
 
 static void resist_move(Client *c, int *x, int *y)
This page took 0.020597 seconds and 4 git commands to generate.