hydra wrote:
I was wondering how do you write GTK+ code.
How do you design your applications?
Let's take the example that you have 3 windows for 1 application.
A main window and 2 other windows for properties and preferencies.
Then how do you communicate with each other? How do you take the information from all the entry points from these windows.
I am interested how to store the data and to pass it to all the other windows.
Preference and property dialogs, according to the GNOME HIG, should be non-modal. This means that you should perform setup and then use the "response" signal from the dialog to know when to interact. If I want to apply changes when a setting is changed immediately, I usually just connect signals to the dialog's widgets to watch their values.
You can also have all three of these windows in a single Glade file. If you load the Glade file, you can create it as a static variable so that is only loaded once. Then, you can just use gtk_widget_show_all() and gtk_widget_hide_all() to hide/show the dialog and never have to recreate it. Remember that if you use gtk_dialog_run(), it will be forced to be modal.
The only problem with passing your main GObject to the dialog is that you have to include its definition in the dialog's sources. This is a little backwards as you would usually include the dialog's header in the sources. (Or possibly you have a circular include structure? If so, don't do that ... :))
If you use Glade, then the dialogs will not take that much code to setup. Then, you can just connect signals to all of the widgets and the dialog to handle everything.