- menu_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- menu_destroy_hash_key,
- (GDestroyNotify)menu_destroy_hash_value);
- menu_map = g_hash_table_new(g_int_hash, g_int_equal);
-
- m = menu_new("sex menu", "root", NULL);
- a = action_from_string("execute");
- a->data.execute.path = g_strdup("xterm");
- menu_add_entry(m, menu_entry_new("xterm", a));
- a = action_from_string("restart");
- menu_add_entry(m, menu_entry_new("restart", a));
- menu_add_entry(m, menu_entry_new("--", NULL));
- a = action_from_string("exit");
- menu_add_entry(m, menu_entry_new("exit", a));
-
- m = menu_new("client menu", "client", NULL);
- a = action_from_string("iconify");
- menu_add_entry(m, menu_entry_new("iconify", a));
- a = action_from_string("toggleshade");
- menu_add_entry(m, menu_entry_new("(un)shade", a));
- a = action_from_string("togglemaximizefull");
- menu_add_entry(m, menu_entry_new("(un)maximize", a));
- a = action_from_string("close");
- menu_add_entry(m, menu_entry_new("close", a));
-}
-
-void menu_shutdown()
+ g_assert(name != NULL);
+
+ if (!(self = g_hash_table_lookup(menu_hash, name)))
+ g_message(_("Attempted to access menu '%s' but it does not exist"),
+ name);
+ return self;
+}
+
+#define VALID_SHORTCUT(c) (((c) >= '0' && (c) <= '9') || \
+ ((c) >= 'A' && (c) <= 'Z') || \
+ ((c) >= 'a' && (c) <= 'z'))
+
+static gunichar parse_shortcut(const gchar *label, gboolean allow_shortcut,
+ gchar **strippedlabel, guint *position,
+ gboolean *always_show)