| Date: | 2010-07-02 22:20:26 (2 months 8 days ago) |
|---|---|
| Author: | Nicola Fontana |
| Commit: | 74c861cb3f2e2521f9529939a19a34522de92a89 |
| Message: | [AdgPoint] Do not raise warnings on adg_point_get_pair() Avoid warning messages if the subject point is a named pair and the name is not defined in the model. This is the first step to allow the implementation of _optional_ entities that automatically disappear when all the points needed are not fully defined. Started issue #44: http://dev.entidi.com/p/adg/issues/44/ |
| Files: |
src/adg/adg-point.c (4 diffs) |
Change Details
| src/adg/adg-point.c | ||
|---|---|---|
| 235 | 235 | * adg_point_unset: |
| 236 | 236 | * @point: a pointer to an #AdgPoint |
| 237 | 237 | * |
| 238 | * Unsets @point by resetting the internal "is_updated" flag. | |
| 238 | * Unsets @point by resetting the internal "is_uptodate" flag. | |
| 239 | 239 | * This also means @point is unlinked from the model if it is |
| 240 | 240 | * a named pair. In any cases, after this call the content of |
| 241 | 241 | * @point is undefined, that is calling adg_point_get_pair() |
| 242 | * raises an error. | |
| 242 | * will return %NULL. | |
| 243 | 243 | **/ |
| 244 | 244 | void |
| 245 | 245 | adg_point_unset(AdgPoint *point) |
| ... | ... | |
| 252 | 252 | g_free(point->name); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | /* Set the new named pair */ | |
| 256 | 255 | point->is_uptodate = FALSE; |
| 257 | 256 | point->model = NULL; |
| 258 | 257 | point->name = NULL; |
| ... | ... | |
| 262 | 261 | * adg_point_get_pair: |
| 263 | 262 | * @point: an #AdgPoint |
| 264 | 263 | * |
| 265 | * #AdgPoint is an evolution of the pair concept, but internally the | |
| 264 | * #AdgPoint is an evolution of the pair concept but internally the | |
| 266 | 265 | * relevant data is still stored in an #AdgPair struct. This function |
| 267 | * gets this struct, updating the internal value from the linked | |
| 268 | * named pair if needed. | |
| 266 | * gets the pointer to this struct, updating the value prior to | |
| 267 | * return it if needed (that is, if @point is linked to a not up | |
| 268 | * to date named pair). | |
| 269 | 269 | * |
| 270 | * Returns: the pair of @point | |
| 270 | * Returns: the pair of @point or %NULL if the named pair does not exist | |
| 271 | 271 | **/ |
| 272 | 272 | const AdgPair * |
| 273 | 273 | adg_point_get_pair(AdgPoint *point) |
| ... | ... | |
| 287 | 287 | |
| 288 | 288 | pair = adg_model_get_named_pair(point->model, point->name); |
| 289 | 289 | |
| 290 | if (pair == NULL) { | |
| 291 | g_warning(_("%s: `%s' named pair not found in `%s' model instance"), | |
| 292 | G_STRLOC, point->name, | |
| 293 | g_type_name(G_TYPE_FROM_INSTANCE(point->model))); | |
| 290 | /* "Named pair not found" condition: return NULL without warnings */ | |
| 291 | if (pair == NULL) | |
| 294 | 292 | return NULL; |
| 295 | } | |
| 296 | 293 | |
| 297 | 294 | cpml_pair_copy(&point->pair, pair); |
| 298 | 295 | point->is_uptodate = TRUE; |
| 299 | 296 | |
