- data = self->render_data;
-
- /* set texture data and size them mofos out */
- data->a_title->texture[0].data.text.string = self->label;
- appearance_minsize(data->a_title, &data->title_min_w, &data->title_h);
- data->title_min_w += theme_bevel * 2;
- data->title_h += theme_bevel * 2;
- w = MAX(w, data->title_min_w);
-
- for (it = self->entries; it; it = it->next) {
- MenuEntryRenderData *r = ((MenuEntry*)it->data)->render_data;
-
- r->a_item->texture[0].data.text.string = ((MenuEntry*)it->data)->label;
- appearance_minsize(r->a_item, &r->min_w, &item_h);
- r->min_w += theme_bevel * 2;
- item_h += theme_bevel * 2;
- w = MAX(w, r->min_w);
- ++nitems;
- }
- bullet_w = item_h + theme_bevel;
- w += 2 * bullet_w;
- items_h = item_h * nitems;
-
- /* size appearances */
- RECT_SET(data->a_title->area, 0, 0, w, data->title_h);
- RECT_SET(data->a_title->texture[0].position, 0, 0, w, data->title_h);
- RECT_SET(data->a_items->area, 0, 0, w, items_h);
- for (it = self->entries; it; it = it->next) {
- MenuEntryRenderData *r = ((MenuEntry*)it->data)->render_data;
- RECT_SET(r->a_item->area, 0, 0, w, item_h);
- RECT_SET(r->a_item->texture[0].position, bullet_w, 0,
- w - 2 * bullet_w, item_h);
- }
-
- /* size windows and paint the suckers */
- XMoveResizeWindow(ob_display, data->frame, x, y, w,
- data->title_h + items_h);
- XMoveResizeWindow(ob_display, data->title, -theme_bwidth, -theme_bwidth,
- w, data->title_h);
- paint(data->title, data->a_title);
- XMoveResizeWindow(ob_display, data->items, 0, data->title_h + theme_bwidth,
- w, items_h);
- paint(data->items, data->a_items);
- for (item_y = 0, it = self->entries; it; item_y += item_h, it = it->next) {
- MenuEntryRenderData *r = ((MenuEntry*)it->data)->render_data;
- XMoveResizeWindow(ob_display, r->item, 0, item_y, w, item_h);
- r->a_item->surface.data.planar.parent = data->a_items;
- r->a_item->surface.data.planar.parentx = 0;
- r->a_item->surface.data.planar.parenty = item_y;
- paint(r->item, r->a_item);
- }
-
-
- XMapWindow(ob_display, data->frame);
+ for (it = self->entries; it; it = g_list_next(it)) {
+ ObMenuEntry *e = it->data;
+
+ if (e->type == OB_MENU_ENTRY_TYPE_SUBMENU)
+ e->data.submenu.submenu = menu_from_name(e->data.submenu.name);
+ }
+}
+
+void menu_entry_set_label(ObMenuEntry *self, const gchar *label,
+ gboolean allow_shortcut)
+{
+ switch (self->type) {
+ case OB_MENU_ENTRY_TYPE_SEPARATOR:
+ g_free(self->data.separator.label);
+ self->data.separator.label = g_strdup(label);
+ break;
+ case OB_MENU_ENTRY_TYPE_NORMAL:
+ g_free(self->data.normal.label);
+ self->data.normal.shortcut =
+ parse_shortcut(label, allow_shortcut, &self->data.normal.label,
+ &self->data.normal.shortcut_position);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+void menu_show_all_shortcuts(ObMenu *self, gboolean show)
+{
+ self->show_all_shortcuts = show;