summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Stösel <andre@stoesel.de>2013-07-11 15:20:32 +0000
committerTarmac <>2013-07-11 15:20:32 +0000
commit876ea34b99fe2292bbf69d019a5831e39259cb57 (patch)
tree298dfd27cbbc248d64c51e27eb26a41633a275c4
parent7bad699b8d9bcd1c66387b9a134deda27adbe0bf (diff)
parent7aac7a069da44f2862532a9ef9d1aff00ac5e455 (diff)
downloadmidori-876ea34b99fe2292bbf69d019a5831e39259cb57.tar.gz
Test if plugins are redundant instead of skipping them all
-rw-r--r--midori/midori-websettings.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c
index d7a8a172..46644360 100644
--- a/midori/midori-websettings.c
+++ b/midori/midori-websettings.c
@@ -596,6 +596,8 @@ midori_web_settings_has_plugin_support (void)
/**
* midori_web_settings_skip_plugin:
*
+ * Tests if a plugin is redundant
+ *
* Returns: %TRUE if the passed plugin shouldn't be shown in UI listings.
*
* Since: 0.5.1
@@ -603,7 +605,36 @@ midori_web_settings_has_plugin_support (void)
gboolean
midori_web_settings_skip_plugin (const gchar* path)
{
- return !path || strstr (path, "npwrapper.") || strstr (path, "plugins-wrapped");
+ static GHashTable* plugins = NULL;
+ gchar* basename = NULL;
+ gchar* plugin_path = NULL;
+
+ if (!path)
+ return TRUE;
+
+ if (!plugins)
+ plugins = g_hash_table_new (g_str_hash, g_str_equal);
+
+ basename = g_path_get_basename (path);
+
+ plugin_path = g_hash_table_lookup (plugins, basename);
+ if (g_strcmp0 (path, plugin_path) == 0)
+ {
+ return FALSE;
+ }
+
+ if (plugin_path != NULL)
+ {
+ g_free (basename);
+
+ return TRUE;
+ }
+
+ g_hash_table_insert (plugins, basename, g_strdup (path));
+
+ /* Note: do not free basename */
+
+ return FALSE;
}
/**