Updated Spanish translation
[anjuta-git-plugin.git] / scripts / glade2schema.pl
blob16ce86e038d32d3d1ba42239b3e2209319a0b565
1 #!/usr/bin/perl
3 use XML::Parser;
5 %datatypes = (
6 "bool" => "bool",
7 "int" => "int",
8 "string" => "string",
9 "text" => "string",
10 "float" => "float",
11 "color" => "string",
12 "font" => "string",
13 "folder" => "string",
14 "file" => "string"
17 %boolean = (
18 0 => "FALSE",
19 1 => "TRUE"
22 $schema_path = "/schemas/apps/anjuta/preferences/";
23 $key_path ="/apps/anjuta/preferences/";
25 my $parser = new XML::Parser(Style => "Stream");
26 print "<gconfschemafile>\n";
27 print "\t<schemalist>\n";
29 $parser->parsefile($ARGV[0]);
31 print "\t</schemalist>\n";
32 print "</gconfschemafile>\n";
34 sub StartTag {
35 my $parser = shift;
36 my $key = shift;
37 if ($key =~ /widget/) {
38 my $k = $_{"id"};
39 if ($k =~ /(preferences_color|entry|font|spin|text|toggle|menu|folder|file):(.*):(.*):(\d):(.*)/) {
41 my $type = $2;
42 my $default = $3;
43 my $flags = $4;
44 my $propkey = $5;
47 if ($type =~ /bool/) {
48 $default = $boolean{$default};
53 print "\t\t<schema>\n";
54 print "\t\t\t<key>$schema_path$propkey</key>\n";
55 print "\t\t\t<applyto>$key_path$propkey</applyto>\n";
56 print "\t\t\t<owner>anjuta</owner>\n";
57 print "\t\t\t<type>$datatypes{$type}</type>\n";
58 print "\t\t\t<default>$default</default>\n";
60 # Hack to keep gconftool happy
61 print "\t\t\t<locale name=\"C\" />\n";
63 print "\t\t</schema>\n\n";
68 sub EndTag {}
70 sub Text {}