[rhythmbox] removable-media: provide list of device audio format descriptions
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] removable-media: provide list of device audio format descriptions
- Date: Thu, 11 Feb 2010 12:35:25 +0000 (UTC)
commit 0fdef566600dcc09d37694a85fdbb7a5737580d0
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Feb 11 21:53:38 2010 +1000
removable-media: provide list of device audio format descriptions
Uses gio's content type functions to translate mime-ish types to
human-friendly descriptions.
sources/rb-removable-media-source.c | 27 +++++++++++++++++++++++++++
sources/rb-removable-media-source.h | 2 +-
2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/sources/rb-removable-media-source.c b/sources/rb-removable-media-source.c
index d68b3d6..0178ff8 100644
--- a/sources/rb-removable-media-source.c
+++ b/sources/rb-removable-media-source.c
@@ -625,6 +625,33 @@ rb_removable_media_source_get_mime_types (RBRemovableMediaSource *source)
return NULL;
}
+GList *
+rb_removable_media_source_get_format_descriptions (RBRemovableMediaSource *source)
+{
+ GList *mime;
+ GList *desc = NULL;
+ GList *t;
+
+ mime = rb_removable_media_source_get_mime_types (source);
+ for (t = mime; t != NULL; t = t->next) {
+ const char *mimetype;
+ char *content_type;
+
+ mimetype = t->data;
+ content_type = g_content_type_from_mime_type (mimetype);
+ if (content_type != NULL) {
+ char *description;
+ description = g_content_type_get_description (content_type);
+ desc = g_list_append (desc, description);
+ } else {
+ desc = g_list_append (desc, g_strdup (mimetype));
+ }
+ }
+
+ rb_list_deep_free (mime);
+ return desc;
+}
+
gboolean
rb_removable_media_source_should_paste_no_duplicate (RBRemovableMediaSource *source,
RhythmDBEntry *entry)
diff --git a/sources/rb-removable-media-source.h b/sources/rb-removable-media-source.h
index b85a0b6..f3df474 100644
--- a/sources/rb-removable-media-source.h
+++ b/sources/rb-removable-media-source.h
@@ -87,12 +87,12 @@ void rb_removable_media_source_track_add_error (RBRemovableMediaSource *source,
const char *uri,
GError *error);
GList * rb_removable_media_source_get_mime_types (RBRemovableMediaSource *source);
+GList * rb_removable_media_source_get_format_descriptions (RBRemovableMediaSource *source);
gboolean rb_removable_media_source_should_paste (RBRemovableMediaSource *source,
RhythmDBEntry *entry);
gboolean rb_removable_media_source_should_paste_no_duplicate (RBRemovableMediaSource *source,
RhythmDBEntry *entry);
-
G_END_DECLS
#endif /* __RB_REMOVABLE_MEDIA_SOURCE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]