-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ben Johnson <ben@xxxxxxxxx> writes: > I made a class that defines several _new() functions, which take various > parameters. I now want to subclass from this and keep my various _new() > functions with more or less the same parameters, and I want the behavior > to stay the same too. I don't see anything in the documentation about > how to do it though. anyone know? What about a factory function which allows one to choose the specific derived type. For example, GtkGroupedToggle * gtk_grouped_toggle_new_from_widget (GType group_toggle_type, GtkGroupedToggle *group) GtkGroupedToggle *new_toggle = NULL; g_return_val_if_fail(g_type_is_a(group_toggle_type, GTK_TYPE_GROUPED_TOGGLE) == TRUE), NULL); new_toggle = g_object_new (type, NULL); if( new_toggle ) new_toggle = gtk_grouped_toggle_add_to_list (new_toggle, group); return GTK_WIDGET(new_toggle); } You now don't need any _new() functions for derived types. Also, isn't it bad practice to have arguments to a _new() function which are not construction parameters? Wouldn't it be better to add to group manually, or have g_object_new in a method of the container so it can't exist independently? Regards, Roger - -- Roger Leigh Printing on GNU/Linux? http://gimp-print.sourceforge.net/ Debian GNU/Linux http://www.debian.org/ GPG Public Key: 0x25BFB848. Please sign and encrypt your mail. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iD8DBQFCF9AAVcFcaSW/uEgRAvQjAKCL5WkiQLE5tqhPXVUpG28YVOlxAwCgonah YSQxaJkwWhKnquIoDs/DO+M= =gkQl -----END PGP SIGNATURE----- _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list