Diff of /trunk/src/gconf.c

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

revision 48 by harbaum, Fri Aug 7 07:57:33 2009 UTC revision 103 by harbaum, Wed Sep 9 11:50:50 2009 UTC
# Line 88  static store_t store[] = { Line 88  static store_t store[] = {
88    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },
89    { "map_lon",          STORE_FLOAT,  OFFSET(map.pos.lon) },    { "map_lon",          STORE_FLOAT,  OFFSET(map.pos.lon) },
90    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },
91      { "map_source",       STORE_INT,    OFFSET(map.source) },
92  #endif  #endif
93    { NULL, -1, -1 }    { NULL, -1, -1 }
94  };  };
# Line 216  void gconf_load_state(appdata_t *appdata Line 217  void gconf_load_state(appdata_t *appdata
217      char str[128];      char str[128];
218      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);
219      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);
   
220      if(fname) {      if(fname) {
221        /* check if there's a valid name stored for this file. */        /* check if there's a valid name stored for this file. */
222        /* if yes it's a "closed" file */        /* if yes it's a "closed" file */
# Line 232  void gconf_load_state(appdata_t *appdata Line 232  void gconf_load_state(appdata_t *appdata
232          else          else
233            *gpx = gpx_parse(dialog, fname);            *gpx = gpx_parse(dialog, fname);
234    
235          free(fname);          if(!*gpx) {
236              /* restoring the gpx file failed, mark it as unusable, but save */
237              /* its presence for later use */
238    
239              /* create fake entry to remember this file for next load attempt */
240              *gpx = g_new0(gpx_t, 1);
241              (*gpx)->filename = fname;
242              (*gpx)->failed = TRUE;
243            } else
244              free(fname);
245        }        }
     }  
   
     /* use next gpx entry of this was loaded successfully */  
     if(*gpx)  
246        gpx = &((*gpx)->next);        gpx = &((*gpx)->next);
247        }
248    }    }
249    
250    gpx_busy_dialog_destroy(dialog);    gpx_busy_dialog_destroy(dialog);
# Line 330  void gconf_load_state(appdata_t *appdata Line 336  void gconf_load_state(appdata_t *appdata
336  #endif  #endif
337      appdata->image_path = strdup(DEFAULT_IMAGE_PATH);      appdata->image_path = strdup(DEFAULT_IMAGE_PATH);
338    
339        /* check if this path is actually accessible */
340        /* and change it to the current users home if not */
341        /* (this should only happen on scratchbox) */
342        if(!g_file_test(appdata->image_path, G_FILE_TEST_IS_DIR)) {
343          if(g_mkdir_with_parents(appdata->image_path, 0700) != 0) {
344            char *p = getenv("HOME");
345            if(!p) p = "/tmp/";
346    
347            appdata->image_path =
348              g_strdup_printf("%s%s%s", p,
349                              (p[strlen(p)-1]!='/')?"/":"",
350                              DEFAULT_IMAGE_PATH_HOME);
351            printf("using alt path %s\n", appdata->image_path);
352          }
353        }
354    
355    } else {    } else {
356      /* some versions old versions messed up the path */      /* some versions old versions messed up the path */
357      if(appdata->image_path[strlen(appdata->image_path)-1] != '/') {      if(appdata->image_path[strlen(appdata->image_path)-1] != '/') {

Legend:
Removed from v.48  
changed lines
  Added in v.103