[Vala] How to use Gtk.Builder in our custum widgets?
- From: Sepehr Aryani <sepehr aryani gmail com>
- To: Vala List <vala-list gnome org>
- Subject: [Vala] How to use Gtk.Builder in our custum widgets?
- Date: Sat, 2 Jul 2011 13:57:58 +0000
I've created a UI in glade and I want to use it inside my vala app. I need to derive my own Gtk.Window and
customize it but the problem is that I don't know how to relate UI to my custom Window class.
class MyWindow : Gtk.Window{
public Window(){
}
}
public static int main(string[] args){){
Gtk.init(ref args);
try{
var builder = new Gtk.Builder();
builder.add_from_file("../ui/main.glade");
builder.connect_signals(null);
var window = (MyWindow) builder.get_object("gld_top_window"); // !!!!!! does not work correctly
window.destroy.connect(Gtk.main_quit);
window.show_all();
Gtk.main();
}catch(Error e){
stderr.printf("cannot load the ui: %s\n", e.message);
return 1;
}
}
does not work well for me. Besides I need to pass Gtk.builder reference to MyWindow to be able to handle the
ui inside my custom window class. In C++ we could do this using get_widget_derived. I didn't see the same
mechanism in Vala's gtk library. would someone please help me?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]