add the 'engine="box"' to the theme format, and require it to be there so we can change that in the future

This commit is contained in:
Dana Jansens 2007-05-07 02:38:13 +00:00
parent 974391d345
commit 24c0d61847
11 changed files with 29 additions and 12 deletions

View file

@ -163,5 +163,6 @@
<xs:element name="window" type="obt:allwindows" minOccurs="0"/> <xs:element name="window" type="obt:allwindows" minOccurs="0"/>
</xs:all> </xs:all>
<xs:attribute name="version" type="xs:integer" use="required" fixed="1"/> <xs:attribute name="version" type="xs:integer" use="required" fixed="1"/>
<xs:attribute name="engine" type="xs:string" use="required" fixed="box"/>
</xs:complexType> </xs:complexType>
</xs:schema> </xs:schema>

View file

@ -108,20 +108,35 @@ gboolean parse_load_theme(const gchar *name, xmlDocPtr *doc, xmlNodePtr *root,
GSList *it; GSList *it;
gchar *path; gchar *path;
gboolean r = FALSE; gboolean r = FALSE;
gchar *eng;
/* backward compatibility.. */ /* backward compatibility.. */
path = g_build_filename(g_get_home_dir(), ".themes", name, path = g_build_filename(g_get_home_dir(), ".themes", name,
"openbox-3", "themerc.xml", NULL); "openbox-3", "themerc.xml", NULL);
if ((r = parse_load(path, "openbox_theme", doc, root))) if (parse_load(path, "openbox_theme", doc, root) &&
*retpath = g_path_get_dirname(path); parse_attr_string("engine", *root, &eng))
{
if (!strcmp(eng, "box")) {
*retpath = g_path_get_dirname(path);
r = TRUE;
}
g_free(eng);
}
g_free(path); g_free(path);
if (!r) { if (!r) {
for (it = xdg_data_dir_paths; !r && it; it = g_slist_next(it)) { for (it = xdg_data_dir_paths; !r && it; it = g_slist_next(it)) {
path = g_build_filename(it->data, "themes", name, "openbox-3", path = g_build_filename(it->data, "themes", name, "openbox-3",
"themerc.xml", NULL); "themerc.xml", NULL);
if ((r = parse_load(path, "openbox_theme", doc, root))) if (parse_load(path, "openbox_theme", doc, root) &&
*retpath = g_path_get_dirname(path); parse_attr_string("engine", *root, &eng))
{
if (!strcmp(eng, "box")) {
*retpath = g_path_get_dirname(path);
r = TRUE;
}
g_free(eng);
}
g_free(path); g_free(path);
} }
} }

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>4</handle> <handle>4</handle>
<padding x="1" y="1"/> <padding x="1" y="1"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>4</handle> <handle>4</handle>
<padding x="3" y="3"/> <padding x="3" y="3"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>3</handle> <handle>3</handle>
<padding x="2" y="2"/> <padding x="2" y="2"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>3</handle> <handle>3</handle>
<padding x="2" y="2"/> <padding x="2" y="2"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>0</handle> <handle>0</handle>
<padding x="1" y="1"/> <padding x="1" y="1"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>2</handle> <handle>2</handle>
<padding x="2" y="2"/> <padding x="2" y="2"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>3</handle> <handle>3</handle>
<padding x="1" y="1"/> <padding x="1" y="1"/>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openbox_theme version="1" xmlns="http://openbox.org/themerc"> <openbox_theme version="1" engine="box" xmlns="http://openbox.org/themerc">
<dimensions> <dimensions>
<handle>0</handle> <handle>0</handle>
<padding x="1" y="1"/> <padding x="1" y="1"/>

View file

@ -314,6 +314,7 @@ int main(int argc, char **argv)
doc = xmlNewDoc((const xmlChar*) "1.0"); doc = xmlNewDoc((const xmlChar*) "1.0");
xmlDocSetRootElement xmlDocSetRootElement
(doc,(root = xmlNewNode(NULL, (const xmlChar*)"openbox_theme"))); (doc,(root = xmlNewNode(NULL, (const xmlChar*)"openbox_theme")));
xmlSetProp(root, (const xmlChar*)"engine", (const xmlChar*)"box");
xmlSetProp(root, (const xmlChar*)"version", (const xmlChar*)"1"); xmlSetProp(root, (const xmlChar*)"version", (const xmlChar*)"1");
xmlSetProp(root, (const xmlChar*)"xmlns", xmlSetProp(root, (const xmlChar*)"xmlns",
(const xmlChar*)"http://openbox.org/themerc"); (const xmlChar*)"http://openbox.org/themerc");