Vlad Grecescu <b100d...@...> writes: > On Mon, May 4, 2009 at 4:40 PM, Adi Roiban <[email protected]> wrote: > > I'm trying to extend the Gtk.CheckMenuItem and unfortunately there are > > no set_label or set_mnemonic methods. > > I was thinking to call the base constructor, but instead of > > gtk_check_menu_item_new_with_label, vala generates > > gtk_check_menu_item_construct_with_label > > Do you know how can I call a base constructor?
You don't want to call gtk_check_menu_item_new_with_label, because it's not a constructor! It's an allocator, which is not the thing you want. GObject is limited to initializing base objects is by setting their construct-time properties. Unfortunately the check_menu_item does not seem to have one for label or mnemonic, so you'll have to manually add(new Gtk.Label(...)) in your constructor. Other thing is, that you should only ever subclass widgets when you want to modify their look & feel, not to implement functionality. And if you are to override the look & feel, you probably don't want to add a plain label, no? So you should not need those base constructors in your case anyway. Functionality is better implemented by connecting handlers to the signals emited by the widget, where the handlers are implemented either in a class representing the document or dialog. You can also take advantage of the GtkAction (GtkToggleAction in your case) class, that can connect to or serve as factory for menu items, buttons and toolbar buttons and inherit that to provide your common functionality. > I ran into the same issue, and so I filed a > bug:http://bugzilla.gnome.org/show_bug.cgi?id=581362 It's the same case, but there the change is really simple -- just set the properties that gtk_vbox_new sets and you are done. _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
