glade-rnc

RELAX NG schemas for Glade files
git clone https://logand.com/git/glade-rnc.git/
Log | Files | Refs | README

commit a42be5dcefbea74e9b9447356fd7085c74fe0ec3
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sat, 18 Sep 2010 00:40:20 +0200

Initial commit

Diffstat:
AREADME | 15+++++++++++++++
Aglade.rnc | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Agtkbuilder.rnc | 38++++++++++++++++++++++++++++++++++++++
Agtkinterface.rnc | 40++++++++++++++++++++++++++++++++++++++++
Aschemas.xml | 10++++++++++
5 files changed, 154 insertions(+), 0 deletions(-)

diff --git a/README b/README @@ -0,0 +1,15 @@ +glade-rnc -- RELAX NG schemas for glade files. +Written by Tomas Hlavaty <tom at logand.com> + +Set-up Emacs +------------ + +Edit your .emacs file to recognise glade files and use nxml-mode: + +(require 'nxml-mode) +(fset 'xml-mode 'nxml-mode) +(add-to-list 'auto-mode-alist '("\\.glade$" . xml-mode)) + +"M-x customize-variable" rng-schema-locating-files and add the file +glade-rnc/schema.xml (with full absolute path) to automatically +validate glade files using correct schemas. diff --git a/glade.rnc b/glade.rnc @@ -0,0 +1,51 @@ +# RELAX NG schema for the deprecated glade file format. +# Written by Tomas Hlavaty <tom at logand.com> +# TODO remove unused attributes and verify completenes +start = element glade-interface { + attribute domain { text }?, + element requires { + attribute lib { text }, + attribute version { text }? + }*, + widget* +} +widget = element widget { + attribute id { text }, + attribute class { text }, + attribute type-func { text }?, + attribute constructor { text }?, + property*, + element signal { + attribute name { text }, + attribute handler { text }, + attribute after { text }?, + attribute swapped { text }?, + attribute object { text }?, + attribute last_modification_time { text }? + }*, + element accelerator { + attribute key { text }, + attribute modifiers { text }, + attribute signal { text }? + }*, + element accessibility { + element atkproperty { + attribute name { text }, + attribute translatable { text }?, + text + }+ + }?, + element child { + attribute internal-child { text }?, + (element placeholder { empty } + | (widget, + element packing { property* }?)) + }* +} +property = element property { + attribute name { text }, + attribute translatable { text }?, + attribute comments { text }?, + attribute context { text }?, + text +} diff --git a/gtkbuilder.rnc b/gtkbuilder.rnc @@ -0,0 +1,38 @@ +# RELAX NG schema for the newest glade file format. +# Written by Tomas Hlavaty <tom at logand.com> +# Based on DTD from +# http://library.gnome.org/devel/gtk/unstable/GtkBuilder.html#BUILDER-UI +start = element interface { + attribute domain { text }?, + element requires { + attribute lib { text }, + attribute version { text } + }?, + object? +} +object = element object { + attribute id { text }, + attribute class { text }, + attribute type-func { text }?, + attribute constructor { text }?, + element property { + attribute name { text }, + attribute translatable { text }?, + attribute comments { text }?, + attribute context { text }?, + text + }*, + element signal { + attribute name { text }, + attribute handler { text }, + attribute after { text }?, + attribute swapped { text }?, + attribute object { text }?, + attribute last_modification_time { text }? + }*, + element child { + attribute type { text }?, + attribute internal-child { text }?, + object + }? +} diff --git a/gtkinterface.rnc b/gtkinterface.rnc @@ -0,0 +1,40 @@ +# RELAX NG schema for the ancient glade file format. +# Written by Tomas Hlavaty <tom at logand.com> +# TODO remove unused attributes and verify completenes +start = element GTK-Interface { + attribute domain { text }?, + element project { + element name { text }, + element program_name { text }, + element directory { text }, + element source_directory { text }, + element pixmaps_directory { text }, + element language { text }, + element gnome_support { text }, + element gettext_support { text }, + element output_main_file { text }, + element output_support_files { text }, + element output_build_files { text } + }, + widget* +} +widget = element widget { + element class { text }, + element name { text }, + element can_focus { text }?, + element signal { + element name { text }, + element handler { text }, + element last_modification_time { text } + }*, + element title { text }?, + element type { text }?, + element position { text }?, + element modal { text }?, + element allow_shrink { text }?, + element allow_grow { text }?, + element auto_shrink { text }?, + element label { text }?, + element relief { text }?, + widget* +} diff --git a/schemas.xml b/schemas.xml @@ -0,0 +1,10 @@ +<!-- Schema detection rules --> +<!-- Written by Tomas Hlavaty <tom at logand.com> --> +<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"> + <documentElement localName="glade-interface" typeId="Glade"/> + <documentElement localName="interface" typeId="GtkBuilder"/> + <documentElement localName="GTK-Interface" typeId="GtkInterface"/> + <typeId id="Glade" uri="glade.rnc"/> + <typeId id="GtkBuilder" uri="gtkbuilder.rnc"/> + <typeId id="GtkInterface" uri="gtkinterface.rnc"/> +</locatingRules>