GNOME Bugzilla – Bug 64432
GtkDialog should have accessors
Last modified: 2009-07-11 23:32:12 UTC
I think there should be accessors for the vbox and action_area members of GtkDialog. Gtk seems to be moving away from accessing widget fields directly and it makes LB authors lives easier. Two names that spring to mind are gtk_dialog_get_contents and gtk_dialog_get_action_area.
we should really do this, especially in preparation for the 3.0 'clean-up-public-members-of-structs-from-hell' effort.
Created attachment 85656 [details] [review] here we go this patch adds: GtkWidget *gtk_dialog_get_vbox (GtkDialog *dialog); GtkWidget *gtk_dialog_get_action_area (GtkDialog *dialog); to the GtkDialog API. is there a way to deprecate single structure members? does gcc deprecated attribute work for them as well as for functions?
I'm not sure we gain much by adding these accessors in 2.x, and deprecating the fields will be a disaster in terms of forcing everybody who used these fields to turn off GTK_DISABLE_DEPRECATED. So I am not in favor of that, at least. For the record, one way of deprecating struct fields is to conditionally rename them #ifdef GTK_DISABLE_DEPRECATED GtkWidget *private_action_area; #else GtkWidget *action_area; #endif Of course, the GTK+ code needs corresponding changes then, too.
even without marking the struct members as deprecated we could formally make them deprecated, in this case by hiding them in the gtk-doc and adding a big warning in the class description. the one thing we gain in 2.x would be removing the special cased code from the language bindings, even though some backward compatibility methods should be kept in place for languages missing a compile-time API/ABI compatibility.
Seems to me that adding accessors like these as early as possible is a very good idea if there is going to be a smooth transition to 3.0, see http://mail.gnome.org/archives/gtk-devel-list/2008-June/msg00014.html. If gtk is ever going to be GSEAL:ed, then there should be accessors for interesting attributes.
The GSEAL branch is in the works, to be merged with upstream soon. The changes to GtkDialog in that branch include an accessor for action_area and a GtkContainer interface so that widgets can be packed into the dialog. If you're interested, have a look at the repository provided in the mailing list thread you mentioned.
Closing. The new functions gtk_dialog_get_action_area and gtk_dialog_get_content_area fixes the problem.