[PATCH 05/13] core: Replaced grl-media-audio defines with functions



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

diff --git a/src/data/grl-media-audio.c b/src/data/grl-media-audio.c
index 3230a12..c7e3481 100644
--- a/src/data/grl-media-audio.c
+++ b/src/data/grl-media-audio.c
@@ -78,3 +78,68 @@ grl_media_audio_new (void)
   return GRL_MEDIA (g_object_new (GRL_TYPE_MEDIA_AUDIO,
                                   NULL));
 }
+
+void
+grl_media_audio_set_artist (GrlMediaAudio *data, const gchar *artist)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_ARTIST,
+                       artist);
+}
+
+void
+grl_media_audio_set_album (GrlMediaAudio *data, const gchar *album)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_ALBUM,
+                       album);
+}
+
+void
+grl_media_audio_set_genre (GrlMediaAudio *data, const gchar *genre)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_GENRE,
+                       genre);
+}
+
+void
+grl_media_audio_set_lyrics (GrlMediaAudio *data, const gchar *lyrics)
+{
+  grl_data_set_string (GRL_DATA (data), GRL_METADATA_KEY_LYRICS,
+                       lyrics);
+}
+
+void
+grl_media_audio_set_bitrate (GrlMediaAudio *data, gint bitrate)
+{
+  grl_data_set_int (GRL_DATA (data), GRL_METADATA_KEY_BITRATE,
+                    bitrate);
+}
+
+const gchar *
+grl_media_audio_get_artist (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_ARTIST);
+}
+
+const gchar *
+grl_media_audio_get_album (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_ALBUM);
+}
+
+const gchar *
+grl_media_audio_get_genre (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_GENRE);
+}
+
+const gchar *
+grl_media_audio_get_lyrics (GrlMediaAudio *data)
+{
+  return grl_data_get_string (GRL_DATA (data), GRL_METADATA_KEY_LYRICS);
+}
+
+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]