[glide] API guards for GlideSlide
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] API guards for GlideSlide
- Date: Fri, 7 May 2010 17:32:12 +0000 (UTC)
commit ea3dec5f86dc338a9b4c787793ccea4e056cf8eb
Author: Robert Carr <racarr Valentine localdomain>
Date: Fri May 7 13:30:24 2010 -0400
API guards for GlideSlide
libglide/glide-slide.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/libglide/glide-slide.c b/libglide/glide-slide.c
index 69beb93..de9bb1d 100644
--- a/libglide/glide-slide.c
+++ b/libglide/glide-slide.c
@@ -669,6 +669,9 @@ glide_slide_init (GlideSlide *self)
void
glide_slide_add_actor_content (GlideSlide *slide, ClutterActor *actor)
{
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
+ g_return_if_fail (CLUTTER_IS_ACTOR (actor));
+
clutter_container_add_actor (CLUTTER_CONTAINER (slide->priv->contents_group), actor);
}
@@ -678,11 +681,12 @@ glide_slide_add_actor_content (GlideSlide *slide, ClutterActor *actor)
*
* Constructs a new slide, belonging to @document.
*
- * Return value: The newly allocated #GlideSlide
+ * Return value: The newly allocated #GlideSlide.
*/
GlideSlide*
glide_slide_new (GlideDocument *document)
{
+ g_return_val_if_fail (GLIDE_IS_DOCUMENT (document), NULL);
return g_object_new (GLIDE_TYPE_SLIDE,
"document", document,
NULL);
@@ -707,6 +711,9 @@ glide_slide_construct_from_json (GlideSlide *slide, JsonObject *slide_obj, Glide
GlideAnimationInfo info;
ClutterColor c;
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
+ g_return_if_fail (GLIDE_IS_STAGE_MANAGER (manager));
+
actors_n = json_object_get_member (slide_obj, "actors");
actors = json_node_get_array (actors_n);
@@ -773,6 +780,8 @@ glide_slide_set_background (GlideSlide *slide, const gchar *background)
{
gchar *resource, *resource_file;
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
+
if (slide->priv->background)
g_free (slide->priv->background);
if (slide->priv->background_material)
@@ -809,6 +818,7 @@ glide_slide_set_background (GlideSlide *slide, const gchar *background)
const gchar *
glide_slide_get_background (GlideSlide *slide)
{
+ g_return_val_if_fail (GLIDE_IS_SLIDE (slide), NULL);
return slide->priv->background;
}
@@ -824,6 +834,7 @@ glide_slide_get_background (GlideSlide *slide)
void
glide_slide_set_animation (GlideSlide *slide, const GlideAnimationInfo *info)
{
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
if (slide->priv->animation)
glide_animation_info_free (slide->priv->animation);
@@ -842,6 +853,7 @@ glide_slide_set_animation (GlideSlide *slide, const GlideAnimationInfo *info)
GlideAnimationInfo *
glide_slide_get_animation (GlideSlide *slide)
{
+ g_return_val_if_fail (GLIDE_IS_SLIDE (slide), NULL);
return slide->priv->animation;
}
@@ -858,6 +870,7 @@ glide_slide_get_animation (GlideSlide *slide)
ClutterActor *
glide_slide_get_contents (GlideSlide *slide)
{
+ g_return_val_if_fail (GLIDE_IS_SLIDE (slide), NULL);
return slide->priv->contents_group;
}
@@ -872,6 +885,7 @@ glide_slide_get_contents (GlideSlide *slide)
void
glide_slide_set_color (GlideSlide *slide, const ClutterColor *color)
{
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
slide->priv->color = *color;
g_object_notify (G_OBJECT (slide), "color");
@@ -889,6 +903,7 @@ glide_slide_set_color (GlideSlide *slide, const ClutterColor *color)
void
glide_slide_get_color (GlideSlide *slide, ClutterColor *color)
{
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
*color = slide->priv->color;
}
@@ -907,6 +922,9 @@ glide_slide_resize (GlideSlide *slide, gfloat width, gfloat height)
GList *a;
gfloat old_width, old_height, rx, ry;
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
+ g_return_if_fail ((width > 0) && (height > 0));
+
clutter_actor_get_size (CLUTTER_ACTOR (slide), &old_width, &old_height);
rx = width/old_width;
@@ -957,6 +975,7 @@ glide_slide_resize (GlideSlide *slide, gfloat width, gfloat height)
guint
glide_slide_get_index (GlideSlide *slide)
{
+ g_return_val_if_fail (GLIDE_IS_SLIDE (slide), 0);
return slide->priv->index;
}
@@ -970,6 +989,8 @@ glide_slide_get_index (GlideSlide *slide)
void
glide_slide_set_index (GlideSlide *slide, guint index)
{
+ g_return_if_fail (GLIDE_IS_SLIDE (slide));
+
slide->priv->index = index;
g_object_notify (G_OBJECT (slide), "index");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]