summaryrefslogtreecommitdiff
path: root/navit/map.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-06-16 14:48:42 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-06-16 14:48:42 +0000
commitb1bb8118a18540a1fa50e6d69a6151422c97c752 (patch)
treef5c2c1d2fc10e9b5b446ba2468120b449dd6eb65 /navit/map.c
parent4b2a3a590c132abbf3415e8d42967d841794a36c (diff)
downloadnavit-b1bb8118a18540a1fa50e6d69a6151422c97c752.tar.gz
Fix:gui_internal:More functionality for gui_internal
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1125 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map.c')
-rw-r--r--navit/map.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/navit/map.c b/navit/map.c
index 2f0b427b1..c2eb0e7ad 100644
--- a/navit/map.c
+++ b/navit/map.c
@@ -27,6 +27,7 @@
#include "transform.h"
#include "item.h"
#include "plugin.h"
+#include "callback.h"
#include "country.h"
@@ -35,6 +36,7 @@ struct map {
struct map_priv *priv;
char *type;
char *filename;
+ struct callback_list *attr_cbl;
int active;
};
@@ -65,6 +67,8 @@ map_new(const char *type, struct attr **attrs)
g_free(m);
m=NULL;
}
+ if (m)
+ m->attr_cbl=callback_list_new();
return m;
}
@@ -93,6 +97,52 @@ map_set_active(struct map *this_, int active)
}
int
+map_get_attr(struct map *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ switch (type) {
+ case attr_active:
+ attr->u.num=this_->active;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int
+map_set_attr(struct map *this_, struct attr *attr)
+{
+ int attr_updated=0;
+
+ switch (attr->type) {
+ case attr_active:
+ if (this_->active != !!attr->u.num) {
+ this_->active=!!attr->u.num;
+ attr_updated=1;
+ }
+ break;
+ default:
+ return 0;
+ }
+ if (attr_updated)
+ callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
+}
+
+void
+map_add_callback(struct map *this_, struct callback *cb)
+{
+ callback_list_add(this_->attr_cbl, cb);
+}
+
+void
+map_remove_callback(struct map *this_, struct callback *cb)
+{
+ callback_list_remove(this_->attr_cbl, cb);
+}
+
+
+
+int
map_requires_conversion(struct map *this_)
{
return (this_->meth.charset != NULL && strcmp(this_->meth.charset, "utf-8"));