X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=common%2Fmakegdesc;h=cfcb6f19ee54415042b02765423e7763806be9b9;hb=473597657df72ce78026ab1fe487219fa349e8d2;hp=12c1cdaf8e3359f6d9c7be46674954208346b8e4;hpb=e947d4e304d214302d38bfa2c99729190197335c;p=doldaconnect.git diff --git a/common/makegdesc b/common/makegdesc index 12c1cda..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 @@ -185,9 +190,6 @@ sub printwidgets $widget->{"noshow"} = 1; } elsif($widget->{"type"} =~ /^[hv]paned$/) { print "${p}stack[$sl] = gtk_" . $widget->{"type"} . "_new();\n"; - if(defined($widget->{"pos"})) { - print "${p}gtk_notebook_set_tab_pos(GTK_NOTEBOOK(stack[$sl]), GTK_POS_" . $widget->{"pos"} . ")\n"; - } $widget->{"cur"} = 1; $pf = sub { @@ -200,6 +202,9 @@ sub printwidgets } } elsif($widget->{"type"} eq "notebook") { print "${p}stack[$sl] = gtk_notebook_new();\n"; + if(defined($widget->{"pos"})) { + print "${p}gtk_notebook_set_tab_pos(GTK_NOTEBOOK(stack[$sl]), GTK_POS_" . $widget->{"pos"} . ");\n"; + } $pf = sub { my($widget, $p, $sl) = @_; @@ -400,7 +405,7 @@ sub printwidgets $cb = $widget->{$attr}; $data = "NULL"; } - print "${p}g_signal_connect(G_OBJECT(stack[$sl]), \"$1\", G_CALLBACK($cb), (gpointer)$data);\n"; + print "${p}g_signal_connect(G_OBJECT(stack[$sl]), \"$sig\", G_CALLBACK($cb), (gpointer)$data);\n"; } } if($widget->{"subwidgets"}) @@ -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";