- if (!g_ascii_strcasecmp(name, "number")) {
- if (value->type != TOKEN_INTEGER)
- yyerror("invalid value");
- else {
- config_desktops_num = value->data.integer;
- }
- } else if (!g_ascii_strcasecmp(name, "names")) {
- if (value->type == TOKEN_LIST) {
- for (it = value->data.list; it; it = it->next)
- if (((ParseToken*)it->data)->type != TOKEN_STRING) break;
- if (it == NULL) {
- /* build a string list */
- g_free(config_desktops_names);
- for (it = value->data.list; it; it = it->next)
- config_desktops_names =
- g_slist_append(config_desktops_names,
- g_strdup
- (((ParseToken*)it->data)->data.string));
- } else {
- yyerror("invalid string in names list");
- }
- } else {
- yyerror("syntax error (expected list of strings)");
- }
- } else
- yyerror("invalid option");
- parse_free_token(value);
+static void parse_dock(xmlDocPtr doc, xmlNodePtr node, void *d)
+{
+ xmlNodePtr n;
+
+ node = node->xmlChildrenNode;
+
+ if ((n = parse_find_node("position", node))) {
+ if (parse_contains("TopLeft", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_NORTHWEST;
+ else if (parse_contains("Top", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_NORTH;
+ else if (parse_contains("TopRight", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_NORTHEAST;
+ else if (parse_contains("Right", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_EAST;
+ else if (parse_contains("BottomRight", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTHEAST;
+ else if (parse_contains("Bottom", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTH;
+ else if (parse_contains("BottomLeft", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTHWEST;
+ else if (parse_contains("Left", doc, n))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_WEST;
+ else if (parse_contains("Floating", doc, n))
+ config_dock_floating = TRUE;
+ }
+ if (config_dock_floating) {
+ if ((n = parse_find_node("floatingX", node)))
+ config_dock_x = parse_int(doc, n);
+ if ((n = parse_find_node("floatingY", node)))
+ config_dock_y = parse_int(doc, n);
+ }
+ if ((n = parse_find_node("stacking", node))) {
+ if (parse_contains("top", doc, n))
+ config_dock_layer = OB_STACKING_LAYER_TOP;
+ else if (parse_contains("normal", doc, n))
+ config_dock_layer = OB_STACKING_LAYER_NORMAL;
+ else if (parse_contains("bottom", doc, n))
+ config_dock_layer = OB_STACKING_LAYER_BELOW;
+ }
+ if ((n = parse_find_node("direction", node))) {
+ if (parse_contains("horizontal", doc, n))
+ config_dock_orient = OB_ORIENTATION_HORZ;
+ else if (parse_contains("vertical", doc, n))
+ config_dock_orient = OB_ORIENTATION_VERT;
+ }
+ if ((n = parse_find_node("autoHide", node)))
+ config_dock_hide = parse_bool(doc, n);
+ if ((n = parse_find_node("hideTimeout", node)))
+ config_dock_hide_timeout = parse_int(doc, n);