totem r5981 - in trunk: . src/plugins



Author: hadess
Date: Mon Feb 16 14:30:40 2009
New Revision: 5981
URL: http://svn.gnome.org/viewvc/totem?rev=5981&view=rev

Log:
2009-02-16  Bastien Nocera  <hadess hadess net>

	* src/plugins/totem-plugins-engine.c
	(totem_plugins_engine_load_file): Patch from Philip Withnall
	<philip tecnocode co uk> to allow builtin plugins to be disabled
	when a GConf key exists for them (Closes: #565975)



Modified:
   trunk/ChangeLog
   trunk/src/plugins/totem-plugins-engine.c

Modified: trunk/src/plugins/totem-plugins-engine.c
==============================================================================
--- trunk/src/plugins/totem-plugins-engine.c	(original)
+++ trunk/src/plugins/totem-plugins-engine.c	Mon Feb 16 14:30:40 2009
@@ -262,6 +262,7 @@
 {
 	TotemPluginInfo *info;
 	char *key_name;
+	GConfValue *activate_value;
 	gboolean activate;
 
 	if (g_str_has_suffix (plugin_file, PLUGIN_EXT) == FALSE)
@@ -278,12 +279,6 @@
 
 	g_hash_table_insert (totem_plugins, info->location, info);
 
-	if (info->builtin != FALSE) {
-		info->visible = FALSE;
-		totem_plugins_engine_activate_plugin (info);
-		return;
-	}
-
 	key_name = g_strdup_printf (GCONF_PREFIX_PLUGIN, info->location);
 	gconf_client_add_dir (client, key_name, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 	g_free (key_name);
@@ -295,18 +290,29 @@
 								info,
 								NULL,
 								NULL);
-	activate = gconf_client_get_bool (client, key_name, NULL);
+	activate_value = gconf_client_get (client, key_name, NULL);
 	g_free (key_name);
 
-	key_name = g_strdup_printf (GCONF_PLUGIN_HIDDEN, info->location);
-	info->visible_notification_id = gconf_client_notify_add (client,
-								 key_name,
-								 (GConfClientNotifyFunc)totem_plugins_engine_plugin_visible_cb,
-								 info,
-								 NULL,
-								 NULL);
-	info->visible = !gconf_client_get_bool (client, key_name, NULL);
-	g_free (key_name);
+	if (activate_value == NULL) {
+		/* Builtin plugins are activated by default; other plugins aren't */
+		activate = info->builtin;
+	} else {
+		activate = gconf_value_get_bool (activate_value);
+		gconf_value_free (activate_value);
+	}
+
+	if (info->builtin == FALSE) {
+		/* Builtin plugins are *always* invisible */
+		key_name = g_strdup_printf (GCONF_PLUGIN_HIDDEN, info->location);
+		info->visible_notification_id = gconf_client_notify_add (client,
+									 key_name,
+									 (GConfClientNotifyFunc)totem_plugins_engine_plugin_visible_cb,
+									 info,
+									 NULL,
+									 NULL);
+		info->visible = !gconf_client_get_bool (client, key_name, NULL);
+		g_free (key_name);
+	}
 
 	if (activate)
 		totem_plugins_engine_activate_plugin (info);



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