Advertisement
susilolabs

Demo Gtk.ApplicationWindow

Jun 26th, 2014
2,769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.71 KB | None | 0 0
  1. //valac -o demo-appwin --pkg gtk+-3.0 demo_appwin.vala
  2. using Gtk;
  3.  
  4. public class DemoApp: Gtk.Application
  5. {
  6.     private Builder builder;
  7.     private Window main_window;
  8.  
  9.     public DemoApp() {
  10.         Object(application_id: "com.susilolabs.demoapp", flags: ApplicationFlags.FLAGS_NONE);
  11.     }
  12.  
  13.     protected override void activate() {
  14.         try {
  15.             builder = new Builder();
  16.             builder.add_from_file("demo_appwin.glade");
  17.             this.main_window = builder.get_object("appwin") as Window;
  18.             this.main_window.application = this;
  19.             this.main_window.show_all();
  20.  
  21.         }catch(Error e) {
  22.             stderr.printf("%s\n", e.message);
  23.         }
  24.     }
  25.  
  26.     public static int main(string[] args) {
  27.         DemoApp app = new DemoApp();
  28.         return app.run(args);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement