Diff of /trunk/src/gconf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 34 by harbaum, Wed Jul 29 19:24:15 2009 UTC revision 89 by harbaum, Tue Sep 1 11:16:30 2009 UTC
# Line 84  static store_t store[] = { Line 84  static store_t store[] = {
84    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },
85    { "cachelist_update", STORE_BOOL,   OFFSET(cachelist_update) },    { "cachelist_update", STORE_BOOL,   OFFSET(cachelist_update) },
86  #endif  #endif
87    #ifdef ENABLE_OSM_GPS_MAP
88      { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },
89      { "map_lon",          STORE_FLOAT,  OFFSET(map.pos.lon) },
90      { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },
91      { "map_source",       STORE_INT,    OFFSET(map.source) },
92    #endif
93    { NULL, -1, -1 }    { NULL, -1, -1 }
94  };  };
95    
# Line 228  void gconf_load_state(appdata_t *appdata Line 233  void gconf_load_state(appdata_t *appdata
233          else          else
234            *gpx = gpx_parse(dialog, fname);            *gpx = gpx_parse(dialog, fname);
235    
236          free(fname);          if(!*gpx) {
237              /* restoring the gpx file failed, mark it as unusable, but save */
238              /* its presence for later use */
239    
240              /* create fake entry to remember this file for next load attempt */
241              *gpx = g_new0(gpx_t, 1);
242              (*gpx)->filename = fname;
243              (*gpx)->failed = TRUE;
244            } else
245              free(fname);
246        }        }
247      }      }
248    
249      /* use next gpx entry of this was loaded successfully */      gpx = &((*gpx)->next);
     if(*gpx)  
       gpx = &((*gpx)->next);  
250    }    }
251    
252    gpx_busy_dialog_destroy(dialog);    gpx_busy_dialog_destroy(dialog);
# Line 326  void gconf_load_state(appdata_t *appdata Line 338  void gconf_load_state(appdata_t *appdata
338  #endif  #endif
339      appdata->image_path = strdup(DEFAULT_IMAGE_PATH);      appdata->image_path = strdup(DEFAULT_IMAGE_PATH);
340    
341        /* check if this path is actually accessible */
342        /* and change it to the current users home if not */
343        /* (this should only happen on scratchbox) */
344        if(!g_file_test(appdata->image_path, G_FILE_TEST_IS_DIR)) {
345          if(g_mkdir_with_parents(appdata->image_path, 0700) != 0) {
346            char *p = getenv("HOME");
347            if(!p) p = "/tmp/";
348    
349            appdata->image_path =
350              g_strdup_printf("%s%s%s", p,
351                              (p[strlen(p)-1]!='/')?"/":"",
352                              DEFAULT_IMAGE_PATH_HOME);
353            printf("using alt path %s\n", appdata->image_path);
354          }
355        }
356    
357    } else {    } else {
358      /* some versions old versions messed up the path */      /* some versions old versions messed up the path */
359      if(appdata->image_path[strlen(appdata->image_path)-1] != '/') {      if(appdata->image_path[strlen(appdata->image_path)-1] != '/') {

Legend:
Removed from v.34  
changed lines
  Added in v.89