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 "debug.h"
|
22 |
|
|
#include "item.h"
|
23 |
|
|
#include "announcement.h"
|
24 |
|
|
|
25 |
|
|
struct announcement {
|
26 |
|
|
struct attr **attrs;
|
27 |
|
|
};
|
28 |
|
|
|
29 |
|
|
struct announcement *
|
30 |
|
|
announcement_new(struct attr *parent, struct attr **attrs)
|
31 |
|
|
{
|
32 |
|
|
struct announcement *this_;
|
33 |
|
|
struct attr *type_attr;
|
34 |
|
|
if (! (type_attr=attr_search(attrs, NULL, attr_name))) {
|
35 |
|
|
return NULL;
|
36 |
|
|
}
|
37 |
|
|
this_=g_new0(struct announcement, 1);
|
38 |
|
|
this_->attrs=attr_list_dup(attrs);
|
39 |
|
|
return this_;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
int
|
43 |
|
|
announcement_get_attr(struct announcement *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
|
44 |
|
|
{
|
45 |
|
|
return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
int
|
49 |
|
|
announcement_set_attr(struct announcement *this_, struct attr *attr)
|
50 |
|
|
{
|
51 |
|
|
this_->attrs=attr_generic_set_attr(this_->attrs, attr);
|
52 |
|
|
return 1;
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
int
|
56 |
|
|
announcement_add_attr(struct announcement *this_, struct attr *attr)
|
57 |
|
|
{
|
58 |
|
|
this_->attrs=attr_generic_add_attr(this_->attrs, attr);
|
59 |
|
|
return 1;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
int
|
63 |
|
|
announcement_remove_attr(struct announcement *this_, struct attr *attr)
|
64 |
|
|
{
|
65 |
|
|
this_->attrs=attr_generic_remove_attr(this_->attrs, attr);
|
66 |
|
|
return 1;
|
67 |
|
|
}
|
68 |
|
|
|