X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=common%2Fmakegdesc;h=32271fb191aa2b4c7208a5fc5700e72eb2199ffc;hb=4dda7bfaad18c2d4bf23d7b85641c34a632c3ae6;hp=0eaf7c7c24d26f514dd19b9f6c707b8f3f4ea924;hpb=9ac4fb2aa0a4f7a9a3c87aceb742a356523fc805;p=doldaconnect.git diff --git a/common/makegdesc b/common/makegdesc index 0eaf7c7..32271fb 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,13 @@ while(<>) } } +if($args{"h"}) +{ + $hfile = IO::File->new($args{"h"}, "w") || die; + printheader $rootwidgets, $hfile; + $hfile->close(); +} + printvars $rootwidgets; print "\n"; print "GtkWidget *create_" . $options{"prefix"} . "wnd(void)\n";