ObMenuParseState *state = data;
gchar *name = NULL, *title = NULL, *script = NULL;
ObMenu *menu;
+ ObMenuEntry *e;
+ gchar *icon;
if (!obt_xml_attr_string(node, "id", &name))
goto parse_menu_fail;
}
}
- if (state->parent)
- menu_add_submenu(state->parent, -1, name);
+ if (state->parent) {
+ e = menu_add_submenu(state->parent, -1, name);
+
+ if (config_menu_show_icons &&
+ obt_xml_attr_string(node, "icon", &icon))
+ {
+ e->data.submenu.icon = RrImageNewFromName(ob_rr_icons, icon);
+
+ if (e->data.submenu.icon)
+ e->data.submenu.icon_alpha = 0xff;
+
+ g_free(icon);
+ }
+ }
parse_menu_fail:
g_free(name);
}
break;
case OB_MENU_ENTRY_TYPE_SUBMENU:
+ RrImageUnref(self->data.submenu.icon);
g_free(self->data.submenu.name);
break;
case OB_MENU_ENTRY_TYPE_SEPARATOR:
} ObMenuEntryType;
struct _ObNormalMenuEntry {
+ /* Icon stuff. If you set this, make sure you RrImageRef() it too. */
+ RrImage *icon;
+ gint icon_alpha;
+
gchar *label;
/*! The shortcut key that would be used to activate this menu entry */
gunichar shortcut;
/* List of ObActions */
GSList *actions;
- /* Icon stuff. If you set this, make sure you RrImageRef() it too. */
- RrImage *icon;
- gint icon_alpha;
-
/* Mask icon */
RrPixmapMask *mask;
RrColor *mask_normal_color;
};
struct _ObSubmenuMenuEntry {
+ /* Icon stuff. If you set this, make sure you RrImageRef() it too. */
+ RrImage *icon;
+ gint icon_alpha;
+
gchar *name;
ObMenu *submenu;
+
guint show_from;
};
self->text = createWindow(self->window, 0, NULL);
g_hash_table_insert(menu_frame_map, &self->window, self);
g_hash_table_insert(menu_frame_map, &self->text, self);
- if (entry->type == OB_MENU_ENTRY_TYPE_NORMAL) {
+ if ((entry->type == OB_MENU_ENTRY_TYPE_NORMAL) ||
+ (entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) {
self->icon = createWindow(self->window, 0, NULL);
g_hash_table_insert(menu_frame_map, &self->icon, self);
}
XDestroyWindow(obt_display, self->window);
g_hash_table_remove(menu_frame_map, &self->text);
g_hash_table_remove(menu_frame_map, &self->window);
- if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) {
+ if ((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) ||
+ (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) {
XDestroyWindow(obt_display, self->icon);
g_hash_table_remove(menu_frame_map, &self->icon);
}
g_assert_not_reached();
}
- if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
+ if (((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) ||
+ (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) &&
self->entry->data.normal.icon)
{
RrAppearance *clear;