Re: Are Out-of-Tree Widgets Second-Class Citizens?

On Fri, 2009-10-02 at 15:27 -0400, Paul Davis wrote:
> > Sure they do...  Cody said apps will have to use public APIs instead
> of
> > accessing struct members directly.  I just pointed out that some
> things
> > don't have accessor functions yet, which is a known issue, judging
> by
> > other replies in the thread.
> I'm not buying it. One of responses indicated that "GTK" could use
> struct members directly. Clearly, its not intended for apps to do
> this. The grey zone are  "out-of-tree widgets" ... are these GTK or
> apps? they are surely neither, and the two descriptions conflict here.
> hopefully either there is NO direct struct access, even for in-tree
> widgets, or some mechanism for out-of-tree-widgets to break the seal,
> so to speak. 

Widgets will use direct struct access only to their own private structs.
Applications and other widgets (either gtk widgets or otherwise) will
need to use public API.

For example, consider this:

struct _GtkWindow {
  GtkBin parent_object;
  gchar *GSEAL (title);

For the moment, anything in gtk+ can access window->title.  When 3.0
arrives that will not be possible because the struct will look like:

struct _GtkWindow {
  GtkBin parent_object;

And inside gtkwindow.c there already exists the following struct:

struct _GtkWindowPrivate

GSEAL'd members such as title will be moved into these private
structures.  Anything inside gtkwindow.c has direct access to this
struct, but anywhere else in GTK+ will obviously need to use
gtk_window_set_title()/gtk_window_get_title() since the public member is

I hope this helps clarify some things.

/ Cody

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