Add:gui_internal:Add switch to disable/enable map download to map settings
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 10 Jun 2011 21:14:14 +0000 (21:14 +0000)
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 10 Jun 2011 21:14:14 +0000 (21:14 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4528 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/gui/internal/gui_internal.c

index d6f242e..f8e205b 100644 (file)
@@ -3986,7 +3986,7 @@ gui_internal_cmd_map_download_do(struct gui_priv *this, struct widget *wm, void
 static void
 gui_internal_cmd_map_download(struct gui_priv *this, struct widget *wm, void *data)
 {
-       struct attr on, off;
+       struct attr on, off, download_enabled, download_disabled;
        struct widget *w,*wb,*wma;
        struct map *map=data;
        FILE *f;
@@ -4015,8 +4015,20 @@ gui_internal_cmd_map_download(struct gui_priv *this, struct widget *wm, void *da
                wma=gui_internal_button_map_attr_new(this, _("Active"), gravity_left_center|orientation_horizontal|flags_fill, map, &on, &off, 1);
                gui_internal_widget_append(w, wma);
        }
+       download_enabled.type=download_disabled.type=attr_update;
+       download_enabled.u.num=1;
+       download_disabled.u.num=0;
+       wma=gui_internal_button_map_attr_new(this
+               , _("Download Enabled")
+               , gravity_left_center|orientation_horizontal|flags_fill
+               , map
+               , &download_enabled
+               , &download_disabled
+               , 0);
+       gui_internal_widget_append(w, wma);
+
        f=fopen("maps/areas.tsv","r");
-       while (fgets(buffer, sizeof(buffer), f)) {
+       while (f && fgets(buffer, sizeof(buffer), f)) {
                char *nl,*description,*description_size,*bbox,*size=NULL;
                int sp=0;
                if ((nl=strchr(buffer,'\n')))