[Vala] Gtk Actions and proxy widgets



Hi, I've been playing around with vala this past weekend, and have a
question about Actions.

I created a little form in Glade, setup my toolbar and menubar using actions
etc. Then in my code I did "builder.connect_signals (this);". It did
actually connect my signals, but in one of the function callbacks for the
action, I was trying to show a FileChooserDialog by executing "int result =
form.run()" where form was a reference to the dialog. The form would show,
and I would click either accept or cancel, but the "if statement" I had
written right underneath the form.run() never got executed until the parent
window of the chooser dialog closed. Very odd, and I suspected this had
something to do with how my actions were connected by the magical
"builder.connect_signals()" method.

So, option 2, I decided to write my own "connect" stuff. In the constructor,
I wrote "Action acn = new Action("acnNew", "New", "New Collection",
Gtk.STOCK_NEW);". Now I want to connect that action to a proxy widget, one
of the buttons already in a toolbar, all designed previously in Glade. So I
get the toolbar button using "btn = builder.get_object("tbtnNew");", then
try to connect it to the action using "acn.connect_proxy(btn);". The code
compiles without errors or warnings, but running the app and clicking on the
toolbar button "tbtnNew" has no effect.

I'm just wondering if my understanding of how gtk works is correct, or if
I'm doing something wrong etc... I have used "acn.create_tool_item()" and
added that to the toolbar too, and that works, but that's code that I would
rather keep in the .glade file. Ideally, I'd like to design the form in
Glade, including all actions and their proxy widgets, setup everything there
like I had tried to do originally and then use the builder.connect_signals()
method...


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