[PATCH 4/6] core: Replaced grl-media-image defines with functions



---
 src/data/grl-media-image.c |   62 ++++++++++++++++++++++++++++++++++++++++++++
 src/data/grl-media-image.h |   21 +++++----------
 2 files changed, 69 insertions(+), 14 deletions(-)

diff --git a/src/data/grl-media-image.c b/src/data/grl-media-image.c
index df5c63a..9881bde 100644
--- a/src/data/grl-media-image.c
+++ b/src/data/grl-media-image.c
@@ -79,6 +79,14 @@ grl_media_image_new (void)
                                   NULL));
 }
 
+/**
+ * grl_media_image_set_size:
+ * @image: the image instance
+ * @width: the image's width
+ * @height: the image's height
+ *
+ * Set the size of the image
+ */
 void
 grl_media_image_set_size (GrlMediaImage *image,
                           gint width,
@@ -87,3 +95,57 @@ grl_media_image_set_size (GrlMediaImage *image,
   grl_media_image_set_width (image, width);
   grl_media_image_set_height (image, height);
 }
+
+/**
+ * grl_media_image_set_width:
+ * @data: the image instance
+ * @width: the image's width
+ *
+ * Set the width of the image
+ */
+void
+grl_media_image_set_width (GrlMediaImage *data, gint width)
+{
+  grl_data_set_int (GRL_DATA (data),
+                    GRL_METADATA_KEY_WIDTH,
+                    width);
+}
+
+/**
+ * grl_media_image_set_height:
+ * @data: the image instance
+ * @height: the image's height
+ *
+ * Set the height of the image
+ */
+void
+grl_media_image_set_height (GrlMediaImage *data, gint height)
+{
+  grl_data_set_int (GRL_DATA (data),
+                    GRL_METADATA_KEY_HEIGHT,
+                    height);
+}
+
+/**
+ * grl_media_image_get_width:
+ * @data: The image instance
+ *
+ * Return: the width of the image
+ */
+gint
+grl_media_image_get_width (GrlMediaImage *data)
+{
+  return grl_data_get_int (GRL_DATA (data), GRL_METADATA_KEY_WIDTH);
+}
+
+/**
+ * grl_media_image_get_height:
+ * @data: the image instance
+ *
+ * Return: the height of the image
+ */
+gint
+grl_media_image_get_height (GrlMediaImage *data)
+{
+  return grl_data_get_int (GRL_DATA (data), GRL_METADATA_KEY_HEIGHT);
+}
diff --git a/src/data/grl-media-image.h b/src/data/grl-media-image.h
index a774688..5e990f4 100644
--- a/src/data/grl-media-image.h
+++ b/src/data/grl-media-image.h
@@ -73,20 +73,13 @@ struct _GrlMediaImage
   GrlMedia parent;
 };
 
-#define grl_media_image_set_width(data, width)  \
-  grl_data_set_int(GRL_DATA((data)),            \
-                   GRL_METADATA_KEY_WIDTH,      \
-                   (width))
-
-#define grl_media_image_set_height(data, height)        \
-  grl_data_set_int(GRL_DATA((data)),                    \
-                   GRL_METADATA_KEY_HEIGHT,             \
-                   (height))
-
-#define grl_media_image_get_width(data)                         \
-  grl_data_get_int(GRL_DATA((data)), GRL_METADATA_KEY_WIDTH)
-#define grl_media_image_get_height(data)                        \
-  grl_data_get_int(GRL_DATA((data)), GRL_METADATA_KEY_HEIGHT)
+void grl_media_image_set_width (GrlMediaImage *data, gint width);
+
+void grl_media_image_set_height (GrlMediaImage *data, gint height);
+
+gint grl_media_image_get_width (GrlMediaImage *data);
+
+gint grl_media_image_get_height (GrlMediaImage *data);
 
 GType grl_media_image_get_type (void) G_GNUC_CONST;
 GrlMedia *grl_media_image_new (void);
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]