Changes between Version 84 and Version 85 of Developing your own applications
- Timestamp:
- 01/18/11 22:14:19 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Developing your own applications
v84 v85 124 124 Once you have successfully completed the steps above, you may wish to know how to add a Graphical User Interface (GUI). The next steps will show how to adapt the Hello World program to use the Elementary widget set. 125 125 126 === 1. Creating a source folder === 127 {{{ 128 $ cd /path/to/shr/build 129 $ mkdir myfirstgui 130 $ cd myfirstgui 131 }}} 132 133 === 2. Writing a Hello World GUI in Vala and Elementary === 134 Create and enter a sub folder for the source: 135 {{{ 136 $ mkdir src 137 $ cd src 138 }}} 139 Create a file called '''myfirstgui.vala''' and insert the following text: 140 {{{ 141 using Elm; 126 142 127 143 private void win_del() 144 { 145 Elm.exit(); 146 } 128 147 148 class Demo.HelloWorldGui : GLib.Object 149 { 150 public static int main(string[] args) 151 { 152 Elm.init(args); 153 154 Win win = new Win(null, "hello", WinType.BASIC); 155 win.title_set("Hello"); 156 win.smart_callback_add("delete-request", win_del); 157 158 Bg bg = new Bg(win); 159 bg.size_hint_weight_set(1.0, 1.0); 160 win.resize_object_add(bg); 161 bg.show(); 162 163 Label lb = new Label(win); 164 lb.label_set("Hello World!"); 165 lb.size_hint_weight_set(1.0, 1.0); 166 win.resize_object_add(lb); 167 lb.show(); 168 169 win.show(); 170 171 Elm.run(); 172 Elm.shutdown(); 173 174 return 0; 175 } 176 } 177 }}} 178 179 More information about Vala can be found here: [http://live.gnome.org/Vala/Tutorial] 180
