[brasero] Change the sort order of caps so that we try paths with AUDIO/VIDEO before IMAGE



commit 969bbeb0dc42fd4f170d0473a6044993e4dbd182
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Wed Nov 25 15:19:42 2009 +0100

    Change the sort order of caps so that we try paths with AUDIO/VIDEO before IMAGE
    Make an enum private

 libbrasero-burn/brasero-caps-plugin.c        |    6 +++---
 libbrasero-burn/brasero-track-data-cfg.c     |    7 ++-----
 libbrasero-burn/brasero-track-data.c         |    7 ++-----
 libbrasero-burn/brasero-track-disc.c         |    7 ++-----
 libbrasero-burn/brasero-track-image-cfg.c    |    2 +-
 libbrasero-burn/brasero-track-image.c        |    7 ++-----
 libbrasero-burn/brasero-track-stream.c       |    7 ++-----
 libbrasero-burn/brasero-track-type-private.h |    9 +++++++++
 libbrasero-burn/brasero-track-type.h         |    9 ---------
 libbrasero-burn/brasero-track.c              |   13 +++++++------
 libbrasero-burn/brasero-track.h              |    4 ++--
 libbrasero-burn/burn-debug.h                 |    1 +
 12 files changed, 33 insertions(+), 46 deletions(-)
---
diff --git a/libbrasero-burn/brasero-caps-plugin.c b/libbrasero-burn/brasero-caps-plugin.c
index edc51e5..e086f25 100644
--- a/libbrasero-burn/brasero-caps-plugin.c
+++ b/libbrasero-burn/brasero-caps-plugin.c
@@ -75,9 +75,9 @@ brasero_burn_caps_sort (gconstpointer a, gconstpointer b)
 	const BraseroCaps *caps_b = b;
 	gint result;
 
-	/* First put DISC (the most used caps) then IMAGE type; these two types
-	 * are the ones that most often searched. At the end of the list we put
-	 * DATA  and AUDIO.
+	/* First put DISC (the most used caps) then AUDIO then IMAGE type; these
+	 * two types are the ones that most often searched. At the end of the
+	 * list we put DATA.
 	 * Another (sub)rule is that for DATA, DISC, AUDIO we put a caps that is
 	 * encompassed by another before.
 	 */
diff --git a/libbrasero-burn/brasero-track-data-cfg.c b/libbrasero-burn/brasero-track-data-cfg.c
index a344795..e949a6e 100644
--- a/libbrasero-burn/brasero-track-data-cfg.c
+++ b/libbrasero-burn/brasero-track-data-cfg.c
@@ -2390,7 +2390,7 @@ brasero_track_data_cfg_get_file_num (BraseroTrackData *track)
 	return stats->children;
 }
 
-static BraseroTrackDataType
+static BraseroBurnResult
 brasero_track_data_cfg_get_track_type (BraseroTrack *track,
 				       BraseroTrackType *type)
 {
@@ -2398,13 +2398,10 @@ brasero_track_data_cfg_get_track_type (BraseroTrack *track,
 
 	priv = BRASERO_TRACK_DATA_CFG_PRIVATE (track);
 
-	if (!type)
-		return BRASERO_TRACK_TYPE_DATA;
-
 	brasero_track_type_set_has_data (type);
 	brasero_track_type_set_data_fs (type, brasero_track_data_cfg_get_fs (BRASERO_TRACK_DATA (track)));
 
-	return BRASERO_TRACK_TYPE_DATA;
+	return BRASERO_BURN_OK;
 }
 
 static BraseroBurnResult
diff --git a/libbrasero-burn/brasero-track-data.c b/libbrasero-burn/brasero-track-data.c
index 3d238f9..c1380d9 100644
--- a/libbrasero-burn/brasero-track-data.c
+++ b/libbrasero-burn/brasero-track-data.c
@@ -604,7 +604,7 @@ brasero_track_data_get_size (BraseroTrack *track,
 	return BRASERO_BURN_OK;
 }
 
-static BraseroTrackDataType
+static BraseroBurnResult
 brasero_track_data_get_track_type (BraseroTrack *track,
 				   BraseroTrackType *type)
 {
@@ -612,13 +612,10 @@ brasero_track_data_get_track_type (BraseroTrack *track,
 
 	priv = BRASERO_TRACK_DATA_PRIVATE (track);
 
-	if (!type)
-		return BRASERO_TRACK_TYPE_DATA;
-
 	brasero_track_type_set_has_data (type);
 	brasero_track_type_set_data_fs (type, priv->fs_type);
 
-	return BRASERO_TRACK_TYPE_DATA;
+	return BRASERO_BURN_OK;
 }
 
 static BraseroBurnResult
diff --git a/libbrasero-burn/brasero-track-disc.c b/libbrasero-burn/brasero-track-disc.c
index 03ce4ea..752690f 100644
--- a/libbrasero-burn/brasero-track-disc.c
+++ b/libbrasero-burn/brasero-track-disc.c
@@ -251,7 +251,7 @@ brasero_track_disc_get_size (BraseroTrack *track,
 	return BRASERO_BURN_OK;
 }
 
-static BraseroTrackDataType
+static BraseroBurnResult
 brasero_track_disc_get_track_type (BraseroTrack *track,
 				   BraseroTrackType *type)
 {
@@ -260,15 +260,12 @@ brasero_track_disc_get_track_type (BraseroTrack *track,
 
 	priv = BRASERO_TRACK_DISC_PRIVATE (track);
 
-	if (!type)
-		return BRASERO_TRACK_TYPE_DISC;
-
 	medium = brasero_drive_get_medium (priv->drive);
 
 	brasero_track_type_set_has_medium (type);
 	brasero_track_type_set_medium_type (type, brasero_medium_get_status (medium));
 
-	return BRASERO_TRACK_TYPE_DISC;
+	return BRASERO_BURN_OK;
 }
 
 static void
diff --git a/libbrasero-burn/brasero-track-image-cfg.c b/libbrasero-burn/brasero-track-image-cfg.c
index 62f9c07..1e241af 100644
--- a/libbrasero-burn/brasero-track-image-cfg.c
+++ b/libbrasero-burn/brasero-track-image-cfg.c
@@ -380,7 +380,7 @@ brasero_track_image_cfg_force_format (BraseroTrackImageCfg *track,
 	priv = BRASERO_TRACK_IMAGE_CFG_PRIVATE (track);
 
 	current_format = brasero_track_image_get_format (BRASERO_TRACK_IMAGE (track));
-	if (format != BRASERO_TRACK_TYPE_NONE) {
+	if (format != BRASERO_IMAGE_FORMAT_NONE) {
 		if (current_format == format)
 			return BRASERO_BURN_OK;
 	}
diff --git a/libbrasero-burn/brasero-track-image.c b/libbrasero-burn/brasero-track-image.c
index 15549bf..f2d50a7 100644
--- a/libbrasero-burn/brasero-track-image.c
+++ b/libbrasero-burn/brasero-track-image.c
@@ -304,7 +304,7 @@ brasero_track_image_need_byte_swap (BraseroTrackImage *track)
 	return res;
 }
 
-static BraseroTrackDataType
+static BraseroBurnResult
 brasero_track_image_get_track_type (BraseroTrack *track,
 				    BraseroTrackType *type)
 {
@@ -312,13 +312,10 @@ brasero_track_image_get_track_type (BraseroTrack *track,
 
 	priv = BRASERO_TRACK_IMAGE_PRIVATE (track);
 
-	if (!type)
-		return BRASERO_TRACK_TYPE_IMAGE;
-
 	brasero_track_type_set_has_image (type);
 	brasero_track_type_set_image_format (type, priv->format);
 
-	return BRASERO_TRACK_TYPE_IMAGE;
+	return BRASERO_BURN_OK;
 }
 
 static BraseroBurnResult
diff --git a/libbrasero-burn/brasero-track-stream.c b/libbrasero-burn/brasero-track-stream.c
index 4916377..9ab6385 100644
--- a/libbrasero-burn/brasero-track-stream.c
+++ b/libbrasero-burn/brasero-track-stream.c
@@ -403,7 +403,7 @@ brasero_track_stream_get_status (BraseroTrack *track,
 	return BRASERO_BURN_OK;
 }
 
-static BraseroTrackDataType
+static BraseroBurnResult
 brasero_track_stream_get_track_type (BraseroTrack *track,
 				     BraseroTrackType *type)
 {
@@ -411,13 +411,10 @@ brasero_track_stream_get_track_type (BraseroTrack *track,
 
 	priv = BRASERO_TRACK_STREAM_PRIVATE (track);
 
-	if (!type)
-		return BRASERO_TRACK_TYPE_STREAM;
-
 	brasero_track_type_set_has_stream (type);
 	brasero_track_type_set_stream_format (type, priv->format);
 
-	return BRASERO_TRACK_TYPE_STREAM;
+	return BRASERO_BURN_OK;
 }
 
 static void
diff --git a/libbrasero-burn/brasero-track-type-private.h b/libbrasero-burn/brasero-track-type-private.h
index 2070420..292da83 100644
--- a/libbrasero-burn/brasero-track-type-private.h
+++ b/libbrasero-burn/brasero-track-type-private.h
@@ -35,6 +35,15 @@
 
 G_BEGIN_DECLS
 
+/* NOTE: the order has a meaning here and is used for sorting */
+typedef enum {
+	BRASERO_TRACK_TYPE_NONE				= 0,
+	BRASERO_TRACK_TYPE_DATA,
+	BRASERO_TRACK_TYPE_IMAGE,
+	BRASERO_TRACK_TYPE_STREAM,
+	BRASERO_TRACK_TYPE_DISC,
+} BraseroTrackDataType;
+
 struct _BraseroTrackType {
 	BraseroTrackDataType type;
 	union {
diff --git a/libbrasero-burn/brasero-track-type.h b/libbrasero-burn/brasero-track-type.h
index 0c51554..d664498 100644
--- a/libbrasero-burn/brasero-track-type.h
+++ b/libbrasero-burn/brasero-track-type.h
@@ -38,15 +38,6 @@
 
 G_BEGIN_DECLS
 
-/* NOTE: the order has a meaning here and is used for sorting */
-typedef enum {
-	BRASERO_TRACK_TYPE_NONE				= 0,
-	BRASERO_TRACK_TYPE_STREAM,
-	BRASERO_TRACK_TYPE_DATA,
-	BRASERO_TRACK_TYPE_IMAGE,
-	BRASERO_TRACK_TYPE_DISC,
-} BraseroTrackDataType;
-
 typedef struct _BraseroTrackType BraseroTrackType;
 
 BraseroTrackType *
diff --git a/libbrasero-burn/brasero-track.c b/libbrasero-burn/brasero-track.c
index 82c5a9b..77681a7 100644
--- a/libbrasero-burn/brasero-track.c
+++ b/libbrasero-burn/brasero-track.c
@@ -69,20 +69,21 @@ G_DEFINE_TYPE (BraseroTrack, brasero_track, G_TYPE_OBJECT);
  *
  * Sets @type to reflect the type of data contained in @track
  *
- * Return value: the#BraseroTrackDataType of the track
+ * Return value: the #BraseroBurnResult of the track
  **/
 
-BraseroTrackDataType
+BraseroBurnResult
 brasero_track_get_track_type (BraseroTrack *track,
 			      BraseroTrackType *type)
 {
 	BraseroTrackClass *klass;
 
-	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_TRACK_TYPE_NONE);
+	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_BURN_ERR);
+	g_return_val_if_fail (type != NULL, BRASERO_BURN_ERR);
 
 	klass = BRASERO_TRACK_GET_CLASS (track);
 	if (!klass->get_type)
-		return BRASERO_TRACK_TYPE_NONE;
+		return BRASERO_BURN_ERR;
 
 	return klass->get_type (track, type);
 }
@@ -111,7 +112,7 @@ brasero_track_get_size (BraseroTrack *track,
 	goffset blocks_local = 0;
 	goffset block_size_local = 0;
 
-	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_TRACK_TYPE_NONE);
+	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_BURN_ERR);
 
 	klass = BRASERO_TRACK_GET_CLASS (track);
 	if (!klass->get_size)
@@ -149,7 +150,7 @@ brasero_track_get_status (BraseroTrack *track,
 {
 	BraseroTrackClass *klass;
 
-	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_TRACK_TYPE_NONE);
+	g_return_val_if_fail (BRASERO_IS_TRACK (track), BRASERO_BURN_ERR);
 
 	klass = BRASERO_TRACK_GET_CLASS (track);
 
diff --git a/libbrasero-burn/brasero-track.h b/libbrasero-burn/brasero-track.h
index bd5212c..563021c 100644
--- a/libbrasero-burn/brasero-track.h
+++ b/libbrasero-burn/brasero-track.h
@@ -67,7 +67,7 @@ struct _BraseroTrackClass
 							 goffset *blocks,
 							 goffset *block_size);
 
-	BraseroTrackDataType	(* get_type)		(BraseroTrack *track,
+	BraseroBurnResult	(* get_type)		(BraseroTrack *track,
 							 BraseroTrackType *type);
 
 	/* Signals */
@@ -91,7 +91,7 @@ brasero_track_get_size (BraseroTrack *track,
 			goffset *blocks,
 			goffset *bytes);
 
-BraseroTrackDataType
+BraseroBurnResult
 brasero_track_get_track_type (BraseroTrack *track,
 			      BraseroTrackType *type);
 
diff --git a/libbrasero-burn/burn-debug.h b/libbrasero-burn/burn-debug.h
index 3504435..cae79b0 100644
--- a/libbrasero-burn/burn-debug.h
+++ b/libbrasero-burn/burn-debug.h
@@ -37,6 +37,7 @@
 #include "brasero-medium.h"
 
 #include "brasero-track.h"
+#include "brasero-track-type-private.h"
 #include "brasero-plugin-registration.h"
 
 G_BEGIN_DECLS



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