Whole document tree
    

Whole document tree

Adding menus

3.2. Adding menus

From the GNOME Style Guide

Menus and MenuBars
        Menubars should be present in every App.
            All apps should have a "Help" entry in the Menubar.
            All menus need at least one entry.
            An About Menu should be available in under the Help Menu and
            should open a small dialog telling at least app name, author,
            version, and date.
            A "File" menu should be in every application, and contain at least
            Quit.
            Menu items that open dialogs should indicate it with an "..."
            Menu items that lead to submenus should indicate it with an
            arrow. The Help Menu should be right justified in the
            Menubar.
    

At the time of the writing of this draft gnome-hello uses the GtkMenuFactory way of creating menus. It's going to be replaced by the gnome-app-helper in a little time. (when the gnome_app_* have support for i18n, accelerators and right-justified menus). Until then isn't going to be an explanation about "how" do the menus.

The menu options present in gnome-hello are only the mandatory: File/Exit, that uses the same quit_cb that we've seen in the previous section, and Help/About... that uses the gnome-about widget (see Section 6.1) written by Cesar .

void
about_cb (GtkWidget *widget, void *data)
{
  GtkWidget *about;
  gchar *authors[] = {
/* Here should be your names */
          "Mark Galassi",
          "Horacio J. Peña",
          NULL
          };

  about = gnome_about_new ( "The Hello World Gnomified", VERSION,
                        /* copyright notice */
                        "(C) 1998 the Free Software Foundation",
                        authors,
                        /* another comments */
                        "GNOME is a civilized software system "
                          "so we've a \"hello world\" program",
                        NULL);
  gtk_widget_show (about);

  return;
}