Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

how can I use views from .ui file many times?

I load them this way

var view_orig = builder.get_object("items_view") as Gtk.TreeView;
var store_orig = builder.get_object("items_store") as Gtk.TreeStore;

but I need create 10 copies of view_orig.

I write it in Vala.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You usually wouldn't use a ui file as a template (in the sense of duplication). The only method I know is to traverse the Gtk object tree and duplicate each object you come across. Depending on how complex your tree is you might be able to get away with just looking through and duplicating the classes without any data.

I know of no convenience functions for helping you do this. And a gnome developer would probably tell you to create a factory class to build the ui or load the ui file multiple times (I believe the builder creates a new tree on each load)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.