Re: Program Structure

typedef struct {

        GtkWidget *toplevel;    /* The toplevel GtkWindow */
        GtkWidget *department_ctree;
        GtkWidget *inventory_clist;
        GtkWidget *close_button;

        GtkCTreeNode *selected_department_item;
        int selected_inventory_item;

} my_inventory_struct;

This `window' as a whole, may contain several GTK+ widgets, more than
what's listed in the struct, but they are not important and as such not

I was under the impression that this destroys the widget OOP concept.
I was not wanting to make a global variable of any sort, even a structure.
I have gone ahead and passed structures or pointers by callback to each
part in my program:

/* I have to put a widget I will modify */
menu_selection_ callback (ctree_ptr)

/* I have to create a structure to pass more  args */
file_selection_ok_button_callback(struct(ctree_ptr, selection_dialog_ptr))

(Note: this is not actual code)

This passing of pointers is not too bad, but creating structures just to pass

information seems a little tedious.  Can the callbacks employ more than one
generic pointer arg?

I guess I could make one big structure as you said and pass it through  the
That way I can reduce confusion as to what I am passsing and keep the data
being global.  It will have to be static though.

If from what yer implying that you have a ton of important widgets, you

Not really, I just did not understand how to access widgets after I create my

main window.

Am I making this thing to hard?  Should I just make a bunch of globals?
Are globals really that bad?

Thanks for your reply,

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