main window api files
[lttv.git] / ltt / branches / poly / lttv / modules / gui / API / menu.c
CommitLineData
561f5852 1//#include <lttv/menu.h>
2#include "menu.h"
3
4
5inline LttvMenus *lttv_menus_new() {
6 return g_array_new(FALSE, FALSE, sizeof(lttv_menu_closure));
7}
8
9/* MD: delete elements of the array also, but don't free pointed addresses
10 * (functions).
11 */
12inline void lttv_menus_destroy(LttvMenus *h) {
13 g_array_free(h, TRUE);
14}
15
16inline void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char* menuText)
17{
18 lttv_menu_closure c;
19
20 /* if h is null, do nothing, or popup a warning message */
21 if(h == NULL)return;
22
23 c.con = f;
24 c.menuPath = menuPath;
25 c.menuText = menuText;
26 g_array_append_val(h,c);
27}
28
29gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f)
30{
31 lttv_menu_closure * tmp;
32 gint i;
33 for(i=0;i<h->len;i++){
34 tmp = & g_array_index(h, lttv_menu_closure, i);
35 if(tmp->con == f)break;
36 }
37 if(i<h->len){
38 g_array_remove_index(h, i);
39 return TRUE;
40 }else return FALSE;
41
42}
43
44unsigned lttv_menus_number(LttvMenus *h)
45{
46 return h->len;
47}
48
49
This page took 0.023713 seconds and 4 git commands to generate.