Diff of /trunk/src/gconf.c

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

revision 89 by harbaum, Tue Sep 1 11:16:30 2009 UTC revision 158 by harbaum, Wed Nov 4 14:54:52 2009 UTC
# Line 78  static store_t store[] = { Line 78  static store_t store[] = {
78    { "cachelist_items",  STORE_INT,    OFFSET(cachelist_items) },    { "cachelist_items",  STORE_INT,    OFFSET(cachelist_items) },
79    { "compass_damping",  STORE_INT,    OFFSET(compass_damping) },    { "compass_damping",  STORE_INT,    OFFSET(compass_damping) },
80    { "cachelist_hide_found", STORE_BOOL, OFFSET(cachelist_hide_found) },    { "cachelist_hide_found", STORE_BOOL, OFFSET(cachelist_hide_found) },
81      { "cachelist_update", STORE_BOOL,   OFFSET(cachelist_update) },
82  #ifdef USE_MAEMO  #ifdef USE_MAEMO
83    { "mmpoi_dontlaunch", STORE_BOOL,   OFFSET(mmpoi_dontlaunch) },    { "mmpoi_dontlaunch", STORE_BOOL,   OFFSET(mmpoi_dontlaunch) },
84    { "cachelist_dss",    STORE_BOOL,   OFFSET(cachelist_disable_screensaver) },    { "cachelist_dss",    STORE_BOOL,   OFFSET(cachelist_disable_screensaver) },
85    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },
   { "cachelist_update", STORE_BOOL,   OFFSET(cachelist_update) },  
86  #endif  #endif
87  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
88    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },
# Line 132  char *gconf_restore_closed_name(appdata_ Line 132  char *gconf_restore_closed_name(appdata_
132  void gconf_save_state(appdata_t *appdata) {  void gconf_save_state(appdata_t *appdata) {
133    int entries = 0;    int entries = 0;
134    
135      /* free proxy settings */
136      if(appdata->proxy) {
137        proxy_t *proxy = appdata->proxy;
138    
139        if(proxy->authentication_password) g_free(proxy->authentication_password);
140        if(proxy->authentication_user)     g_free(proxy->authentication_user);
141        if(proxy->host)                    g_free(proxy->host);
142        if(proxy->ignore_hosts)            g_free(proxy->ignore_hosts);
143    
144        g_free(proxy);
145        appdata->proxy = NULL;
146      }
147    
148    gpx_t *gpx = appdata->gpx;    gpx_t *gpx = appdata->gpx;
149    while(gpx) {    while(gpx) {
150      char str[128];      char str[128];
# Line 207  void gconf_load_state(appdata_t *appdata Line 220  void gconf_load_state(appdata_t *appdata
220    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;
221    appdata->gps.lat = appdata->gps.lon = NAN;    appdata->gps.lat = appdata->gps.lon = NAN;
222    
223      /* ------------- get proxy settings -------------------- */
224      if(gconf_client_get_bool(appdata->gconf_client,
225                               PROXY_KEY "use_http_proxy", NULL)) {
226        proxy_t *proxy = appdata->proxy = g_new0(proxy_t, 1);
227    
228        /* get basic settings */
229        proxy->host = gconf_client_get_string(appdata->gconf_client,
230                                              PROXY_KEY "host", NULL);
231        proxy->port = gconf_client_get_int(appdata->gconf_client,
232                                           PROXY_KEY "port", NULL);
233        proxy->ignore_hosts =
234          gconf_client_get_string(appdata->gconf_client,
235                                  PROXY_KEY "ignore_hosts", NULL);
236    
237        /* check for authentication */
238        proxy->use_authentication =
239          gconf_client_get_bool(appdata->gconf_client,
240                                PROXY_KEY "use_authentication", NULL);
241    
242        if(proxy->use_authentication) {
243          proxy->authentication_user =
244            gconf_client_get_string(appdata->gconf_client,
245                                    PROXY_KEY "authentication_user", NULL);
246          proxy->authentication_password =
247            gconf_client_get_string(appdata->gconf_client,
248                                    PROXY_KEY "authentication_password", NULL);
249        }
250      }
251    
252    int i, entries = gconf_client_get_int(appdata->gconf_client,    int i, entries = gconf_client_get_int(appdata->gconf_client,
253                                   GCONF_KEY_CNT, NULL);                                   GCONF_KEY_CNT, NULL);
254    
# Line 217  void gconf_load_state(appdata_t *appdata Line 259  void gconf_load_state(appdata_t *appdata
259      char str[128];      char str[128];
260      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);
261      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);
   
262      if(fname) {      if(fname) {
263        /* check if there's a valid name stored for this file. */        /* check if there's a valid name stored for this file. */
264        /* if yes it's a "closed" file */        /* if yes it's a "closed" file */
# Line 237  void gconf_load_state(appdata_t *appdata Line 278  void gconf_load_state(appdata_t *appdata
278            /* restoring the gpx file failed, mark it as unusable, but save */            /* restoring the gpx file failed, mark it as unusable, but save */
279            /* its presence for later use */            /* its presence for later use */
280    
281            /* create fake entry to remember this file for next load attempt */            /* create "closed" entry to remember this file for next */
282              /* load attempt */
283            *gpx = g_new0(gpx_t, 1);            *gpx = g_new0(gpx_t, 1);
284            (*gpx)->filename = fname;            (*gpx)->filename = fname;
285            (*gpx)->failed = TRUE;            char *p = fname;
286              if(strrchr(fname, '/'))
287                p = strrchr(fname, '/')+1;
288    
289              (*gpx)->name = g_strdup_printf(_("Failed to load: %s"), p);
290              (*gpx)->closed = TRUE;
291          } else          } else
292            free(fname);            free(fname);
293        }        }
294          gpx = &((*gpx)->next);
295      }      }
   
     gpx = &((*gpx)->next);  
296    }    }
297    
298    gpx_busy_dialog_destroy(dialog);    gpx_busy_dialog_destroy(dialog);
# Line 320  void gconf_load_state(appdata_t *appdata Line 366  void gconf_load_state(appdata_t *appdata
366      appdata->search = SEARCH_NAME | SEARCH_ID;      appdata->search = SEARCH_NAME | SEARCH_ID;
367    
368    if(!appdata->image_path) {    if(!appdata->image_path) {
369    #ifdef USE_MAEMO
370        /* update cachelist by default */
371        appdata->cachelist_update = TRUE;
372    #endif
373    
374      /* use gps by default */      /* use gps by default */
375      appdata->use_gps = TRUE;      appdata->use_gps = TRUE;

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