summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2007-05-14 13:34:03 +0000
committerBastien Nocera <hadess@src.gnome.org>2007-05-14 13:34:03 +0000
commit76d8979acc9f03a88922e4df77c0b8f1b1bbff52 (patch)
tree07b661e6dafce21157e8068e06160e98c43f408d
parente83c17d20edede4085f4231c0562cf89fbc541e8 (diff)
downloadtotem-76d8979acc9f03a88922e4df77c0b8f1b1bbff52.tar.gz
upd
2007-05-14 Bastien Nocera <hadess@hadess.net> * README: upd * browser-plugin/Makefile.am: * browser-plugin/README: move to... * browser-plugin/README.browser-plugin: ...this file, and add details on how to disable specific mime-types * browser-plugin/totemPluginGlue.cpp: Allow to disable specific mime-types, using a .ini style file, as documented in README.browser-plugin (Closes: #401079) svn path=/trunk/; revision=4303
-rw-r--r--ChangeLog12
-rw-r--r--README2
-rw-r--r--browser-plugin/Makefile.am5
-rw-r--r--browser-plugin/README.browser-plugin (renamed from browser-plugin/README)21
-rw-r--r--browser-plugin/totemPluginGlue.cpp73
5 files changed, 112 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f6af640f8..6946184f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-14 Bastien Nocera <hadess@hadess.net>
+
+ * README: upd
+ * browser-plugin/Makefile.am:
+ * browser-plugin/README: move to...
+ * browser-plugin/README.browser-plugin: ...this file,
+ and add details on how to disable specific mime-types
+ * browser-plugin/totemPluginGlue.cpp:
+ Allow to disable specific mime-types, using a .ini style
+ file, as documented in README.browser-plugin
+ (Closes: #401079)
+
2007-05-13 Bastien Nocera <hadess@hadess.net>
* license_change:
diff --git a/README b/README
index 17910869a..fc6b4a672 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@ See NEWS file
Dependencies
============
-xine-lib 1.0 rc7 or newer:
+xine-lib 1.1.7 or newer:
http://xinehq.de
or
GStreamer 0.10.6, and gstreamer-plugins-base 0.10.7
diff --git a/browser-plugin/Makefile.am b/browser-plugin/Makefile.am
index 95162aa61..a7a0627fa 100644
--- a/browser-plugin/Makefile.am
+++ b/browser-plugin/Makefile.am
@@ -137,6 +137,7 @@ libtotem_basic_plugin_la_CPPFLAGS = \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGCONF_PREFIX="\"/apps/totem\"" \
+ -DSYSCONFDIR="\"$(sysconfdir)\"" \
-DDATADIR="\"$(pkgdatadir)\"" \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DBINDIR="\"$(bindir)\"" \
@@ -205,6 +206,7 @@ libtotem_gmp_plugin_la_CPPFLAGS = \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGCONF_PREFIX="\"/apps/totem\"" \
+ -DSYSCONFDIR="\"$(sysconfdir)\"" \
-DDATADIR="\"$(pkgdatadir)\"" \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DBINDIR="\"$(bindir)\"" \
@@ -267,6 +269,7 @@ libtotem_complex_plugin_la_CPPFLAGS = \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGCONF_PREFIX="\"/apps/totem\"" \
+ -DSYSCONFDIR="\"$(sysconfdir)\"" \
-DDATADIR="\"$(pkgdatadir)\"" \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DBINDIR="\"$(bindir)\"" \
@@ -329,6 +332,7 @@ libtotem_narrowspace_plugin_la_CPPFLAGS = \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGCONF_PREFIX="\"/apps/totem\"" \
+ -DSYSCONFDIR="\"$(sysconfdir)\"" \
-DDATADIR="\"$(pkgdatadir)\"" \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DBINDIR="\"$(bindir)\"" \
@@ -391,6 +395,7 @@ libtotem_mully_plugin_la_CPPFLAGS = \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGCONF_PREFIX="\"/apps/totem\"" \
+ -DSYSCONFDIR="\"$(sysconfdir)\"" \
-DDATADIR="\"$(pkgdatadir)\"" \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DBINDIR="\"$(bindir)\"" \
diff --git a/browser-plugin/README b/browser-plugin/README.browser-plugin
index 26abf0692..a3b058a18 100644
--- a/browser-plugin/README
+++ b/browser-plugin/README.browser-plugin
@@ -19,6 +19,27 @@ export MOZ_PLUGIN_PATH=`pwd`
- Mozilla/Gecko/Firefox envar to lookup the browser plugins in the current
directory
+Disabling specific mime-types
+=============================
+
+This can be achieved using 2 files. They are:
+/etc/totem/browser-plugins.ini ($(sysconfdir)/totem/browser-plugins.ini)
+and
+~/.gnome2/Totem/browser-plugins.ini
+
+The format is:
+[Plugins]
+[mimetype].disable=true/false
+
+For example, to disable all the mime-types in the Complex plugin:
+[Plugins]
+audio/x-pn-realaudio-plugin.disable=true
+
+The system-wide file will take precedence over any settings in the user-wide
+setting. Bear in mind that Firefox/Seamonkey might not re-read the plugin list
+once it's been cached. You might have to remove the pluginreg.dat from the Mozilla
+profile directory.
+
Special topics: Complex plugin
==============================
diff --git a/browser-plugin/totemPluginGlue.cpp b/browser-plugin/totemPluginGlue.cpp
index c70eaf744..6afec3aa4 100644
--- a/browser-plugin/totemPluginGlue.cpp
+++ b/browser-plugin/totemPluginGlue.cpp
@@ -292,6 +292,42 @@ NP_GetValue (void *future,
return totem_plugin_get_value (NULL, variable, value);
}
+static gboolean
+totem_plugin_mimetype_is_disabled (const char *mimetype,
+ GKeyFile *system,
+ GKeyFile *user)
+{
+ GError *error = NULL;
+ gboolean retval;
+ char *key;
+
+ retval = FALSE;
+ key = g_strdup_printf ("%s.disabled", mimetype);
+
+ /* If the plugin is listed as enabled or disabled explicitely,
+ * in the system-wide config file, then that's it */
+ if (system != NULL) {
+ retval = g_key_file_get_boolean (system, "Plugins", key, &error);
+ if (error == NULL) {
+ g_free (key);
+ return retval;
+ }
+ g_error_free (error);
+ error = NULL;
+ }
+
+ if (user != NULL) {
+ retval = g_key_file_get_boolean (user, "Plugins", key, &error);
+ if (error != NULL) {
+ g_error_free (error);
+ g_free (key);
+ return FALSE;
+ }
+ }
+
+ return retval;
+}
+
char *
NP_GetMIMEDescription (void)
{
@@ -302,12 +338,44 @@ NP_GetMIMEDescription (void)
list = g_string_new (NULL);
+ /* Load the configuration files for the enabled plugins */
+ GKeyFile *system, *user;
+
+ system = g_key_file_new ();
+ user = g_key_file_new ();
+
+ if (g_key_file_load_from_file (system,
+ SYSCONFDIR"/totem/browser-plugins.ini",
+ G_KEY_FILE_NONE,
+ NULL) == FALSE) {
+ g_key_file_free (system);
+ system = NULL;
+ }
+
+ char *user_ini_file;
+ user_ini_file = g_build_filename (g_get_home_dir (),
+ ".gnome2",
+ "Totem",
+ "browser-plugins.ini",
+ NULL);
+ if (g_key_file_load_from_file (user,
+ user_ini_file,
+ G_KEY_FILE_NONE,
+ NULL) == FALSE) {
+ g_key_file_free (user);
+ user = NULL;
+ }
+ g_free (user_ini_file);
+
const totemPluginMimeEntry *mimetypes;
PRUint32 count;
totemScriptablePlugin::PluginMimeTypes (&mimetypes, &count);
for (PRUint32 i = 0; i < count; ++i) {
const char *desc;
+ if (totem_plugin_mimetype_is_disabled (mimetypes[i].mimetype, system, user))
+ continue;
+
desc = gnome_vfs_mime_get_description (mimetypes[i].mimetype);
if (desc == NULL && mimetypes[i].mime_alias != NULL) {
desc = gnome_vfs_mime_get_description
@@ -325,6 +393,11 @@ NP_GetMIMEDescription (void)
mime_list = g_string_free (list, FALSE);
+ if (user != NULL)
+ g_key_file_free (user);
+ if (system != NULL)
+ g_key_file_free (system);
+
return mime_list;
}