[Vala] gtk-examples



Hello,
Does anybody work on gtk-examples port to vala ?
If not,and you are interested in that, I can spare
hour or two.
I have couple of questions.

Is the code below "the Vala way"? 
Particularly I have doubts regarding var keyword.
 - when and whether to use it. 
 - will it be code-completion friendly
 - is it just a shortcut to enable typing var instead
of  Namespace.Class or some day you will encapsulate
GValue into some Variant type, behind the var keyword
?  



using GLib;
using Gtk;

namespace GtkExamples {
        class ArrowWindow : Window {
                construct {
                        title = "Arrow Buttons";
                        set_border_width(10);                   
                        create_widgets ();
                }

                public static ref Button create_arrow_button(
ArrowType  arrow_type, ShadowType shadow_type )  {
                        Button button = new Button();
                        Arrow arrow = new Arrow(arrow_type, shadow_type);
                        button.add(arrow);
                        return button;
                }
                public void create_widgets () {
                        destroy += Gtk.main_quit;

                        var box = new HBox(false, 0);                   
                        box.set_border_width(2);
                        add(box);

                        box.pack_start(create_arrow_button ( ArrowType.UP,
ShadowType.IN ) ,   false, false, 3);
                        box.pack_start(create_arrow_button (
ArrowType.DOWN, ShadowType.OUT ) ,   false, false, 3);
                        box.pack_start(create_arrow_button (
ArrowType.LEFT, ShadowType.ETCHED_IN ) ,   false,
false, 3);
                        box.pack_start(create_arrow_button (
ArrowType.RIGHT, ShadowType.ETCHED_OUT ) ,   false,
false, 3);
                        show_all();
                }               
                static int main (string[] args) {
                        Gtk.init (out args);
                        var arrwin = new GtkExamples.ArrowWindow();
                        Gtk.main();
                }                       
        }
}





 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]