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 197 by harbaum, Thu Nov 19 07:43:24 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) },
# Line 90  static store_t store[] = { Line 91  static store_t store[] = {
91    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },    { "map_zoom",         STORE_INT,    OFFSET(map.zoom) },
92    { "map_source",       STORE_INT,    OFFSET(map.source) },    { "map_source",       STORE_INT,    OFFSET(map.source) },
93  #endif  #endif
94    
95      { "geotoad/username", STORE_STRING, OFFSET(gt.username) },
96      { "geotoad/password", STORE_STRING, OFFSET(gt.password) },
97      { "geotoad/filename", STORE_STRING, OFFSET(gt.filename) },
98      { "geotoad/distance", STORE_FLOAT,  OFFSET(gt.distance) },
99      { "geotoad/lat",      STORE_FLOAT,  OFFSET(gt.lat) },
100      { "geotoad/lon",      STORE_FLOAT,  OFFSET(gt.lon) },
101      { "geotoad/flags",    STORE_INT,    OFFSET(gt.flags) },
102    
103    { NULL, -1, -1 }    { NULL, -1, -1 }
104  };  };
105    
# Line 132  char *gconf_restore_closed_name(appdata_ Line 142  char *gconf_restore_closed_name(appdata_
142  void gconf_save_state(appdata_t *appdata) {  void gconf_save_state(appdata_t *appdata) {
143    int entries = 0;    int entries = 0;
144    
145      /* free proxy settings */
146      if(appdata->proxy) {
147        proxy_t *proxy = appdata->proxy;
148    
149        if(proxy->authentication_password) g_free(proxy->authentication_password);
150        if(proxy->authentication_user)     g_free(proxy->authentication_user);
151        if(proxy->host)                    g_free(proxy->host);
152        if(proxy->ignore_hosts)            g_free(proxy->ignore_hosts);
153    
154        g_free(proxy);
155        appdata->proxy = NULL;
156      }
157    
158    gpx_t *gpx = appdata->gpx;    gpx_t *gpx = appdata->gpx;
159    while(gpx) {    while(gpx) {
160      char str[128];      char str[128];
# Line 170  void gconf_save_state(appdata_t *appdata Line 193  void gconf_save_state(appdata_t *appdata
193        if((char*)(*ptr)) {        if((char*)(*ptr)) {
194          gconf_client_set_string(appdata->gconf_client, key, (char*)(*ptr), NULL);          gconf_client_set_string(appdata->gconf_client, key, (char*)(*ptr), NULL);
195        }        }
196          g_free((char*)(*ptr));
197          *ptr = NULL;
198        break;        break;
199    
200      case STORE_BOOL:      case STORE_BOOL:
# Line 207  void gconf_load_state(appdata_t *appdata Line 232  void gconf_load_state(appdata_t *appdata
232    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;    appdata->manual_goto.lat = appdata->manual_goto.lon = NAN;
233    appdata->gps.lat = appdata->gps.lon = NAN;    appdata->gps.lat = appdata->gps.lon = NAN;
234    
235      appdata->gt.lat = appdata->gt.lon = NAN;
236      appdata->gt.distance = 1.0;
237    
238      /* ------------- get proxy settings -------------------- */
239      if(gconf_client_get_bool(appdata->gconf_client,
240                               PROXY_KEY "use_http_proxy", NULL)) {
241        proxy_t *proxy = appdata->proxy = g_new0(proxy_t, 1);
242    
243        /* get basic settings */
244        proxy->host = gconf_client_get_string(appdata->gconf_client,
245                                              PROXY_KEY "host", NULL);
246        proxy->port = gconf_client_get_int(appdata->gconf_client,
247                                           PROXY_KEY "port", NULL);
248        proxy->ignore_hosts =
249          gconf_client_get_string(appdata->gconf_client,
250                                  PROXY_KEY "ignore_hosts", NULL);
251    
252        /* check for authentication */
253        proxy->use_authentication =
254          gconf_client_get_bool(appdata->gconf_client,
255                                PROXY_KEY "use_authentication", NULL);
256    
257        if(proxy->use_authentication) {
258          proxy->authentication_user =
259            gconf_client_get_string(appdata->gconf_client,
260                                    PROXY_KEY "authentication_user", NULL);
261          proxy->authentication_password =
262            gconf_client_get_string(appdata->gconf_client,
263                                    PROXY_KEY "authentication_password", NULL);
264        }
265      }
266    
267    int i, entries = gconf_client_get_int(appdata->gconf_client,    int i, entries = gconf_client_get_int(appdata->gconf_client,
268                                   GCONF_KEY_CNT, NULL);                                   GCONF_KEY_CNT, NULL);
269    
# Line 217  void gconf_load_state(appdata_t *appdata Line 274  void gconf_load_state(appdata_t *appdata
274      char str[128];      char str[128];
275      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);      snprintf(str, sizeof(str), GCONF_KEY_GPX, i);
276      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);      char *fname = gconf_client_get_string(appdata->gconf_client, str, NULL);
   
277      if(fname) {      if(fname) {
278        /* check if there's a valid name stored for this file. */        /* check if there's a valid name stored for this file. */
279        /* if yes it's a "closed" file */        /* if yes it's a "closed" file */
# Line 237  void gconf_load_state(appdata_t *appdata Line 293  void gconf_load_state(appdata_t *appdata
293            /* restoring the gpx file failed, mark it as unusable, but save */            /* restoring the gpx file failed, mark it as unusable, but save */
294            /* its presence for later use */            /* its presence for later use */
295    
296            /* create fake entry to remember this file for next load attempt */            /* create "closed" entry to remember this file for next */
297              /* load attempt */
298            *gpx = g_new0(gpx_t, 1);            *gpx = g_new0(gpx_t, 1);
299            (*gpx)->filename = fname;            (*gpx)->filename = fname;
300            (*gpx)->failed = TRUE;            char *p = fname;
301              if(strrchr(fname, '/'))
302                p = strrchr(fname, '/')+1;
303    
304              (*gpx)->name = g_strdup_printf(_("Failed to load: %s"), p);
305              (*gpx)->closed = TRUE;
306          } else          } else
307            free(fname);            free(fname);
308        }        }
309          gpx = &((*gpx)->next);
310      }      }
   
     gpx = &((*gpx)->next);  
311    }    }
312    
313    gpx_busy_dialog_destroy(dialog);    gpx_busy_dialog_destroy(dialog);
# Line 320  void gconf_load_state(appdata_t *appdata Line 381  void gconf_load_state(appdata_t *appdata
381      appdata->search = SEARCH_NAME | SEARCH_ID;      appdata->search = SEARCH_NAME | SEARCH_ID;
382    
383    if(!appdata->image_path) {    if(!appdata->image_path) {
384    #ifdef USE_MAEMO
385        /* update cachelist by default */
386        appdata->cachelist_update = TRUE;
387    #endif
388    
389      /* use gps by default */      /* use gps by default */
390      appdata->use_gps = TRUE;      appdata->use_gps = TRUE;

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