Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Gtk+/Gnome Application Development
Prev Home Next

The Main Window: GnomeApp

This chapter describes Gnome's features for creating your application's main window, complete with menus and a toolbar.

The GnomeApp Widget

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 window contents.

  • Users can elect to disable detachable bars for all Gnome applications.

  • Users can choose whether to have small icons in the application's menus.

More options will probably be added in the future.

Figure 1. The Gnumeric spreadsheet, which uses the GnomeApp widget

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.

#include <libgnomeui/gnome-app.h>

GtkWidget* gnome_app_new(gchar* app_id, gchar* title);

Figure 2. GnomeApp Constructor

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 statusbars. 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.

#include <libgnomeui/gnome-app.h>

void gnome_app_set_contents(GnomeApp* app, GtkWidget* contents);

void gnome_app_set_menus(GnomeApp* app, GtkMenuBar* menubar);

void gnome_app_set_toolbar(GnomeApp* app, GtkToolbar* toolbar);

void gnome_app_set_statusbar(GnomeApp* app, GtkWidget* statusbar);

Figure 3. Adding Widgets to GnomeApp

Gtk+/Gnome Application Development
Prev Home Next

  Published under free license. Design by Interspire