ADG

Sign in or create your account | Project List | Help

ADG Commit Details

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
235235 * adg_point_unset:
236236 * @point: a pointer to an #AdgPoint
237237 *
238 * Unsets @point by resetting the internal "is_updated" flag.
238 * Unsets @point by resetting the internal "is_uptodate" flag.
239239 * This also means @point is unlinked from the model if it is
240240 * a named pair. In any cases, after this call the content of
241241 * @point is undefined, that is calling adg_point_get_pair()
242 * raises an error.
242 * will return %NULL.
243243 **/
244244void
245245adg_point_unset(AdgPoint *point)
...... 
252252        g_free(point->name);
253253    }
254254
255    /* Set the new named pair */
256255    point->is_uptodate = FALSE;
257256    point->model = NULL;
258257    point->name = NULL;
...... 
262261 * adg_point_get_pair:
263262 * @point: an #AdgPoint
264263 *
265 * #AdgPoint is an evolution of the pair concept, but internally the
264 * #AdgPoint is an evolution of the pair concept but internally the
266265 * 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).
269269 *
270 * Returns: the pair of @point
270 * Returns: the pair of @point or %NULL if the named pair does not exist
271271 **/
272272const AdgPair *
273273adg_point_get_pair(AdgPoint *point)
...... 
287287
288288        pair = adg_model_get_named_pair(point->model, point->name);
289289
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)
294292            return NULL;
295        }
296293
297294        cpml_pair_copy(&point->pair, pair);
298295        point->is_uptodate = TRUE;
299296

Archive Download the corresponding diff file