Some artwork until we choose the coolest one.
[mediadatabase.git] / gtk / menu.c
blobe1eb6bf9f9f09fb7d90f55ce631bde0851c97abe
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * $Id: menu.c,v 1.1 2004/08/31 22:40:15 nedko Exp $
6 * DESCRIPTION:
7 *
9 * NOTES:
12 *****************************************************************************/
14 #include <gtk/gtk.h>
16 #include "menu.h"
17 #include "search.h"
19 /* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
20 static GtkItemFactoryEntry g_MenuItems[] = {
21 { "/_File", NULL, NULL, 0, "<Branch>" },
22 { "/File/_Search", NULL, ShowSearchWindow, 0, "<Item>"},
23 { "/File/_Quit", "<CTRL>Q", gtk_main_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
24 { "/_Help", NULL, NULL, 0, "<LastBranch>" },
25 { "/_Help/About", NULL, NULL, 0, "<Item>" },
28 static gint g_nMenuItems = sizeof(g_MenuItems) / sizeof(g_MenuItems[0]);
30 GtkWidget *
31 CreateMenuBar(GtkWidget *pWindow)
33 GtkItemFactory *item_factory;
34 GtkAccelGroup *accel_group;
36 /* Make an accelerator group (shortcut keys) */
37 accel_group = gtk_accel_group_new();
39 /* Make an ItemFactory (that makes a menubar) */
40 item_factory = gtk_item_factory_new(
41 GTK_TYPE_MENU_BAR,
42 "<MediaDatabseMain>",
43 accel_group);
45 /* This function generates the menu items. Pass the item factory,
46 the number of items in the array, the array itself, and any
47 callback data for the the menu items. */
48 gtk_item_factory_create_items(
49 item_factory,
50 g_nMenuItems,
51 g_MenuItems,
52 NULL);
54 /* Attach the new accelerator group to the window. */
55 gtk_window_add_accel_group(
56 GTK_WINDOW(pWindow),
57 accel_group);
59 /* Finally, return the actual menu bar created by the item factory. */
60 return gtk_item_factory_get_widget(
61 item_factory,
62 "<MediaDatabseMain>");
65 /*****************************************************************************
67 * Modifications log:
69 * !!! WARNING !!! Following lines are automatically updated by the CVS system.
71 * $Log: menu.c,v $
72 * Revision 1.1 2004/08/31 22:40:15 nedko
73 * Partitally implemented search feature.
75 *****************************************************************************/