Re: [Vala] How to use Gtk.Builder in our custum widgets?
- From: Daniel Svensson <dsvensson gmail com>
- To: Sepehr Aryani <sepehr aryani gmail com>
- Cc: Vala List <vala-list gnome org>
- Subject: Re: [Vala] How to use Gtk.Builder in our custum widgets?
- Date: Sun, 3 Jul 2011 11:49:46 +0200
On Sat, Jul 2, 2011 at 3:57 PM, Sepehr Aryani <sepehr aryani gmail com> wrote:
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(){
}
}
var window = (MyWindow) builder.get_object("gld_top_window"); // !!!!!! does not work correctly
window.destroy.connect(Gtk.main_quit);
window.show_all();
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?
Do you have MyWindow in your .ui file?
I do this quite extensively in my application, here is one example:
http://git.xmms.se/xmms2/abraca/tree/src/components/server/server_browser.vala#n42
and the .ui-file:
http://git.xmms.se/xmms2/abraca/tree/data/ui/server_browser.xml#n18
it was a while since I wrote that and I'm not sure if you need to
explicitly add the Buildable interface or if that comes with the
widget you inherit.. but anyway.. something like that ought to get you
started.
--
Daniel Svensson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]