OVERVIEW OF Hildon and GTK

A HildonProgram is a GObject representing the whole application. In this context it is important to note that a HildonProgram *is not* a GtkWidget. Only one HildonProgram can be created per process. It is accessed with hildon_program_get_instance.

HildonWindows are registered to the HildonProgram using hildon_program_add_window() As the method name suggests, several HildonWindows are likely to be registered to a HildonProgram.

An example 'OVERVIEW OF A PROGRAM' looks like:

/* Create needed variables */
HildonProgram *program;
HildonWindow *window;
/* Initialize GTK. */
gtk_init (&argc, &argv);
/* Create the hildon program and setup the title */
program = HILDON_PROGRAM (hildon_program_get_instance());

Menu's are created externally using GtkMenu. They are then added to a HildonWindow with hildon_window_set_menu() An example of this looks like:

GtkMenu *menu;
menu = gtk_menu_new ();
fill_in_menu (menu);
hildon_window_set_menu (menu);

TOOLBARS

These are created using a call to hildon_window_add_toolbar() An example of this looks like:

GtkToolbar *toolbar;
toolbar = create_toolbar ();
/* Add toolbar to the HildonWindow */
hildon_window_add_toolbar (window, toolbar);

HIBERNATION

A programmer can tell the Hildon Task Navigator whether or not an application is ready to be set to hibernation (background-killed) by calling set_can_hibernate()

WINDOW SPECIFIC SETTINGS

Window-specific commands can be sent to the window manager and task navigator. Applications can tell the task navigator that some window requires the user’s attention. This will trigger the blinking of the window’s icon in the task navigator. This is shown by:

gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE);

Similarly applications are able to change the icon representing each of their HildonWindow in the task navigator by using the gtk_window_set _icon set of functions. This is shown by:

GdkPixbuf *icon = create_icon();
gtk_window_set_icon (GTK_WINDOW (window), icon);
    
Also the title can be set per window with:
{{{gtk_window_set_title (GTK_WINDOW (window), "Window Title");

If the application name was set with g_set_application name(), it will precede the window title in the title bar.

PROGRAM WIDE SETTINGS

The HildonProgram object provides the programmer with commodities to set program-wide settings for all the registered HildonWindow's. The programmer can create a common menu which will be shared (memory and functionality-wise) by all the windows. A window can override this common menu by having its own menu.

This is shown by:

GtkMenu *common_menu = create_common_menu ();
GtkMenu *window_specific_menu = create_window_specific_menu ();
                
hildon_program_set_common_menu (program, common_menu);
hildon_window_set_menu (second_window, window_specific_menu);

Also, a common toolbar can be shared among all HildonWindow's. Windows can add window specific toolbars. The common toolbar will be displayed on the bottom of the stack of toolbars.

This is shown by:

GtkToolbar *common_toolbar = create_common_toolbar ();
GtkToolbar *window_specific_toolbar = create_window_specific_toolbar ();
hildon_program_set_common_toolbar (program, common_toolbar);
hildon_window_add_toolbar (second_window, window_specific_toolbar);

.

UMEGuide/ApplicationDevelopment/OverviewOfHildonAndGtk (last edited 2008-07-24 17:11:10 by localhost)