Diff of /trunk/src/gconf.c

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

revision 74 by harbaum, Mon Aug 24 09:23:36 2009 UTC revision 167 by harbaum, Mon Nov 9 07:50:37 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      { "disable_gcvote",   STORE_BOOL,   OFFSET(disable_gcvote) },
83  #ifdef USE_MAEMO  #ifdef USE_MAEMO
84    { "mmpoi_dontlaunch", STORE_BOOL,   OFFSET(mmpoi_dontlaunch) },    { "mmpoi_dontlaunch", STORE_BOOL,   OFFSET(mmpoi_dontlaunch) },
85    { "cachelist_dss",    STORE_BOOL,   OFFSET(cachelist_disable_screensaver) },    { "cachelist_dss",    STORE_BOOL,   OFFSET(cachelist_disable_screensaver) },
86    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },    { "goto_dss",         STORE_BOOL,   OFFSET(goto_disable_screensaver) },
   { "cachelist_update", STORE_BOOL,   OFFSET(cachelist_update) },  
87  #endif  #endif
88  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
89    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },    { "map_lat",          STORE_FLOAT,  OFFSET(map.pos.lat) },
90    { "map_lon",          STORE_FLOAT,  OFFSET(map.pos.lon) },    { "map_lon",          STORE_FLOAT,  OFFSET(map.pos.lon) },
91    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },
92      { "map_source",       STORE_INT,    OFFSET(map.source) },
93  #endif  #endif
94    { NULL, -1, -1 }    { NULL, -1, -1 }
95  };  };
# Line 131  char *gconf_restore_closed_name(appdata_ Line 133  char *gconf_restore_closed_name(appdata_
133  void gconf_save_state(appdata_t *appdata) {  void gconf_save_state(appdata_t *appdata) {
134    int entries = 0;    int entries = 0;
135    
136      /* free proxy settings */
137      if(appdata->proxy) {
138        proxy_t *proxy = appdata->proxy;
139    
140        if(proxy->authentication_password) g_free(proxy->authentication_password);
141        if(proxy->authentication_user)     g_free(proxy->authentication_user);
142        if(proxy->host)                    g_free(proxy->host);
143        if(proxy->ignore_hosts)            g_free(proxy->ignore_hosts);
144    
145        g_free(proxy);
146        appdata->proxy = NULL;
147      }
148    
149    gpx_t *gpx = appdata->gpx;    gpx_t *gpx = appdata->gpx;
150    while(gpx) {    while(gpx) {
151      char str[128];      char str[128];
# Line 206  void gconf_load_state(appdata_t *appdata Line 221  void gconf_load_state(appdata_t *appdata
221    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;
222    appdata->gps.lat = appdata->gps.lon = NAN;    appdata->gps.lat = appdata->gps.lon = NAN;
223    
224      /* ------------- get proxy settings -------------------- */
225      if(gconf_client_get_bool(appdata->gconf_client,
226                               PROXY_KEY "use_http_proxy", NULL)) {
227        proxy_t *proxy = appdata->proxy = g_new0(proxy_t, 1);
228    
229        /* get basic settings */
230        proxy->host = gconf_client_get_string(appdata->gconf_client,
231                                              PROXY_KEY "host", NULL);
232        proxy->port = gconf_client_get_int(appdata->gconf_client,
233                                           PROXY_KEY "port", NULL);
234        proxy->ignore_hosts =
235          gconf_client_get_string(appdata->gconf_client,
236                                  PROXY_KEY "ignore_hosts", NULL);
237    
238        /* check for authentication */
239        proxy->use_authentication =
240          gconf_client_get_bool(appdata->gconf_client,
241                                PROXY_KEY "use_authentication", NULL);
242    
243        if(proxy->use_authentication) {
244          proxy->authentication_user =
245            gconf_client_get_string(appdata->gconf_client,
246                                    PROXY_KEY "authentication_user", NULL);
247          proxy->authentication_password =
248            gconf_client_get_string(appdata->gconf_client,
249                                    PROXY_KEY "authentication_password", NULL);
250        }
251      }
252    
253    int i, entries = gconf_client_get_int(appdata->gconf_client,    int i, entries = gconf_client_get_int(appdata->gconf_client,
254                                   GCONF_KEY_CNT, NULL);                                   GCONF_KEY_CNT, NULL);
255    
# Line 216  void gconf_load_state(appdata_t *appdata Line 260  void gconf_load_state(appdata_t *appdata
260      char str[128];      char str[128];
261      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);
262      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);
   
263      if(fname) {      if(fname) {
264        /* check if there's a valid name stored for this file. */        /* check if there's a valid name stored for this file. */
265        /* if yes it's a "closed" file */        /* if yes it's a "closed" file */
# Line 236  void gconf_load_state(appdata_t *appdata Line 279  void gconf_load_state(appdata_t *appdata
279            /* restoring the gpx file failed, mark it as unusable, but save */            /* restoring the gpx file failed, mark it as unusable, but save */
280            /* its presence for later use */            /* its presence for later use */
281    
282            /* create fake entry to remember this file for next load attempt */            /* create "closed" entry to remember this file for next */
283              /* load attempt */
284            *gpx = g_new0(gpx_t, 1);            *gpx = g_new0(gpx_t, 1);
285            (*gpx)->filename = fname;            (*gpx)->filename = fname;
286            (*gpx)->failed = TRUE;            char *p = fname;
287              if(strrchr(fname, '/'))
288                p = strrchr(fname, '/')+1;
289    
290              (*gpx)->name = g_strdup_printf(_("Failed to load: %s"), p);
291              (*gpx)->closed = TRUE;
292          } else          } else
293            free(fname);            free(fname);
294        }        }
295          gpx = &((*gpx)->next);
296      }      }
   
     gpx = &((*gpx)->next);  
297    }    }
298    
299    gpx_busy_dialog_destroy(dialog);    gpx_busy_dialog_destroy(dialog);
# Line 319  void gconf_load_state(appdata_t *appdata Line 367  void gconf_load_state(appdata_t *appdata
367      appdata->search = SEARCH_NAME | SEARCH_ID;      appdata->search = SEARCH_NAME | SEARCH_ID;
368    
369    if(!appdata->image_path) {    if(!appdata->image_path) {
370    #ifdef USE_MAEMO
371        /* update cachelist by default */
372        appdata->cachelist_update = TRUE;
373    #endif
374    
375      /* use gps by default */      /* use gps by default */
376      appdata->use_gps = TRUE;      appdata->use_gps = TRUE;

Legend:
Removed from v.74  
changed lines
  Added in v.167