/[zanavi_public1]/navit/navit/menu.c
ZANavi

Contents of /navit/navit/menu.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: text/plain
File size: 1270 byte(s)
import files
1 zoff99 2 /**
2     * Navit, a modular navigation system.
3     * Copyright (C) 2005-2008 Navit Team
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU General Public License
7     * version 2 as published by the Free Software Foundation.
8     *
9     * This program is distributed in the hope that it will be useful,
10     * but WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     * GNU General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with this program; if not, write to the
16     * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17     * Boston, MA 02110-1301, USA.
18     */
19    
20     #include <glib.h>
21     #include "menu.h"
22     #include "debug.h"
23    
24     struct menu *
25     menu_add(struct menu *menu, char *name, enum menu_type type, struct callback *cb)
26     {
27     struct menu *this;
28     if (! menu || ! menu->meth.add)
29     return NULL;
30     this=g_new0(struct menu, 1);
31     this->priv=(*menu->meth.add)(menu->priv, &this->meth, name, type, cb);
32     if (! this->priv) {
33     g_free(this);
34     return NULL;
35     }
36    
37     return this;
38     }
39    
40     void
41     menu_popup(struct menu *menu)
42     {
43     if (! menu || ! menu->meth.popup)
44     return;
45     (*menu->meth.popup)(menu->priv);
46    
47     }

   
Visit the ZANavi Wiki