| Previous | Next |
| Adding Subsequent Windows | |
|---|---|
The Gtemp application uses the status bar for error messages, so there is no need for popup dialog or error windows. However, it does have an 'about' window, and we'll add this next. We could construct this window from the gtk+ basic widgets, but since we've created a glade application, we'll use the glade 'about' widget instead. In the palette window click on the gnome button to go to the gnome widget page. Select the 'gnome about dialog' widget, which is second from the left on the first row. This will create one of the familiar 'about' windows. In the properties window rename it to gtemp_about. There's no icon or logo for gtemp, so leave those blank. Add what you wish for the copyright and authors windows. Just remember the original gtemp was written by Rikke D. Giles as a tutorial aid. And the original copyright is the GNU copyleft. When you finish you should have a window which looks like that to the right. |
![]() |
| Adding the Signals and Callbacks | |
![]() |
The tutorial author tends to add all the signal handlers at once, usually while coding the backend. There are few signals for Gtemp, so we'll add them now. Close the about dialog by clicking on the x in the upper right corner of the window. You'll notice that the about dialog has been added to the widget list in the main glade window. In the gtemp application window click on the quit button. This'll bring up its properties in the properties window. Click on the signals tab, to get to the signals page. Next to the signal entry is a button marked ..., click on this to bring up a list of signals for that widget. These signals will vary with widget type, although all widgets have some basic signals in common, as they are all subclasses of GtkWidget and GtkContainer, usually. For the quit_button select 'clicked' under the GtkButton signals. Click ok, and the popup list of signals will disappear. You'll see that the signal and handler have been set in the proper entry fields. Click add, and the signal handler will be moved into the list of signal handlers. And there you go, adding a signal is as simple as that. The menu editor added signals automatically, so we don't have to do anything with the main menus in gtemp. But we do need to catch the activate signals when either entry field is used. Highlight the fahr_entry widget. The page in the properties window should still be set to signals so just click on the ... button and select activate from the GtkEntry signals. There's a picture of this list to the right. Notice how it's changed from that list presented for the button widget. After you select activate, click on 'ok' and then click on 'add' to add the signal to the signal handler list. Do the same for the cel_entry widget. Those are all the signals we need to add for gtemp, at this time. But what about the signals for the about window? Well since this is a stock gnome dialog, the signal handlers are already set. Unless we want them to do something different than stock (and why would we?) we've no reason to touch them. |
| Previous | Next |