Previous Up Next

KPlug Glade Tutorial

Glade Widgets in More Detail: Gnome

Gnome widgets are used to standardize the gnome interface. If you are building a Gnome application, it is best to use them. They also simplify a few things, in comparison to similar Gtk+ widgets, and can allow you to tie your application into standard Gnome resources and other goodies.

Note that the following is NOT an exhaustive list of widgets. There are widgets available with different libraries that aren't included in Glade. Also note that all the functions for each widget are not listed here, nor are their parameters. See the documentation for more on the functions.

Gnome
ImageNamePurposeFunctions and Considerations
Gnome Application WindowApplication Windowcreates a standardized gnome app window You will have to associate handlers to the signals emitted by the elements in the menus and the toolbar. See above on menu and toolbar for specifics.
Gnome Dialog BoxDialog Boxcreates a dialog box, with premade buttons, to gnome standard You will have to associate handlers to the buttons, you can change the labels and icons on the buttons as well, or remove one or two if you wish.
Gnome Message BoxMessage Boxcreates a standardized message boxYou will need to add whatever message, choose the type of message (warning, information etc), and deal with the signal on the 'ok' button.
Gnome About DialogAbout Dialogcreates a gnome about dialog box You dont have to do anything here, but fill out the data (copyright, author, etc). Even the button signal is handled automatically.
Gnome Color PickerGnome Color Pickercreates a button which brings up the gtk color selection dialog widgetThis widget is a button which shows the color that has been selected, or the default color. Use the various gnome_color_picker_get_*() and gnome_color_picker_set_*() functions to manipulate the color swatch in this widget. The signal associated with this widget is color_set.
Gnome Font PickerGnome Font Pickercreates a button which brings up the gtk font selection dialog widgetThe button this widget creates can be clicked to bring up the font selection dialog. It displays the current font as well. Use gnome_font_picker_get_font(), gnome_font_picker_get_font_name(), etc. The signal associated with this widget is font_set.
Gnome Icon EntryGnome Icon Entrycreates an 'icon picker' buttonThis widget creates a button which will display the current icon, and bring up an icon selector when clicked. You can use the gnome_icon_entry_get_filename() function, amongst others, to play with this widget.
Gnome Href ButtonGnome Hrefcreates a button that links to a webpageThis widget is a button that, when clicked, will launch the user's default browser and open up a webage. You can change an manipulate the label and url with gnome_href_set_url(), gnome_href_set_label().
Gnome Entry BoxGnome Entrycreates a combo entry box, with drop down menu and automatically managed 'history' This is a standard combo box, but the history of the entries added to the box is maintained and managed by Gnome resources. Use the standard combobox signals and functions to deal with this. You can also use any of the gnome_entry_*() functions.
Gnome File EntryGnome File Entrycreates a combo entry box, with drop down menu, and 'browse' button for finding files There is a browse_clicked signal, which you can use to change the fileselection dialog which opens normally. You'll also need to connect to the gtk_entry signals (when something is changed) and so on.
Gnome Number EntryGnome Number Entrycreates a number entry widget with a calculator button This widget has a calculator button, and lets the user put the results of the computation straight into the entry widget. It doesn't do any limit checks. Use gnome_number_entry_get_number() to grab the number.
Gnome PixMap EntryGnome Pixmap Entrythis creates a pixmap preview and an entry widget to pick pixmapsThis widget displays a preview of the selected image, and the entry part of it can return a filename if needed (it's a simple gnome file entry widget).
Gnome Date EditGnome Date Editcreates a date and time widget for manipulation You can connect to the date_changed and time_changed signals here. Notice that it has a popup calendar button (internally managed) and a drop down option menu of times (also internally managed). The selections here will show in the date and time entry slots. The gnome_date_edit_get_date() function will return the time entered in the widget. Remember, this is time_t, in C terms.
Gnome DialDial creates a dial widgetThis is an analog dial, much like an old radio tuner dial. It can be set to view only, or the user can manipulate it to a value. Use gtk_dial_get_percentage(), gtk_dial_set_percentage(), gtk_dial_set_value(), and gtk_dial_get_value() to deal with the numbers.
Gtk ClockClock creates a digital clock that counts up or down or shows realtime You can set the format of the display in the Glade properties window. To use it as a timer set the seconds, and interval in the Properties window. Gtk_clock_start() will start the clock moving, you'll have to call this in some other handler (ie an ok button, or whatever), gtk_clock_stop() will stop it.
Gnome App BarGnome App bar creates the standard gnome application bar This is the application bar that is loaded stock into the bottom of the Gnome Application Window. In the Glade Properties window you can see if it'll show a progress bar and a status message area. This message area is useful for giving status messages to the user. The gnome_appbar_push() and gnome_appbar_pop() functions are two of those that manipulate this. There is also a 'minibuffer' aspect to the appbar, see the Gnome Reference Manual link on the help page in this tutorial.
Gnome CalculatorGnome Calculatorcreates a calculator widgetYou can hook to the result upon the result_changed signal. Use the gnome_calculator_get_result() function to actually grab it.
Gnome LessGnome Less creates a widget that shows a file or a streamThis widget is like a unix 'more' command. The user can view a text file. The font can be specified in the Glade Properties window, use gnome_less_show_file() to show a file, gnome_less_show_filestream() to show a filestream and so on.
Gnome Paper SelectorGnome Paper Selectorcreates a paper selection widget, for printing In your code, find the widget and use the various gnome_paper_selector_get_*() functions to link the selections to your printing code.
Gnome CanvasGnome Canvas creates a display widget for structured graphicsI'm not familiar with this widget, and the documentation on it needs to be finished. Sorry. I do know there are several widget libraries out there which interface with it, they might be worth looking into when you need this widget.
Gnome Property BoxProperty Boxcreates a standardized popup window to deal with various program properties You will have to handle the signals on the buttons at the bottom of the box, as well as those that you might create within the box. As with the other gnome widgets, this is created from gtk widgets, so see above on buttons etc.
Gnome DruidGnome Druid creates the gnome druid series of widgetsGnome Druid is used when an application is first started, in order to allow the user to customize the application to their liking. You'll need to specify how many pages you need, and then use the Properties window to set properties for each page, and so on. You'll need to attach to the finish, prepare, cancel, and so on, signals. As well as adding whatever entry fields you need for the standard pages in the druid widget.
Gnome PixmapGnome Pixmap loads and displays pixmaps from various sourcesThis widget will load, resize and set up various types of image correctly.
Gnome AnimatorGnome Animatorcreates a widget to add animation to applications See the documentation here, as I am not familiar with this one.

Previous Up Next