This chapter describes Gnome's features for creating your
application's main window, complete with menus and a
All Gnome applications, excluding a few with special
needs, use the GnomeApp widget
for their main window.
GnomeApp is a subclass of
GtkWindow; it extends the basic toplevel window with
convenient menu and toolbar handling. A GnomeApp window is automatically
user-configurable in several ways:
Menu and toolbars can be detached from the window, or
rearranged in relation to one another and the main
Users can elect to disable detachable bars for all
Users can choose whether to have small icons in the
More options will probably be added in the future.
Figure 1. The Gnumeric spreadsheet, which uses the
GnomeApp has the usual
constructor function, shown in Figure 2. The first
argument, app_id, is an
internal name Gnome can use to work with this
application. It should be the same as the app_id passed to gnome_init(); the name of the executable
is a good choice. The second argument is simply a title
for the application window; if you use NULL here, the title will not be set.
GtkWidget* gnome_app_new(gchar* app_id, gchar* title);
Figure 2. GnomeApp
GnomeApp has a single "content
area" in the center, where you place the main
functionality of your application. On all four sides of
this central area, you can add toolbars, menubars, and
Figure 3 lists the relevant functions.
These functions should be self-explanatory. They simply
install the widget you give them in the appropriate place
on the GnomeApp. There are
easy ways to create the menubar, toolbar, and statusbar;
the remainder of this chapter describes them.
gnome_app_set_contents(GnomeApp* app, GtkWidget* contents);
gnome_app_set_toolbar(GnomeApp* app, GtkToolbar* toolbar);
gnome_app_set_statusbar(GnomeApp* app, GtkWidget* statusbar);
Figure 3. Adding Widgets to