X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=common%2Fmakegdesc;h=cfcb6f19ee54415042b02765423e7763806be9b9;hb=473597657df72ce78026ab1fe487219fa349e8d2;hp=0eaf7c7c24d26f514dd19b9f6c707b8f3f4ea924;hpb=34f4de8b3484c64370bb599712302af66cb776df;p=doldaconnect.git diff --git a/common/makegdesc b/common/makegdesc index 0eaf7c7..cfcb6f1 100755 --- a/common/makegdesc +++ b/common/makegdesc @@ -1,5 +1,10 @@ #!/usr/bin/perl +use Getopt::Long; +use IO::File; + +GetOptions(\%args, "h=s") || exit 1; + $tempvar = 0; sub printwidgets @@ -423,6 +428,20 @@ sub printwidgets } } +sub printheader +{ + my($widget, $handle); + $handle = $_[1]; + foreach $widget (@{$_[0]}) + { + if($widget->{"var"}) + { + $handle->print("extern GtkWidget *" . $options{"prefix"} . $widget->{"name"} .";\n"); + } + printheader($widget->{"subwidgets"}, $handle) if($widget->{"subwidgets"}); + } +} + sub printvars { my($widget); @@ -488,6 +507,14 @@ while(<>) } } +if($args{"h"}) +{ + $hfile = IO::File->new($args{"h"}, "w") || die; + $hfile->print("GtkWidget *create_" . $options{"prefix"} . "wnd(void);\n"); + printheader $rootwidgets, $hfile; + $hfile->close(); +} + printvars $rootwidgets; print "\n"; print "GtkWidget *create_" . $options{"prefix"} . "wnd(void)\n";