[totem] data: Export supported URI schemes in a header file



commit 06517d80cb6e1eb1a189b692d4e6fa6c43cf204c
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Aug 11 12:04:31 2011 +0200

    data: Export supported URI schemes in a header file

 data/Makefile.am           |   11 ++++++++---
 data/mime-type-include.sh  |    6 +++---
 data/uri-scheme-include.sh |   18 ++++++++++++++++++
 src/totem-object.c         |   31 +++++++++++++++++++++++++++++++
 src/totem.h                |    3 +++
 5 files changed, 63 insertions(+), 6 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index a4dc0d7..6dcab81 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -56,7 +56,7 @@ desktopdir = $(datadir)/applications
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
-totem.desktop.in: totem.desktop.in.in mime-type-list.txt desktop.sh
+totem.desktop.in: totem.desktop.in.in mime-type-list.txt uri-schemes-list.txt desktop.sh
 	$(AM_V_GEN) cat totem.desktop.in.in | sed 's,@FULL_LIBEXECDIR@,$(FULL_LIBEXECDIR),' > $@ &&\
 	$(SHELL) $(srcdir)/desktop.sh $(srcdir)/mime-type-list.txt $(srcdir)/uri-schemes-list.txt >> $@
 
@@ -82,20 +82,25 @@ CLEANFILES += \
 	$(thumbnailer_DATA)
 
 # Content type handling
-nodist_noinst_HEADERS = totem-mime-types.h nautilus-audio-mime-types.h
+nodist_noinst_HEADERS = totem-mime-types.h nautilus-audio-mime-types.h totem-uri-schemes.h
 totem-mime-types.h: mime-type-include.sh mime-type-list.txt mime-functions.sh
 	$(AM_V_GEN) $(srcdir)/mime-type-include.sh $(srcdir)/mime-type-list.txt	> $@
 nautilus-audio-mime-types.h: mime-type-include.sh mime-type-list.txt mime-functions.sh
 	$(AM_V_GEN) $(srcdir)/mime-type-include.sh --nautilus $(srcdir)/mime-type-list.txt > $@
+totem-uri-schemes.h: mime-type-include.sh mime-type-list.txt mime-functions.sh
+	$(AM_V_GEN) $(srcdir)/uri-scheme-include.sh $(srcdir)/uri-schemes-list.txt > $@
 
 EXTRA_DIST += \
 	mime-type-include.sh	\
 	mime-type-list.txt	\
+	uri-scheme-include.sh	\
 	uri-schemes-list.txt	\
 	mime-functions.sh
 CLEANFILES += \
 	totem-mime-types.h		\
-	nautilus-audio-mime-types.h
+	totem-uri-schemes.h		\
+	nautilus-audio-mime-types.h	\
+	totem-uri-schemes.h
 
 # GSettings schemas, enum files and conversion file
 gsettings_ENUM_NAMESPACE = org.gnome.totem
diff --git a/data/mime-type-include.sh b/data/mime-type-include.sh
index 3560839..e03c2a1 100755
--- a/data/mime-type-include.sh
+++ b/data/mime-type-include.sh
@@ -25,7 +25,7 @@ fi
 MIMETYPES=`grep -v '^#' $1 | grep -v x-content/ | grep -v x-scheme-handler/`
 
 echo "/* generated with mime-types-include.sh, don't edit */"
-echo "const char *mime_types[] = {"
+echo "static const gchar *mime_types[] = {"
 
 for i in $MIMETYPES ; do
 	echo_mime;
@@ -35,7 +35,7 @@ echo "};"
 
 get_audio_mimetypes $1;
 
-echo "const char *audio_mime_types[] = {"
+echo "static const gchar *audio_mime_types[] = {"
 for i in $MIMETYPES ; do
 	echo_mime;
 done
@@ -44,7 +44,7 @@ echo "};"
 
 get_video_mimetypes $1;
 
-echo "const char *video_mime_types[] = {"
+echo "static const gchar *video_mime_types[] = {"
 for i in $MIMETYPES ; do
 	echo_mime;
 done
diff --git a/data/uri-scheme-include.sh b/data/uri-scheme-include.sh
new file mode 100755
index 0000000..645b139
--- /dev/null
+++ b/data/uri-scheme-include.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. `dirname $0`/mime-functions.sh
+
+echo_mime () {
+	echo "\"$i\","
+}
+
+SCHEMES=`grep -v '^#' $1`
+
+echo "/* generated with uri-scheme-include.sh, don't edit */"
+echo "static const gchar *uri_schemes[] = {"
+
+for i in $SCHEMES ; do
+	echo_mime;
+done
+
+echo "};"
diff --git a/src/totem-object.c b/src/totem-object.c
index f91fe67..7cbeac5 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -70,6 +70,9 @@
 #include "totem-dnd-menu.h"
 #include "totem-preferences.h"
 
+#include "totem-mime-types.h"
+#include "totem-uri-schemes.h"
+
 #define REWIND_OR_PREVIOUS 4000
 
 #define SEEK_FORWARD_SHORT_OFFSET 15
@@ -4299,3 +4302,31 @@ video_widget_create (TotemObject *totem)
 			G_CALLBACK (property_notify_cb_seekable), totem);
 	update_volume_sliders (totem);
 }
+
+/**
+ * totem_object_get_supported_content_types:
+ *
+ * Get the full list of file content types which Totem supports playing.
+ *
+ * Return value: (array zero-terminated=1) (transfer none): a %NULL-terminated array of the content types Totem supports
+ * Since: 3.1.5
+ */
+const gchar * const *
+totem_object_get_supported_content_types (void)
+{
+	return mime_types;
+}
+
+/**
+ * totem_object_get_supported_uri_schemes:
+ *
+ * Get the full list of URI schemes which Totem supports accessing.
+ *
+ * Return value: (array zero-terminated=1) (transfer none): a %NULL-terminated array of the URI schemes Totem supports
+ * Since: 3.1.5
+ */
+const gchar * const *
+totem_object_get_supported_uri_schemes (void)
+{
+	return uri_schemes;
+}
diff --git a/src/totem.h b/src/totem.h
index 4a24fa0..6294781 100644
--- a/src/totem.h
+++ b/src/totem.h
@@ -304,4 +304,7 @@ void	totem_object_action_remote_set_setting	(TotemObject *totem,
 gboolean totem_object_action_remote_get_setting	(TotemObject *totem,
 						 TotemRemoteSetting setting);
 
+const gchar * const *totem_object_get_supported_content_types (void);
+const gchar * const *totem_object_get_supported_uri_schemes (void);
+
 #endif /* __TOTEM_H__ */



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