brasero r1366 - in trunk: . src src/plugins/checksum



Author: philippr
Date: Sat Oct 11 18:00:23 2008
New Revision: 1366
URL: http://svn.gnome.org/viewvc/brasero?rev=1366&view=rev

Log:
	Respect modifiers priority order

	* src/burn-caps.c (brasero_burn_caps_sort_modifiers),
	(brasero_caps_add_processing_plugins_to_task):
	* src/burn-plugin.h:
	* src/plugins/checksum/burn-checksum-image.c
	(brasero_checksum_image_export_caps):


Modified:
   trunk/ChangeLog
   trunk/src/burn-caps.c
   trunk/src/burn-plugin.h
   trunk/src/plugins/checksum/burn-checksum-image.c

Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c	(original)
+++ trunk/src/burn-caps.c	Sat Oct 11 18:00:23 2008
@@ -1183,6 +1183,17 @@
 	return results;
 }
 
+static gboolean
+brasero_burn_caps_sort_modifiers (gconstpointer a,
+				  gconstpointer b)
+{
+	BraseroPlugin *plug_a = BRASERO_PLUGIN (a);
+	BraseroPlugin *plug_b = BRASERO_PLUGIN (b);
+
+	return brasero_plugin_get_priority (plug_a) -
+	       brasero_plugin_get_priority (plug_b);
+}
+
 static GSList *
 brasero_caps_add_processing_plugins_to_task (BraseroBurnSession *session,
 					     BraseroTask *task,
@@ -1191,6 +1202,7 @@
 					     BraseroPluginProcessFlag position)
 {
 	GSList *retval = NULL;
+	GSList *modifiers;
 	GSList *iter;
 
 	if (position == BRASERO_PLUGIN_RUN_NEVER
@@ -1205,9 +1217,11 @@
 
 	/* Go through all plugins and add all possible modifiers. They must:
 	 * - be active
-	 * - accept the position flags
-	 * => no need for modifiers to be sorted in list. */
-	for (iter = caps->modifiers; iter; iter = iter->next) {
+	 * - accept the position flags */
+	modifiers = g_slist_copy (caps->modifiers);
+	modifiers = g_slist_sort (modifiers, brasero_burn_caps_sort_modifiers);
+
+	for (iter = modifiers; iter; iter = iter->next) {
 		BraseroPluginProcessFlag flags;
 		BraseroPlugin *plugin;
 		BraseroJob *job;
@@ -1241,11 +1255,14 @@
 			retval = g_slist_prepend (retval, task);
 		}
 
-		BRASERO_BURN_LOG ("%s (modifier) added to task", brasero_plugin_get_name (plugin));
+		BRASERO_BURN_LOG ("%s (modifier) added to task",
+				  brasero_plugin_get_name (plugin));
+
 		BRASERO_BURN_LOG_TYPE (io_type, "IO type");
 
 		brasero_task_add_item (task, BRASERO_TASK_ITEM (job));
 	}
+	g_slist_free (modifiers);
 
 	return retval;
 }

Modified: trunk/src/burn-plugin.h
==============================================================================
--- trunk/src/burn-plugin.h	(original)
+++ trunk/src/burn-plugin.h	Sat Oct 11 18:00:23 2008
@@ -94,7 +94,11 @@
 
 typedef enum {
 	BRASERO_PLUGIN_RUN_NEVER		= 0,
+
+	/* run before the plugin */
 	BRASERO_PLUGIN_RUN_FIRST		= 1,
+
+	/* run after the plugin */
 	BRASERO_PLUGIN_RUN_LAST			= 1 << 1,
 } BraseroPluginProcessFlag;
 

Modified: trunk/src/plugins/checksum/burn-checksum-image.c
==============================================================================
--- trunk/src/plugins/checksum/burn-checksum-image.c	(original)
+++ trunk/src/plugins/checksum/burn-checksum-image.c	Sat Oct 11 18:00:23 2008
@@ -697,11 +697,15 @@
 			       0);
 
 	/* For images we can process (thus generating a sum on the fly or simply
-	 * test images. */
+	 * test images). */
 	input = brasero_caps_image_new (BRASERO_PLUGIN_IO_ACCEPT_FILE|
 					BRASERO_PLUGIN_IO_ACCEPT_PIPE,
 					BRASERO_IMAGE_FORMAT_BIN);
 	brasero_plugin_process_caps (plugin, input);
+	brasero_plugin_set_process_flags (plugin,
+					  BRASERO_PLUGIN_RUN_FIRST|
+					  BRASERO_PLUGIN_RUN_LAST);
+
 	brasero_plugin_check_caps (plugin,
 				   BRASERO_CHECKSUM_MD5|
 				   BRASERO_CHECKSUM_SHA1|
@@ -709,10 +713,6 @@
 				   input);
 	g_slist_free (input);
 
-	brasero_plugin_set_process_flags (plugin,
-					  BRASERO_PLUGIN_RUN_FIRST|
-					  BRASERO_PLUGIN_RUN_LAST);
-
 	/* add some configure options */
 	checksum_type = brasero_plugin_conf_option_new (GCONF_KEY_CHECKSUM_TYPE,
 							_("Hashing algorithm to be used:"),



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