{
GList *it;
+ if (self->destroy) self->destroy(self);
+
for (it = self->entries; it; it = it->next)
menu_entry_free(it->data);
g_list_free(self->entries);
menu_controller_show show, menu_controller_update update,
menu_controller_selected selected,
menu_controller_hide hide,
- menu_controller_mouseover mouseover)
+ menu_controller_mouseover mouseover,
+ menu_controller_destroy destroy)
{
XSetWindowAttributes attrib;
ObMenu *self;
self->invalid = TRUE;
/* default controllers */
+ self->destroy = destroy;
self->show = (show != NULL ? show : menu_show_full);
self->hide = (hide != NULL ? hide : menu_hide);
self->update = (update != NULL ? update : menu_render);
ob_rr_theme->bwidth - ob_rr_theme->menu_overlap;
/* need to get the width. is this bad?*/
- self->parent->update(self->submenu);
+ self->submenu->update(self->submenu);
a = screen_physical_area_monitor(self->parent->xin_area);
typedef struct _ObMenu ObMenu;
typedef struct _ObMenuEntry ObMenuEntry;
+typedef void(*menu_controller_destroy)(ObMenu *self);
typedef void(*menu_controller_show)(ObMenu *self, int x, int y,
struct _ObClient *);
typedef void(*menu_controller_update)(ObMenu *self);
ObMenu *open_submenu;
GList *over;
+ /* destructor */
+ menu_controller_destroy destroy;
+
/* behaviour callbacks
TODO: Document and split code that HAS to be in the overridden callback */
/* place a menu on screen */
#define menu_new(l, n, p) \
menu_new_full(l, n, p, menu_show_full, menu_render, menu_entry_fire, \
- menu_hide, menu_control_mouseover)
+ menu_hide, menu_control_mouseover, NULL)
ObMenu *menu_new_full(char *label, char *name, ObMenu *parent,
- menu_controller_show show, menu_controller_update update,
+ menu_controller_show show,
+ menu_controller_update update,
menu_controller_selected selected,
menu_controller_hide hide,
- menu_controller_mouseover mouseover);
+ menu_controller_mouseover mouseover,
+ menu_controller_destroy destroy);
void menu_free(char *name);