… | |
… | |
92 | default: |
92 | default: |
93 | return 0; |
93 | return 0; |
94 | } |
94 | } |
95 | } |
95 | } |
96 | |
96 | |
97 | // copied from map.c !!!!!!!!! |
|
|
98 | // copied from map.c !!!!!!!!! |
|
|
99 | struct map { |
|
|
100 | struct map_methods meth; /**< Structure with pointers to the map plugin's functions */ |
|
|
101 | struct map_priv *priv; /**< Private data of the map, only known to the map plugin */ |
|
|
102 | struct attr **attrs; /**< Attributes of this map */ |
|
|
103 | struct callback_list *attr_cbl; /**< List of callbacks that are called when attributes change */ |
|
|
104 | int refcount; |
|
|
105 | }; |
|
|
106 | // copied from map.c !!!!!!!!! |
|
|
107 | // copied from map.c !!!!!!!!! |
|
|
108 | |
|
|
109 | int |
97 | int |
110 | mapset_add_attr_name(struct mapset *ms, struct attr *attr) |
98 | mapset_add_attr_name(struct mapset *ms, struct attr *attr) |
111 | { |
99 | { |
112 | struct attr map_name; |
100 | struct attr map_name; |
113 | |
101 | |
… | |
… | |
120 | struct map *m; |
108 | struct map *m; |
121 | m=g_new0(struct map, 1); |
109 | m=g_new0(struct map, 1); |
122 | m=attr->u.map; |
110 | m=attr->u.map; |
123 | struct attr *map_file_name=attr_search(m->attrs, NULL, attr_data); |
111 | struct attr *map_file_name=attr_search(m->attrs, NULL, attr_data); |
124 | map_name.type=attr_name; |
112 | map_name.type=attr_name; |
125 | // map_name.u.str="_ms_sdcard_map"; |
|
|
126 | map_name.u.str=g_strconcat("_ms_sdcard_map:",map_file_name->u.str,NULL); |
113 | map_name.u.str=g_strconcat("_ms_sdcard_map:",map_file_name->u.str,NULL); |
127 | // map_name.u.str=g_strdup(map_file_name->u.str); |
|
|
128 | |
114 | |
129 | dbg(0,"====== map name=%s",map_name.u.str); |
115 | dbg(0,"====== map name1=%s",map_name.u.str); |
130 | map_set_attr(attr->u.map, &map_name); |
116 | map_set_attr(attr->u.map, &map_name); |
131 | |
117 | |
132 | return 1; |
118 | return 1; |
133 | default: |
119 | default: |
134 | return 0; |
120 | return 0; |
135 | } |
121 | } |
136 | } |
122 | } |
137 | |
123 | |
|
|
124 | int |
|
|
125 | mapset_add_attr_name_str(struct mapset *ms, struct attr *attr,char *map_name_str) |
|
|
126 | { |
|
|
127 | struct attr map_name; |
|
|
128 | |
|
|
129 | dbg(0,"****** ADD MAP from sdcard - with name str ******"); |
|
|
130 | switch (attr->type) { |
|
|
131 | case attr_map: |
|
|
132 | ms->maps=g_list_append(ms->maps, attr->u.map); |
|
|
133 | map_ref(attr->u.map); |
|
|
134 | |
|
|
135 | struct map *m; |
|
|
136 | m=g_new0(struct map, 1); |
|
|
137 | m=attr->u.map; |
|
|
138 | struct attr *map_file_name=attr_search(m->attrs, NULL, attr_data); |
|
|
139 | map_name.type=attr_name; |
|
|
140 | map_name.u.str=g_strconcat("_ms_sdcard_map:",map_name_str,NULL); |
|
|
141 | |
|
|
142 | dbg(0,"====== map name2=%s",map_name.u.str); |
|
|
143 | map_set_attr(attr->u.map, &map_name); |
|
|
144 | |
|
|
145 | return 1; |
|
|
146 | default: |
|
|
147 | return 0; |
|
|
148 | } |
|
|
149 | } |
138 | |
150 | |
139 | int |
151 | int |
140 | mapset_remove_attr(struct mapset *ms, struct attr *attr) |
152 | mapset_remove_attr(struct mapset *ms, struct attr *attr) |
141 | { |
153 | { |
142 | switch (attr->type) { |
154 | switch (attr->type) { |
… | |
… | |
278 | * @param ms The map |
290 | * @param ms The map |
279 | * @param map_name the map name used by the search |
291 | * @param map_name the map name used by the search |
280 | * @return The next map |
292 | * @return The next map |
281 | */ |
293 | */ |
282 | struct map * |
294 | struct map * |
283 | mapset_get_map_by_name(struct mapset *ms, char*map_name) |
295 | mapset_get_map_by_name(struct mapset *ms, char *map_name) |
284 | { |
296 | { |
285 | struct mapset_handle*msh; |
297 | struct mapset_handle*msh; |
286 | struct map*curr_map; |
298 | struct map*curr_map; |
287 | struct attr map_attr; |
299 | struct attr map_attr; |
288 | if( !ms || !map_name ) { |
300 | if( !ms || !map_name ) { |