[PATCH 5/6] core: Replaced grl-media-audio defines with functions



---
 src/data/grl-media-audio.c |  130 ++++++++++++++++++++++++++++++++++++++++++++
 src/data/grl-media-audio.h |   54 +++++++------------
 2 files changed, 149 insertions(+), 35 deletions(-)

diff --git a/src/data/grl-media-audio.c b/src/data/grl-media-audio.c
index 3230a12..6568056 100644
--- a/src/data/grl-media-audio.c
+++ b/src/data/grl-media-audio.c
@@ -78,3 +78,133 @@ grl_media_audio_new (void)
   return GRL_MEDIA (g_object_new (GRL_TYPE_MEDIA_AUDIO,
                                   NULL));
 }
+
+/**
+ * grl_media_audio_set_artist:
+ * @data: the media instance
+ * @artist: the audio's artist
+ *
+ * Set the artist of the audio
+ */
+void
+grl_media_audio_set_artist (GrlMediaAudio *data, const gchar *artist)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_ARTIST,
+                       artist);
+}
+
+/**
+ * grl_media_audio_set_album:
+ * @data: the media instance
+ * @album: the audio's album
+ *
+ * Set the album of the audio
+ */
+void
+grl_media_audio_set_album (GrlMediaAudio *data, const gchar *album)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_ALBUM,
+                       album);
+}
+
+/**
+ * grl_media_audio_set_genre:
+ * @data: the media instance
+ * @genre: the audio's genre
+ *
+ * Set the genre of the audio
+ */
+void
+grl_media_audio_set_genre (GrlMediaAudio *data, const gchar *genre)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_GENRE,
+                       genre);
+}
+
+/**
+ * grl_media_audio_set_lyrics:
+ * @data: the media instance
+ * @lyrics: the audio's lyrics
+ *
+ * Set the lyrics of the audio
+ */
+void
+grl_media_audio_set_lyrics (GrlMediaAudio *data, const gchar *lyrics)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_LYRICS,
+                       lyrics);
+}
+
+/**
+ * grl_media_audio_set_bitrate:
+ * @data: the media instance
+ * @bitrate: the audio's bitrate
+ *
+ * Set the bitrate of the audio
+ */
+void
+grl_media_audio_set_bitrate (GrlMediaAudio *data, gint bitrate)
+{
+  grl_data_set_int (GRL_DATA (data), GRL_METADATA_KEY_BITRATE,
+                    bitrate);
+}
+
+/**
+ * grl_media_audio_get_artist:
+ * @data: the media instance
+ *
+ * Returns: (type utf8) (transfer none): the artist of the audio
+ */
+const gchar *
+grl_media_audio_get_artist (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_ARTIST);
+}
+
+/**
+ * grl_media_audio_get_album:
+ * @data: the media instance
+ *
+ * Returns: (type utf8) (transfer none): the album of the audio
+ */
+const gchar *
+grl_media_audio_get_album (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_ALBUM);
+}
+
+/**
+ * grl_media_audio_get_genre:
+ * @data: the media instance
+ *
+ * Returns: (type utf8) (transfer none): the genre of the audio
+ */
+const gchar *
+grl_media_audio_get_genre (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_GENRE);
+}
+
+/**
+ * grl_media_audio_get_lyrics:
+ * @data: the media instance
+ *
+ * Returns: (type utf8) (transfer none): the lyrics of the audio
+ */
+const gchar *
+grl_media_audio_get_lyrics (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_LYRICS);
+}
+
+/**
+ * grl_media_audio_get_bitrate:
+ * @data: the media instance
+ *
+ * Returns: the bitrate of the audio
+ */
+gint
+grl_media_audio_get_bitrate (GrlMediaAudio *data)
+{
+  return grl_data_get_int (GRL_DATA (data), GRL_METADATA_KEY_BITRATE);
+}
diff --git a/src/data/grl-media-audio.h b/src/data/grl-media-audio.h
index 7c172ae..500e011 100644
--- a/src/data/grl-media-audio.h
+++ b/src/data/grl-media-audio.h
@@ -73,41 +73,25 @@ struct _GrlMediaAudio
   GrlMedia parent;
 };
 
-#define grl_media_audio_set_artist(data, artist)        \
-  grl_data_set_string(GRL_DATA((data)),                 \
-                      GRL_METADATA_KEY_ARTIST,          \
-                      (artist))
-
-#define grl_media_audio_set_album(data, album)  \
-  grl_data_set_string(GRL_DATA((data)),         \
-                      GRL_METADATA_KEY_ALBUM,   \
-                      (album))
-
-#define grl_media_audio_set_genre(data, genre)  \
-  grl_data_set_string(GRL_DATA((data)),         \
-                      GRL_METADATA_KEY_GENRE,   \
-                      (genre))
-
-#define grl_media_audio_set_lyrics(data, lyrics)        \
-  grl_data_set_string(GRL_DATA((data)),                 \
-                      GRL_METADATA_KEY_LYRICS,          \
-                      (lyrics))
-
-#define grl_media_audio_set_bitrate(data, bitrate)      \
-  grl_data_set_int(GRL_DATA((data)),                    \
-                   GRL_METADATA_KEY_BITRATE,            \
-                   (bitrate))
-
-#define grl_media_audio_get_artist(data)                                \
-  grl_data_get_string(GRL_DATA((data)), GRL_METADATA_KEY_ARTIST)
-#define grl_media_audio_get_album(data)                         \
-  grl_data_get_string(GRL_DATA((data)), GRL_METADATA_KEY_ALBUM)
-#define grl_media_audio_get_genre(data)                         \
-  grl_data_get_string(GRL_DATA((data)), GRL_METADATA_KEY_GENRE)
-#define grl_media_audio_get_lyrics(data)                                \
-  grl_data_get_string(GRL_DATA((data)), GRL_METADATA_KEY_LYRICS)
-#define grl_media_audio_get_bitrate(data)                       \
-  grl_data_get_int(GRL_DATA((data)), GRL_METADATA_KEY_BITRATE)
+void grl_media_audio_set_artist (GrlMediaAudio *data, const gchar *artist);
+
+void grl_media_audio_set_album (GrlMediaAudio *data, const gchar *album);
+
+void grl_media_audio_set_genre (GrlMediaAudio *data, const gchar *genre);
+
+void grl_media_audio_set_lyrics (GrlMediaAudio *data, const gchar *lyrics);
+
+void grl_media_audio_set_bitrate (GrlMediaAudio *data, gint bitrate);
+
+const gchar *grl_media_audio_get_artist (GrlMediaAudio *data);
+
+const gchar *grl_media_audio_get_album (GrlMediaAudio *data);
+
+const gchar *grl_media_audio_get_genre (GrlMediaAudio *data);
+
+const gchar *grl_media_audio_get_lyrics (GrlMediaAudio *data);
+
+gint grl_media_audio_get_bitrate (GrlMediaAudio *data);
 
 GType grl_media_audio_get_type (void) G_GNUC_CONST;
 
-- 
1.7.0.4



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