brasero r2191 - in trunk: . libbrasero-burn src



Author: philippr
Date: Wed Apr  1 12:27:39 2009
New Revision: 2191
URL: http://svn.gnome.org/viewvc/brasero?rev=2191&view=rev

Log:
2009-04-01  Philippe Rouquier  <bonfire-app wanadoo fr>

	Clean burn-cap.h/c:
	move some function to brasero-session.h as they should be public
	Also fix some forgotten unreffing (harmless as this object is supposed
	to live all the time the app/librasery is to be used)

	* libbrasero-burn/Makefile.am:
	* libbrasero-burn/brasero-burn-options.c:
	* libbrasero-burn/brasero-burn.c
	(brasero_burn_is_loaded_dest_media_supported),
	(brasero_burn_reload_dest_media),
	(brasero_burn_check_session_consistency),
	(brasero_burn_same_src_dest_image),
	(brasero_burn_same_src_dest_reload_medium), (brasero_burn_record):
	* libbrasero-burn/brasero-dest-selection.c
	(brasero_dest_selection_init), (brasero_dest_selection_finalize),
	(brasero_dest_selection_format_medium_string):
	* libbrasero-burn/brasero-disc-copy-dialog.c:
	* libbrasero-burn/brasero-disc-option-dialog.c
	(brasero_disc_option_dialog_update_joliet),
	(brasero_disc_option_dialog_init),
	(brasero_disc_option_dialog_finalize):
	* libbrasero-burn/brasero-image-type-chooser.c
	(brasero_image_type_chooser_init),
	(brasero_image_type_chooser_finalize):
	* libbrasero-burn/brasero-medium-properties.c
	(brasero_medium_properties_drive_properties),
	(brasero_medium_properties_get_possible_output_formats),
	(brasero_medium_properties_image_format_changed_cb),
	(brasero_medium_properties_image_properties),
	(brasero_medium_properties_update_image_output),
	(brasero_medium_properties_init),
	(brasero_medium_properties_finalize):
	* libbrasero-burn/brasero-session-cfg.c
	(brasero_session_cfg_add_drive_properties_flags),
	(brasero_session_cfg_update), (brasero_session_cfg_add_flags),
	(brasero_session_cfg_remove_flags), (brasero_session_cfg_init),
	(brasero_session_cfg_finalize):
	* libbrasero-burn/brasero-session.h:
	* libbrasero-burn/brasero-src-image.c
	(brasero_src_image_set_formats), (brasero_src_image_init),
	(brasero_src_image_finalize):
	* libbrasero-burn/burn-caps.c (brasero_caps_find_start_caps),
	(brasero_burn_session_get_blank_flags),
	(brasero_burn_session_can_blank), (brasero_burn_caps_new_task),
	(brasero_caps_try_output), (brasero_caps_try_output_with_blanking),
	(brasero_burn_session_input_supported),
	(brasero_burn_session_output_supported),
	(brasero_burn_session_can_burn),
	(brasero_burn_session_get_required_media_type),
	(brasero_burn_session_get_default_output_format),
	(brasero_caps_get_flags_for_disc),
	(brasero_burn_caps_get_flags_for_medium),
	(brasero_burn_session_get_burn_flags), (brasero_caps_duplicate),
	(brasero_caps_replicate_links), (brasero_caps_replicate_tests),
	(brasero_caps_copy_deep), (brasero_caps_duplicate_deep),
	(brasero_caps_list_check_io), (brasero_caps_image_new),
	(brasero_caps_audio_new), (brasero_caps_data_new),
	(brasero_caps_disc_lookup_or_create), (brasero_caps_disc_new),
	(brasero_plugin_check_caps), (brasero_plugin_register_group),
	(brasero_plugin_can_burn), (brasero_plugin_can_image),
	(brasero_plugin_can_convert), (brasero_media_capabilities),
	(brasero_burn_library_can_checksum), (brasero_caps_list_dump),
	(brasero_track_type_is_supported):
	* libbrasero-burn/burn-caps.h:
	* src/brasero-app.c:
	* src/brasero-blank-dialog.c
	(brasero_blank_dialog_device_opts_setup),
	(brasero_blank_dialog_finalize), (brasero_blank_dialog_init):
	* src/brasero-data-session.c:
	* src/brasero-plugin-manager-ui.c
	(plugin_manager_ui_populate_lists):
	* src/brasero-project-manager.c:

Modified:
   trunk/ChangeLog
   trunk/libbrasero-burn/Makefile.am
   trunk/libbrasero-burn/brasero-burn-options.c
   trunk/libbrasero-burn/brasero-burn.c
   trunk/libbrasero-burn/brasero-dest-selection.c
   trunk/libbrasero-burn/brasero-disc-copy-dialog.c
   trunk/libbrasero-burn/brasero-disc-option-dialog.c
   trunk/libbrasero-burn/brasero-image-type-chooser.c
   trunk/libbrasero-burn/brasero-medium-properties.c
   trunk/libbrasero-burn/brasero-session-cfg.c
   trunk/libbrasero-burn/brasero-session.h
   trunk/libbrasero-burn/brasero-src-image.c
   trunk/libbrasero-burn/burn-caps.c
   trunk/libbrasero-burn/burn-caps.h
   trunk/src/brasero-app.c
   trunk/src/brasero-blank-dialog.c
   trunk/src/brasero-data-session.c
   trunk/src/brasero-plugin-manager-ui.c
   trunk/src/brasero-project-manager.c

Modified: trunk/libbrasero-burn/Makefile.am
==============================================================================
--- trunk/libbrasero-burn/Makefile.am	(original)
+++ trunk/libbrasero-burn/Makefile.am	Wed Apr  1 12:27:39 2009
@@ -36,7 +36,17 @@
 	brasero-tags.h						\
 	brasero-enums.h						\
 	brasero-error.h						\
-	brasero-burn-lib.h
+	brasero-burn-lib.h					\
+	brasero-track.h						\
+	brasero-track-data.h                 			\
+	brasero-track-disc.h                 			\
+	brasero-track-stream.h                 			\
+	brasero-track-image.h					\
+	brasero-track-image-cfg.h				\
+	brasero-session.h                 			\
+	brasero-burn.h						\
+	brasero-burn-options.h        			        \
+	brasero-burn-dialog.h
 
 libbrasero_burn_la_LIBADD =					\
 	../libbrasero-media/libbrasero-media.la			\

Modified: trunk/libbrasero-burn/brasero-burn-options.c
==============================================================================
--- trunk/libbrasero-burn/brasero-burn-options.c	(original)
+++ trunk/libbrasero-burn/brasero-burn-options.c	Wed Apr  1 12:27:39 2009
@@ -39,7 +39,6 @@
 #include <gtk/gtk.h>
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 
 #include "brasero-medium.h"
 #include "brasero-medium-selection-priv.h"

Modified: trunk/libbrasero-burn/brasero-burn.c
==============================================================================
--- trunk/libbrasero-burn/brasero-burn.c	(original)
+++ trunk/libbrasero-burn/brasero-burn.c	Wed Apr  1 12:27:39 2009
@@ -722,8 +722,7 @@
 	output.type = BRASERO_TRACK_TYPE_DISC;
 	output.subtype.media = media;
 
-	result = brasero_burn_caps_is_output_supported (priv->caps,
-							priv->session,
+	result = brasero_burn_session_output_supported (priv->session,
 							&output);
 
 	flags = brasero_burn_session_get_flags (priv->session);
@@ -747,15 +746,14 @@
 	}
 
 	/* let's see what our media is missing and what's not supported */
-	required_media = brasero_burn_caps_get_required_media_type (priv->caps,
-								    priv->session);
+	required_media = brasero_burn_session_get_required_media_type (priv->session);
 	missing = required_media & (~media);
 	unsupported = media & (~required_media);
 
 	if (missing & (BRASERO_MEDIUM_BLANK|BRASERO_MEDIUM_APPENDABLE)) {
 		/* there is a special case if the disc is rewritable */
 		if ((media & BRASERO_MEDIUM_REWRITABLE)
-		&&   brasero_burn_caps_can_blank (priv->caps, priv->session) == BRASERO_BURN_OK) {
+		&&   brasero_burn_session_can_blank (priv->session) == BRASERO_BURN_OK) {
 			*must_blank = TRUE;
 			return BRASERO_BURN_ERROR_NONE;
 		}
@@ -965,7 +963,7 @@
 again:
 
 	/* eject and ask the user to reload a disc */
-	required_media = brasero_burn_caps_get_required_media_type (priv->caps, priv->session);
+	required_media = brasero_burn_session_get_required_media_type (priv->session);
 	required_media &= (BRASERO_MEDIUM_WRITABLE|
 			   BRASERO_MEDIUM_CD|
 			   BRASERO_MEDIUM_DVD);
@@ -1962,10 +1960,9 @@
 	flags = brasero_burn_session_get_flags (priv->session);
 	brasero_burn_session_remove_flag (priv->session, flags);
 
-	result = brasero_burn_caps_get_flags (priv->caps,
-					      priv->session,
-					      &supported,
-					      &compulsory);
+	result = brasero_burn_session_get_burn_flags (priv->session,
+						      &supported,
+						      &compulsory);
 	if (result != BRASERO_BURN_OK)
 		return result;
 
@@ -1981,10 +1978,9 @@
 		 * media type that doesn't need it. */
 		if (supported & flag) {
 			brasero_burn_session_add_flag (priv->session, flag);
-			brasero_burn_caps_get_flags (priv->caps,
-						     priv->session,
-						     &supported,
-						     &compulsory);
+			brasero_burn_session_get_burn_flags (priv->session,
+							     &supported,
+							     &compulsory);
 		}
 		else {
 			BRASERO_BURN_LOG_FLAGS (flag, "Flag set but not supported:");
@@ -2342,8 +2338,7 @@
 	format = BRASERO_IMAGE_FORMAT_CDRDAO;
 	for (; format != BRASERO_IMAGE_FORMAT_NONE; format >>= 1) {
 		output.subtype.img_format = format;
-		result = brasero_burn_caps_is_output_supported (priv->caps,
-								priv->session,
+		result = brasero_burn_session_output_supported (priv->session,
 								&output);
 		if (result == BRASERO_BURN_OK)
 			break;
@@ -2472,8 +2467,7 @@
 	 * we need to be lenient. */
 
 	/* Eject and ask the user to reload a disc */
-	required_media = brasero_burn_caps_get_required_media_type (priv->caps,
-								    priv->session);
+	required_media = brasero_burn_session_get_required_media_type (priv->session);
 	required_media &= (BRASERO_MEDIUM_WRITABLE|
 			   BRASERO_MEDIUM_CD|
 			   BRASERO_MEDIUM_DVD|
@@ -2567,8 +2561,7 @@
 		while (result == BRASERO_BURN_NEED_RELOAD) {
 			BraseroMedia required_media;
 
-			required_media = brasero_burn_caps_get_required_media_type (priv->caps,
-										    priv->session);
+			required_media = brasero_burn_session_get_required_media_type (priv->session);
 			if (required_media == BRASERO_MEDIUM_NONE)
 				required_media = BRASERO_MEDIUM_WRITABLE;
 

Modified: trunk/libbrasero-burn/brasero-dest-selection.c
==============================================================================
--- trunk/libbrasero-burn/brasero-dest-selection.c	(original)
+++ trunk/libbrasero-burn/brasero-dest-selection.c	Wed Apr  1 12:27:39 2009
@@ -43,7 +43,6 @@
 #include <gconf/gconf-client.h>
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 #include "brasero-track.h"
 #include "brasero-medium.h"
 #include "brasero-session.h"
@@ -59,7 +58,6 @@
 struct _BraseroDestSelectionPrivate
 {
 	BraseroBurnSession *session;
-	BraseroBurnCaps *caps;
 
 	BraseroDrive *locked_drive;
 
@@ -172,8 +170,6 @@
 
 	priv = BRASERO_DEST_SELECTION_PRIVATE (object);
 
-	priv->caps = brasero_burn_caps_get_default ();
-
 	/* Only show media on which we can write and which are in a burner.
 	 * There is one exception though, when we're copying media and when the
 	 * burning device is the same as the dest device. */
@@ -188,11 +184,6 @@
 
 	priv = BRASERO_DEST_SELECTION_PRIVATE (object);
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	if (priv->valid_sig) {
 		g_signal_handler_disconnect (priv->session,
 					     priv->valid_sig);
@@ -451,7 +442,7 @@
 
 	if ((media & BRASERO_MEDIUM_BLANK)
 	|| ((flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
-	&&  brasero_burn_caps_can_blank (priv->caps, priv->session) == BRASERO_BURN_OK)) {
+	&&  brasero_burn_session_can_blank (priv->session) == BRASERO_BURN_OK)) {
 		brasero_medium_get_capacity (medium,
 					     &size_bytes,
 					     NULL);
@@ -462,7 +453,7 @@
 					       NULL);
 	}
 	else if (media & BRASERO_MEDIUM_CLOSED) {
-		if (!brasero_burn_caps_can_blank (priv->caps, priv->session) == BRASERO_BURN_OK) {
+		if (!brasero_burn_session_can_blank (priv->session) == BRASERO_BURN_OK) {
 			/* NOTE for translators, the first %s is the medium name */
 			label = g_strdup_printf (_("%s: no free space"), medium_name);
 			g_free (medium_name);

Modified: trunk/libbrasero-burn/brasero-disc-copy-dialog.c
==============================================================================
--- trunk/libbrasero-burn/brasero-disc-copy-dialog.c	(original)
+++ trunk/libbrasero-burn/brasero-disc-copy-dialog.c	Wed Apr  1 12:27:39 2009
@@ -45,7 +45,6 @@
 
 #include "burn-basics.h"
 #include "brasero-session.h"
-#include "burn-caps.h"
 #include "brasero-medium.h"
 #include "brasero-drive.h"
 #include "brasero-session-cfg.h"

Modified: trunk/libbrasero-burn/brasero-disc-option-dialog.c
==============================================================================
--- trunk/libbrasero-burn/brasero-disc-option-dialog.c	(original)
+++ trunk/libbrasero-burn/brasero-disc-option-dialog.c	Wed Apr  1 12:27:39 2009
@@ -48,7 +48,7 @@
 #include "burn-basics.h"
 #include "brasero-tags.h"
 #include "brasero-session.h"
-#include "burn-caps.h"
+#include "brasero-track-data.h"
 #include "burn-plugin-manager.h"
 #include "brasero-disc-option-dialog.h"
 #include "brasero-dest-selection.h"
@@ -58,8 +58,6 @@
 G_DEFINE_TYPE (BraseroDiscOptionDialog, brasero_disc_option_dialog, BRASERO_TYPE_BURN_OPTIONS);
 
 struct _BraseroDiscOptionDialogPrivate {
-	BraseroBurnCaps *caps;
-
 	GtkWidget *joliet_toggle;
 
 	GtkWidget *video_options;
@@ -159,8 +157,7 @@
 	brasero_burn_session_get_input_type (session, &source);
 
 	source.subtype.fs_type |= BRASERO_IMAGE_FS_JOLIET;
-	result = brasero_burn_caps_is_input_supported (priv->caps,
-						       session,
+	result = brasero_burn_session_input_supported (session,
 						       &source,
 						       FALSE);
 	if (result == BRASERO_BURN_OK) {
@@ -809,7 +806,6 @@
 
 	priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (obj);
 
-	priv->caps = brasero_burn_caps_get_default ();
 	gtk_window_set_title (GTK_WINDOW (obj), _("Disc Burning Setup"));
 	g_signal_connect (obj,
 			  "notify::session",
@@ -834,11 +830,6 @@
 		priv->valid_sig = 0;
 	}
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 

Modified: trunk/libbrasero-burn/brasero-image-type-chooser.c
==============================================================================
--- trunk/libbrasero-burn/brasero-image-type-chooser.c	(original)
+++ trunk/libbrasero-burn/brasero-image-type-chooser.c	Wed Apr  1 12:27:39 2009
@@ -39,7 +39,6 @@
 #include <gtk/gtk.h>
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 #include "brasero-image-type-chooser.h"
 
 #define BRASERO_IMAGE_TYPE_CHOOSER_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_IMAGE_TYPE_CHOOSER, BraseroImageTypeChooserPrivate))
@@ -61,7 +60,6 @@
 struct _BraseroImageTypeChooserPrivate {
 	GtkWidget *combo;
 
-	BraseroBurnCaps *caps;
 	BraseroImageFormat format;
 
 	guint updating:1;
@@ -242,8 +240,6 @@
 
 	gtk_widget_show (priv->combo);
 	gtk_box_pack_end (GTK_BOX (obj), priv->combo, TRUE, TRUE, 0);
-
-	priv->caps = brasero_burn_caps_get_default ();
 }
 
 static void
@@ -253,11 +249,6 @@
 
 	priv = BRASERO_IMAGE_TYPE_CHOOSER_PRIVATE (object);
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 

Modified: trunk/libbrasero-burn/brasero-medium-properties.c
==============================================================================
--- trunk/libbrasero-burn/brasero-medium-properties.c	(original)
+++ trunk/libbrasero-burn/brasero-medium-properties.c	Wed Apr  1 12:27:39 2009
@@ -46,7 +46,6 @@
 #include "brasero-session-cfg.h"
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 #include "brasero-track.h"
 #include "brasero-medium.h"
 #include "brasero-session.h"
@@ -56,7 +55,6 @@
 struct _BraseroMediumPropertiesPrivate
 {
 	BraseroBurnSession *session;
-	BraseroBurnCaps *caps;
 
 	GtkWidget *medium_prop;
 
@@ -108,10 +106,9 @@
 					    rate);
 
 	flags = brasero_burn_session_get_flags (priv->session);
-	brasero_burn_caps_get_flags (priv->caps,
-				     priv->session,
-				     &supported,
-				     &compulsory);
+	brasero_burn_session_get_burn_flags (priv->session,
+					     &supported,
+					     &compulsory);
 
 	brasero_drive_properties_set_flags (BRASERO_DRIVE_PROPERTIES (priv->medium_prop),
 					    flags,
@@ -242,8 +239,7 @@
 		BraseroBurnResult result;
 
 		output.subtype.img_format = format;
-		result = brasero_burn_caps_is_output_supported (priv->caps,
-								priv->session,
+		result = brasero_burn_session_output_supported (priv->session,
 								&output);
 		if (result == BRASERO_BURN_OK) {
 			(*formats) |= format;
@@ -272,7 +268,7 @@
 	format = brasero_image_properties_get_format (dialog);
 
 	if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE)
-		format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
+		format = brasero_burn_session_get_default_output_format (priv->session);
 
 	if (priv->default_path && !brasero_image_properties_is_path_edited (dialog)) {
 		/* not changed: get a new default path */
@@ -419,7 +415,7 @@
 
 	/* see if we are to choose the format ourselves */
 	if (format == BRASERO_IMAGE_FORMAT_ANY || format == BRASERO_IMAGE_FORMAT_NONE) {
-		format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
+		format = brasero_burn_session_get_default_output_format (priv->session);
 		priv->default_format = TRUE;
 	}
 	else
@@ -501,18 +497,18 @@
 		 * default and remove the current one */
 		if (!is_valid) {
 			priv->default_format = TRUE;
-			valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
+			valid_format = brasero_burn_session_get_default_output_format (priv->session);
 		}
 		else if (priv->default_format) {
 			/* since input, or caps changed, check if there isn't a
 			 * better format available. */
-			valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
+			valid_format = brasero_burn_session_get_default_output_format (priv->session);
 		}
 	}
 	else {
 		/* This is always invalid; find one */
 		priv->default_format = TRUE;
-		valid_format = brasero_burn_caps_get_default_output_format (priv->caps, priv->session);
+		valid_format = brasero_burn_session_get_default_output_format (priv->session);
 	}
 
 	/* see if we have a workable format */
@@ -588,8 +584,6 @@
 
 	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);
 
-	priv->caps = brasero_burn_caps_get_default ();
-
 	gtk_widget_set_tooltip_text (GTK_WIDGET (object), _("Configure recording options"));
 
 	priv->default_ext = TRUE;
@@ -604,11 +598,6 @@
 
 	priv = BRASERO_MEDIUM_PROPERTIES_PRIVATE (object);
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	if (priv->valid_sig) {
 		g_signal_handler_disconnect (priv->session,
 					     priv->valid_sig);

Modified: trunk/libbrasero-burn/brasero-session-cfg.c
==============================================================================
--- trunk/libbrasero-burn/brasero-session-cfg.c	(original)
+++ trunk/libbrasero-burn/brasero-session-cfg.c	Wed Apr  1 12:27:39 2009
@@ -44,7 +44,6 @@
 #include "burn-debug.h"
 #include "burn-plugin-manager.h"
 #include "brasero-session.h"
-#include "burn-caps.h"
 #include "burn-plugin-manager.h"
 #include "burn-image-format.h"
 
@@ -54,8 +53,6 @@
 typedef struct _BraseroSessionCfgPrivate BraseroSessionCfgPrivate;
 struct _BraseroSessionCfgPrivate
 {
-	BraseroBurnCaps *caps;
-
 	BraseroBurnFlag supported;
 	BraseroBurnFlag compulsory;
 
@@ -262,10 +259,9 @@
 
 	priv->supported = BRASERO_BURN_FLAG_NONE;
 	priv->compulsory = BRASERO_BURN_FLAG_NONE;
-	result = brasero_burn_caps_get_flags (priv->caps,
-					      BRASERO_BURN_SESSION (self),
-					      &priv->supported,
-					      &priv->compulsory);
+	result = brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+						      &priv->supported,
+						      &priv->compulsory);
 	if (result != BRASERO_BURN_OK) {
 		brasero_burn_session_set_flags (BRASERO_BURN_SESSION (self), flags);
 		return;
@@ -293,10 +289,9 @@
 
 			priv->supported = BRASERO_BURN_FLAG_NONE;
 			priv->compulsory = BRASERO_BURN_FLAG_NONE;
-			brasero_burn_caps_get_flags (priv->caps,
-						     BRASERO_BURN_SESSION (self),
-						     &priv->supported,
-						     &priv->compulsory);
+			brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+							     &priv->supported,
+							     &priv->compulsory);
 		}
 
 		if (priv->supported & flag) {
@@ -304,10 +299,9 @@
 
 			priv->supported = BRASERO_BURN_FLAG_NONE;
 			priv->compulsory = BRASERO_BURN_FLAG_NONE;
-			brasero_burn_caps_get_flags (priv->caps,
-						     BRASERO_BURN_SESSION (self),
-						     &priv->supported,
-						     &priv->compulsory);
+			brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+							     &priv->supported,
+							     &priv->compulsory);
 		}
 	}
 
@@ -322,10 +316,9 @@
 
 			priv->supported = BRASERO_BURN_FLAG_NONE;
 			priv->compulsory = BRASERO_BURN_FLAG_NONE;
-			brasero_burn_caps_get_flags (priv->caps,
-						     BRASERO_BURN_SESSION (self),
-						     &priv->supported,
-						     &priv->compulsory);
+			brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+							     &priv->supported,
+							     &priv->compulsory);
 		}
 	}
 
@@ -340,10 +333,9 @@
 
 		priv->supported = BRASERO_BURN_FLAG_NONE;
 		priv->compulsory = BRASERO_BURN_FLAG_NONE;
-		brasero_burn_caps_get_flags (priv->caps,
-					     BRASERO_BURN_SESSION (self),
-					     &priv->supported,
-					     &priv->compulsory);
+		brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+						     &priv->supported,
+						     &priv->compulsory);
 	}
 
 	/* When copying with same drive don't set write mode, it'll be set later */
@@ -354,10 +346,9 @@
 
 			priv->supported = BRASERO_BURN_FLAG_NONE;
 			priv->compulsory = BRASERO_BURN_FLAG_NONE;
-			brasero_burn_caps_get_flags (priv->caps,
-						     BRASERO_BURN_SESSION (self),
-						     &priv->supported,
-						     &priv->compulsory);
+			brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+							     &priv->supported,
+							     &priv->compulsory);
 
 			/* NOTE: after setting DAO, some flags may become
 			 * compulsory like BLANK_BEFORE for CDRW with data */
@@ -693,8 +684,7 @@
 		/* Try to redo what we undid (after all a new plugin could have
 		 * been activated in the mean time ...) and see what happens */
 		source.subtype.audio_format |= BRASERO_METADATA_INFO;
-		result = brasero_burn_caps_is_input_supported (priv->caps,
-							       BRASERO_BURN_SESSION (self),
+		result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
 							       &source,
 							       FALSE);
 		if (result == BRASERO_BURN_OK) {
@@ -708,17 +698,15 @@
 		else {
 			/* No, nothing's changed */
 			source.subtype.audio_format &= ~BRASERO_METADATA_INFO;
-			result = brasero_burn_caps_is_input_supported (priv->caps,
-								       BRASERO_BURN_SESSION (self),
+			result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
 								       &source,
 								       FALSE);
 		}
 	}
 	else {
 		/* Don't use flags as they'll be adapted later. */
-		result = brasero_burn_caps_is_session_supported (priv->caps,
-								 BRASERO_BURN_SESSION (self),
-								 FALSE);
+		result = brasero_burn_session_can_burn (BRASERO_BURN_SESSION (self),
+							FALSE);
 		if (result != BRASERO_BURN_OK
 		&&  source.type == BRASERO_TRACK_TYPE_STREAM
 		&& (source.subtype.audio_format & BRASERO_METADATA_INFO)) {
@@ -727,8 +715,7 @@
 			 * other backend is available remove CD-TEXT option but
 			 * tell user... */
 			source.subtype.audio_format &= ~BRASERO_METADATA_INFO;
-			result = brasero_burn_caps_is_input_supported (priv->caps,
-								       BRASERO_BURN_SESSION (self),
+			result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
 								       &source,
 								       FALSE);
 			BRASERO_BURN_LOG ("Tested support without Metadata information (result %d)", result);
@@ -870,10 +857,9 @@
 	brasero_burn_session_add_flag (BRASERO_BURN_SESSION (self), flags);
 	priv->supported = BRASERO_BURN_FLAG_NONE;
 	priv->compulsory = BRASERO_BURN_FLAG_NONE;
-	brasero_burn_caps_get_flags (priv->caps,
-				     BRASERO_BURN_SESSION (self),
-				     &priv->supported,
-				     &priv->compulsory);
+	brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+					     &priv->supported,
+					     &priv->compulsory);
 
 	/* Always save flags */
 	brasero_session_cfg_save_drive_properties (self);
@@ -894,10 +880,9 @@
 	brasero_burn_session_remove_flag (BRASERO_BURN_SESSION (self), flags);
 	priv->supported = BRASERO_BURN_FLAG_NONE;
 	priv->compulsory = BRASERO_BURN_FLAG_NONE;
-	brasero_burn_caps_get_flags (priv->caps,
-				     BRASERO_BURN_SESSION (self),
-				     &priv->supported,
-				     &priv->compulsory);
+	brasero_burn_session_get_burn_flags (BRASERO_BURN_SESSION (self),
+					     &priv->supported,
+					     &priv->compulsory);
 
 	/* Always save flags */
 	brasero_session_cfg_save_drive_properties (self);
@@ -935,8 +920,6 @@
 
 	priv = BRASERO_SESSION_CFG_PRIVATE (object);
 
-	priv->caps = brasero_burn_caps_get_default ();
-
 	manager = brasero_plugin_manager_get_default ();
 	priv->caps_sig = g_signal_connect (manager,
 					   "caps-changed",
@@ -959,11 +942,6 @@
 		priv->caps_sig = 0;
 	}
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	G_OBJECT_CLASS (brasero_session_cfg_parent_class)->finalize (object);
 }
 

Modified: trunk/libbrasero-burn/brasero-session.h
==============================================================================
--- trunk/libbrasero-burn/brasero-session.h	(original)
+++ trunk/libbrasero-burn/brasero-session.h	Wed Apr  1 12:27:39 2009
@@ -114,11 +114,6 @@
 BraseroDrive *
 brasero_burn_session_get_burner (BraseroBurnSession *session);
 
-
-/**
- * When outputting to an image file burner needs to be set to a drive with FILE type
- */
-
 void
 brasero_burn_session_set_burner (BraseroBurnSession *session,
 				 BraseroDrive *burner);
@@ -203,6 +198,46 @@
 brasero_burn_session_pop_tracks (BraseroBurnSession *session);
 
 /**
+ * Test the supported or compulsory flags for a given session
+ */
+
+BraseroBurnResult
+brasero_burn_session_get_burn_flags (BraseroBurnSession *session,
+				     BraseroBurnFlag *supported,
+				     BraseroBurnFlag *compulsory);
+
+BraseroBurnResult
+brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
+				      BraseroBurnFlag *supported,
+				      BraseroBurnFlag *compulsory);
+
+/**
+ * Used to test the possibilities offered for a given session
+ */
+
+BraseroBurnResult
+brasero_burn_session_can_blank (BraseroBurnSession *session);
+
+BraseroBurnResult
+brasero_burn_session_can_burn (BraseroBurnSession *session,
+			       gboolean use_flags);
+
+BraseroBurnResult
+brasero_burn_session_input_supported (BraseroBurnSession *session,
+				      BraseroTrackType *input,
+				      gboolean use_flags);
+
+BraseroBurnResult
+brasero_burn_session_output_supported (BraseroBurnSession *session,
+				       BraseroTrackType *output);
+
+BraseroMedia
+brasero_burn_session_get_required_media_type (BraseroBurnSession *session);
+
+BraseroImageFormat
+brasero_burn_session_get_default_output_format (BraseroBurnSession *session);
+
+/**
  * Some convenience functions
  * FIXME: maybe they should be put into a brasero burn session helper file?
  */

Modified: trunk/libbrasero-burn/brasero-src-image.c
==============================================================================
--- trunk/libbrasero-burn/brasero-src-image.c	(original)
+++ trunk/libbrasero-burn/brasero-src-image.c	Wed Apr  1 12:27:39 2009
@@ -43,7 +43,6 @@
 #include <gconf/gconf-client.h>
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 
 #include "brasero-drive.h"
 
@@ -62,8 +61,6 @@
 	BraseroBurnSession *session;
 	BraseroTrackImageCfg *track;
 
-	BraseroBurnCaps *caps;
-
 	gchar *folder;
 	GCancellable *cancel;
 
@@ -371,8 +368,7 @@
 		BraseroBurnResult result;
 
 		input.subtype.img_format = format;
-		result = brasero_burn_caps_is_input_supported (priv->caps,
-							       priv->session,
+		result = brasero_burn_session_input_supported (priv->session,
 							       &input,
 							       FALSE);
 		if (result == BRASERO_BURN_OK)
@@ -574,8 +570,6 @@
 	}
 	g_free (uri);
 		 
-	priv->caps = brasero_burn_caps_get_default ();
-
 	string = g_strdup_printf ("<i>%s</i>", _("Click here to select an _image"));
 	label = gtk_label_new_with_mnemonic (string);
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -611,11 +605,6 @@
 		priv->session = NULL;
 	}
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	if (priv->cancel) {
 		g_cancellable_cancel (priv->cancel);
 		g_object_unref (priv->cancel);

Modified: trunk/libbrasero-burn/burn-caps.c
==============================================================================
--- trunk/libbrasero-burn/burn-caps.c	(original)
+++ trunk/libbrasero-burn/burn-caps.c	Wed Apr  1 12:27:39 2009
@@ -206,7 +206,7 @@
 	return default_caps;
 }
 
-/* that function receives all errors returned by the object and 'learns' from 
+/* That function receives all errors returned by the object and 'learns' from 
  * these errors what are the safest defaults for a particular system. It should 
  * also offer fallbacks if an error occurs through a signal */
 static BraseroBurnResult
@@ -291,12 +291,11 @@
 }
 
 static BraseroCaps *
-brasero_caps_find_start_caps (BraseroTrackType *output)
+brasero_caps_find_start_caps (BraseroBurnCaps *self,
+			      BraseroTrackType *output)
 {
 	GSList *iter;
-	BraseroBurnCaps *self;
 
-	self = brasero_burn_caps_get_default ();
 	for (iter = self->priv->caps_list; iter; iter = iter->next) {
 		BraseroCaps *caps;
 
@@ -313,7 +312,7 @@
 	return NULL;
 }
 
-BraseroBurnResult
+static BraseroBurnResult
 brasero_burn_caps_get_blanking_flags_real (BraseroBurnCaps *caps,
 					   BraseroMedia media,
 					   BraseroBurnFlag session_flags,
@@ -396,12 +395,13 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_get_blanking_flags (BraseroBurnCaps *caps,
-				      BraseroBurnSession *session,
+brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
 				      BraseroBurnFlag *supported,
 				      BraseroBurnFlag *compulsory)
 {
 	BraseroMedia media;
+	BraseroBurnCaps *self;
+	BraseroBurnResult result;
 	BraseroBurnFlag session_flags;
 
 	media = brasero_burn_session_get_dest_media (session);
@@ -417,11 +417,16 @@
 	}
 
 	session_flags = brasero_burn_session_get_flags (session);
-	return brasero_burn_caps_get_blanking_flags_real (caps,
-							  media,
-							  session_flags,
-							  supported,
-							  compulsory);
+
+	self = brasero_burn_caps_get_default ();
+	result = brasero_burn_caps_get_blanking_flags_real (self,
+							    media,
+							    session_flags,
+							    supported,
+							    compulsory);
+	g_object_unref (self);
+
+	return result;
 }
 
 BraseroTask *
@@ -520,7 +525,7 @@
 	BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_ERROR (session, error);
 }
 
-BraseroBurnResult
+static BraseroBurnResult
 brasero_burn_caps_can_blank_real (BraseroBurnCaps *self,
 				  BraseroMedia media,
 				  BraseroBurnFlag flags)
@@ -581,22 +586,29 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_can_blank (BraseroBurnCaps *self,
-			     BraseroBurnSession *session)
+brasero_burn_session_can_blank (BraseroBurnSession *session)
 {
 	BraseroMedia media;
 	BraseroBurnFlag flags;
+	BraseroBurnCaps *self;
+	BraseroBurnResult result;
+
+	self = brasero_burn_caps_get_default ();
 
 	media = brasero_burn_session_get_dest_media (session);
 	BRASERO_BURN_LOG_DISC_TYPE (media, "Testing blanking caps for");
 
 	if (media == BRASERO_MEDIUM_NONE) {
 		BRASERO_BURN_LOG ("no media => no blanking possible");
+		g_object_unref (self);
 		return BRASERO_BURN_NOT_SUPPORTED;
 	}
 
 	flags = brasero_burn_session_get_flags (session);
-	return brasero_burn_caps_can_blank_real (self, media, flags);
+	result = brasero_burn_caps_can_blank_real (self, media, flags);
+	g_object_unref (self);
+
+	return result;
 }
 
 /**
@@ -1231,7 +1243,7 @@
 				    "Creating recording/imaging task");
 
 	/* search the start caps and try to get a list of links */
-	last_caps = brasero_caps_find_start_caps (&output);
+	last_caps = brasero_caps_find_start_caps (self, &output);
 	if (!last_caps)
 		BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_ERROR (session, error);
 
@@ -1272,7 +1284,7 @@
 		 * is because we first have to blank the disc. If so add a blank 
 		 * task to the others as a first step */
 		if (!(session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
-		||    brasero_burn_caps_can_blank (self, session) != BRASERO_BURN_OK)
+		||    brasero_burn_session_can_blank (session) != BRASERO_BURN_OK)
 			BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_ERROR (session, error);
 
 		/* retry with the same disc type but blank this time */
@@ -1285,7 +1297,7 @@
 
 		output.subtype.media = media;
 
-		last_caps = brasero_caps_find_start_caps (&output);
+		last_caps = brasero_caps_find_start_caps (self, &output);
 		if (!last_caps)
 			BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_ERROR (session, error);
 
@@ -1722,7 +1734,8 @@
 }
 
 static gboolean
-brasero_caps_try_output (BraseroBurnFlag session_flags,
+brasero_caps_try_output (BraseroBurnCaps *self,
+			 BraseroBurnFlag session_flags,
 			 gboolean use_flags,
 			 BraseroTrackType *output,
 			 BraseroTrackType *input,
@@ -1732,7 +1745,7 @@
 	BraseroMedia media;
 
 	/* here we search the start caps */
-	caps = brasero_caps_find_start_caps (output);
+	caps = brasero_caps_find_start_caps (self, output);
 	if (!caps) {
 		BRASERO_BURN_LOG ("No caps available");
 		return FALSE;
@@ -1767,7 +1780,8 @@
 	if (use_flags)
 		session_flags = brasero_burn_session_get_flags (session);
 
-	result = brasero_caps_try_output (session_flags,
+	result = brasero_caps_try_output (self,
+					  session_flags,
 					  use_flags,
 					  output,
 					  input,
@@ -1795,7 +1809,7 @@
 	 * is because we first have to blank the disc. If so add a blank 
 	 * task to the others as a first step */
 	if ((use_flags && !(session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE))
-	||   brasero_burn_caps_can_blank (self, session) != BRASERO_BURN_OK)
+	||   brasero_burn_session_can_blank (session) != BRASERO_BURN_OK)
 		return FALSE;
 
 	BRASERO_BURN_LOG ("Trying with initial blanking");
@@ -1810,7 +1824,7 @@
 	media |= BRASERO_MEDIUM_BLANK;
 	output->subtype.media = media;
 
-	last_caps = brasero_caps_find_start_caps (output);
+	last_caps = brasero_caps_find_start_caps (self, output);
 	if (!last_caps)
 		return FALSE;
 
@@ -1823,17 +1837,20 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_is_input_supported (BraseroBurnCaps *self,
-				      BraseroBurnSession *session,
+brasero_burn_session_input_supported (BraseroBurnSession *session,
 				      BraseroTrackType *input,
 				      gboolean use_flags)
 {
 	gboolean result;
+	BraseroBurnCaps *self;
 	BraseroTrackType output;
 	BraseroPluginIOFlag io_flags;
 
-	if (use_flags && !brasero_burn_caps_flags_check_for_drive (session))
+	self = brasero_burn_caps_get_default ();
+	if (use_flags && !brasero_burn_caps_flags_check_for_drive (session)) {
+		g_object_unref (self);
 		BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
+	}
 
 	if (!brasero_burn_session_is_dest_file (session)) {
 		output.type = BRASERO_TRACK_TYPE_DISC;
@@ -1865,6 +1882,8 @@
 							input,
 							io_flags,
 							use_flags);
+	g_object_unref (self);
+
 	if (!result) {
 		BRASERO_BURN_LOG_TYPE (input, "Input not supported");
 		return BRASERO_BURN_NOT_SUPPORTED;
@@ -1874,14 +1893,16 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_is_output_supported (BraseroBurnCaps *self,
-				       BraseroBurnSession *session,
+brasero_burn_session_output_supported (BraseroBurnSession *session,
 				       BraseroTrackType *output)
 {
 	gboolean result;
+	BraseroBurnCaps *self;
 	BraseroTrackType input;
 	BraseroPluginIOFlag io_flags;
 
+	self = brasero_burn_caps_get_default ();
+
 	/* Here, we can't check if the drive supports the flags since the output
 	 * is hypothetical. There is no real medium. So forget the following :
 	 * if (!brasero_burn_caps_flags_check_for_drive (session))
@@ -1907,6 +1928,9 @@
 							&input,
 							io_flags,
 							TRUE);
+
+	g_object_unref (self);
+
 	if (!result) {
 		BRASERO_BURN_LOG_TYPE (output, "Output not supported");
 		return BRASERO_BURN_NOT_SUPPORTED;
@@ -2003,21 +2027,30 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_is_session_supported (BraseroBurnCaps *self,
-					BraseroBurnSession *session,
-					gboolean use_flags)
+brasero_burn_session_can_burn (BraseroBurnSession *session,
+			       gboolean use_flags)
 {
 	gboolean result;
+	BraseroBurnCaps *self;
 	BraseroTrackType input;
 	BraseroTrackType output;
 	BraseroPluginIOFlag io_flags;
 
+	self = brasero_burn_caps_get_default ();
+
 	/* Special case */
-	if (brasero_burn_session_same_src_dest_drive (session))
-		return brasero_burn_caps_is_session_supported_same_src_dest (self, session, use_flags);
+	if (brasero_burn_session_same_src_dest_drive (session)) {
+		BraseroBurnResult result;
+
+		result = brasero_burn_caps_is_session_supported_same_src_dest (self, session, use_flags);
+		g_object_unref (self);
+		return result;
+	}
 
-	if (use_flags && !brasero_burn_caps_flags_check_for_drive (session))
+	if (use_flags && !brasero_burn_caps_flags_check_for_drive (session)) {
+		g_object_unref (self);
 		BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
+	}
 
 	/* Here flags don't matter as we don't record anything.
 	 * Even the IOFlags since that can be checked later with
@@ -2054,6 +2087,9 @@
 							&input,
 							io_flags,
 							use_flags);
+
+	g_object_unref (self);
+
 	if (!result) {
 		BRASERO_BURN_LOG_TYPE (&output, "Output not supported");
 		return BRASERO_BURN_NOT_SUPPORTED;
@@ -2063,18 +2099,20 @@
 }
 
 BraseroMedia
-brasero_burn_caps_get_required_media_type (BraseroBurnCaps *self,
-					   BraseroBurnSession *session)
+brasero_burn_session_get_required_media_type (BraseroBurnSession *session)
 {
 	BraseroMedia required_media = BRASERO_MEDIUM_NONE;
 	BraseroBurnFlag session_flags;
 	BraseroPluginIOFlag io_flags;
 	BraseroTrackType input;
+	BraseroBurnCaps *self;
 	GSList *iter;
 
 	if (brasero_burn_session_is_dest_file (session))
 		return BRASERO_MEDIUM_FILE;
 
+	self = brasero_burn_caps_get_default ();
+
 	/* we try to determine here what type of medium is allowed to be burnt
 	 * to whether a CD or a DVD. Appendable, blank are not properties being
 	 * determined here. We just want it to be writable in a broad sense. */
@@ -2129,47 +2167,60 @@
 			  BRASERO_MEDIUM_CD|
 			  BRASERO_MEDIUM_DVD;
 
+	g_object_unref (self);
 	return required_media;
 }
 
 BraseroImageFormat
-brasero_burn_caps_get_default_output_format (BraseroBurnCaps *self,
-					     BraseroBurnSession *session)
+brasero_burn_session_get_default_output_format (BraseroBurnSession *session)
 {
+	BraseroBurnCaps *self;
 	BraseroTrackType source;
 	BraseroTrackType output;
 	BraseroBurnResult result;
 
-	if (!brasero_burn_session_is_dest_file (session))
+	self = brasero_burn_caps_get_default ();
+
+	if (!brasero_burn_session_is_dest_file (session)) {
+		g_object_unref (self);
 		return BRASERO_IMAGE_FORMAT_NONE;
+	}
 
 	brasero_burn_session_get_input_type (session, &source);
-	if (source.type == BRASERO_TRACK_TYPE_NONE)
+	if (source.type == BRASERO_TRACK_TYPE_NONE) {
+		g_object_unref (self);
 		return BRASERO_IMAGE_FORMAT_NONE;
+	}
 
-	if (source.type == BRASERO_TRACK_TYPE_IMAGE)
+	if (source.type == BRASERO_TRACK_TYPE_IMAGE) {
+		g_object_unref (self);
 		return source.subtype.img_format;
+	}
 
 	output.type = BRASERO_TRACK_TYPE_IMAGE;
 	output.subtype.img_format = BRASERO_IMAGE_FORMAT_NONE;
 
 	if (source.type == BRASERO_TRACK_TYPE_STREAM) {
 		/* If that's AUDIO only without VIDEO then return */
-		if (!(source.subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_VCD|BRASERO_VIDEO_FORMAT_VIDEO_DVD)))
+		if (!(source.subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED|BRASERO_VIDEO_FORMAT_VCD|BRASERO_VIDEO_FORMAT_VIDEO_DVD))) {
+			g_object_unref (self);
 			return BRASERO_IMAGE_FORMAT_NONE;
+		}
 
 		/* Otherwise try all possible image types */
 		output.subtype.img_format = BRASERO_IMAGE_FORMAT_CDRDAO;
 		for (; output.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
 		       output.subtype.img_format >>= 1) {
 		
-			result = brasero_burn_caps_is_output_supported (self,
-									session,
+			result = brasero_burn_session_output_supported (session,
 									&output);
-			if (result == BRASERO_BURN_OK)
+			if (result == BRASERO_BURN_OK) {
+				g_object_unref (self);
 				return output.subtype.img_format;
+			}
 		}
 
+		g_object_unref (self);
 		return BRASERO_IMAGE_FORMAT_NONE;
 	}
 
@@ -2177,9 +2228,11 @@
 	|| (source.type == BRASERO_TRACK_TYPE_DISC
 	&& (source.subtype.media & BRASERO_MEDIUM_DVD))) {
 		output.subtype.img_format = BRASERO_IMAGE_FORMAT_BIN;
-		result = brasero_burn_caps_is_output_supported (self,
-								session,
+		result = brasero_burn_session_output_supported (session,
 								&output);
+
+		g_object_unref (self);
+
 		if (result != BRASERO_BURN_OK)
 			return BRASERO_IMAGE_FORMAT_NONE;
 
@@ -2191,13 +2244,15 @@
 	for (; output.subtype.img_format != BRASERO_IMAGE_FORMAT_NONE;
 	       output.subtype.img_format >>= 1) {
 	
-		result = brasero_burn_caps_is_output_supported (self,
-								session,
+		result = brasero_burn_session_output_supported (session,
 								&output);
-		if (result == BRASERO_BURN_OK)
+		if (result == BRASERO_BURN_OK) {
+			g_object_unref (self);
 			return output.subtype.img_format;
+		}
 	}
 
+	g_object_unref (self);
 	return BRASERO_IMAGE_FORMAT_NONE;
 }
 
@@ -2383,7 +2438,8 @@
 }
 
 static BraseroBurnResult
-brasero_caps_get_flags_for_disc (BraseroBurnFlag session_flags,
+brasero_caps_get_flags_for_disc (BraseroBurnCaps *self,
+				 BraseroBurnFlag session_flags,
 				 BraseroMedia media,
 				 BraseroTrackType *input,
 				 BraseroBurnFlag *supported,
@@ -2399,7 +2455,7 @@
 	output.type = BRASERO_TRACK_TYPE_DISC;
 	output.subtype.media = media;
 
-	caps = brasero_caps_find_start_caps (&output);
+	caps = brasero_caps_find_start_caps (self, &output);
 	if (!caps) {
 		BRASERO_BURN_LOG_DISC_TYPE (media, "FLAGS: no caps could be found for");
 		return BRASERO_BURN_NOT_SUPPORTED;
@@ -2465,7 +2521,8 @@
 	BraseroBurnResult result;
 
 	/* See if medium is supported out of the box */
-	result = brasero_caps_get_flags_for_disc (session_flags,
+	result = brasero_caps_get_flags_for_disc (self,
+						  session_flags,
 						  media,
 						  input,
 						  supported_flags,
@@ -2520,7 +2577,8 @@
 			   BRASERO_MEDIUM_HAS_DATA|
 			   BRASERO_MEDIUM_HAS_AUDIO);
 		media |= BRASERO_MEDIUM_BLANK;
-		result = brasero_caps_get_flags_for_disc (session_flags,
+		result = brasero_caps_get_flags_for_disc (self,
+							  session_flags,
 							  media,
 							  input,
 							  supported_flags,
@@ -2663,12 +2721,12 @@
 }
 
 BraseroBurnResult
-brasero_burn_caps_get_flags (BraseroBurnCaps *self,
-			     BraseroBurnSession *session,
-			     BraseroBurnFlag *supported,
-			     BraseroBurnFlag *compulsory)
+brasero_burn_session_get_burn_flags (BraseroBurnSession *session,
+				     BraseroBurnFlag *supported,
+				     BraseroBurnFlag *compulsory)
 {
 	BraseroMedia media;
+	BraseroBurnCaps *self;
 	BraseroTrackType input;
 	BraseroBurnResult result;
 
@@ -2679,7 +2737,7 @@
 					  BRASERO_BURN_FLAG_CHECK_SIZE|
 					  BRASERO_BURN_FLAG_NOGRACE;
 
-	g_return_val_if_fail (BRASERO_IS_BURNCAPS (self), BRASERO_BURN_ERR);
+	self = brasero_burn_caps_get_default ();
 
 	brasero_burn_session_get_input_type (session, &input);
 	BRASERO_BURN_LOG_WITH_TYPE (&input,
@@ -2698,6 +2756,8 @@
 
 		BRASERO_BURN_LOG_FLAGS (supported_flags, "FLAGS: supported");
 		BRASERO_BURN_LOG_FLAGS (compulsory_flags, "FLAGS: compulsory");
+
+		g_object_unref (self);
 		return BRASERO_BURN_OK;
 	}
 
@@ -2726,6 +2786,7 @@
 		else
 			BRASERO_BURN_LOG ("No available flags for copy");
 
+		g_object_unref (self);
 		return result;
 	}
 
@@ -2739,12 +2800,15 @@
 	 * - APPEND and BLANK are incompatible */
 	if (!brasero_burn_caps_flags_check_for_drive (session)) {
 		BRASERO_BURN_LOG ("Session flags not supported by drive");
+		g_object_unref (self);
 		return BRASERO_BURN_ERR;
 	}
 
 	if ((session_flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND))
-	&&  (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE))
+	&&  (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)) {
+		g_object_unref (self);
 		return BRASERO_BURN_NOT_SUPPORTED;
+	}
 	
 	/* Let's get flags for recording */
 	media = brasero_burn_session_get_dest_media (session);
@@ -2755,6 +2819,8 @@
 							 &supported_flags,
 							 &compulsory_flags);
 
+	g_object_unref (self);
+
 	if (result != BRASERO_BURN_OK)
 		return result;
 
@@ -2879,7 +2945,7 @@
 }
 
 static BraseroCaps *
-brasero_caps_copy (BraseroCaps *caps)
+brasero_caps_duplicate (BraseroCaps *caps)
 {
 	BraseroCaps *retval;
 
@@ -2909,13 +2975,12 @@
 }
 
 static void
-brasero_caps_replicate_links (BraseroCaps *dest, BraseroCaps *src)
+brasero_caps_replicate_links (BraseroBurnCaps *self,
+			      BraseroCaps *dest,
+			      BraseroCaps *src)
 {
-	BraseroBurnCaps *self;
 	GSList *iter;
 
-	self = brasero_burn_caps_get_default ();
-
 	brasero_caps_link_list_duplicate (dest, src);
 
 	for (iter = self->priv->caps_list; iter; iter = iter->next) {
@@ -2942,13 +3007,12 @@
 }
 
 static void
-brasero_caps_replicate_tests (BraseroCaps *dest, BraseroCaps *src)
+brasero_caps_replicate_tests (BraseroBurnCaps *self,
+			      BraseroCaps *dest,
+			      BraseroCaps *src)
 {
-	BraseroBurnCaps *self;
 	GSList *iter;
 
-	self = brasero_burn_caps_get_default ();
-
 	for (iter = self->priv->tests; iter; iter = iter->next) {
 		BraseroCapsTest *test;
 		GSList *links;
@@ -2969,27 +3033,33 @@
 	}
 }
 
+static void
+brasero_caps_copy_deep (BraseroBurnCaps *self,
+			BraseroCaps *dest,
+			BraseroCaps *src)
+{
+	brasero_caps_replicate_links (self, dest, src);
+	brasero_caps_replicate_tests (self, dest, src);
+	brasero_caps_replicate_modifiers (dest,src);
+}
+
 static BraseroCaps *
-brasero_caps_copy_deep (BraseroCaps *caps)
+brasero_caps_duplicate_deep (BraseroBurnCaps *self,
+			     BraseroCaps *caps)
 {
 	BraseroCaps *retval;
-	BraseroBurnCaps *self;
 
-	self = brasero_burn_caps_get_default ();
-
-	retval = brasero_caps_copy (caps);
-	brasero_caps_replicate_links (retval, caps);
-	brasero_caps_replicate_tests (retval, caps);
+	retval = brasero_caps_duplicate (caps);
+	brasero_caps_copy_deep (self, retval, caps);
 	return retval;
 }
 
 static GSList *
-brasero_caps_list_check_io (GSList *list, BraseroPluginIOFlag flags)
+brasero_caps_list_check_io (BraseroBurnCaps *self,
+			    GSList *list,
+			    BraseroPluginIOFlag flags)
 {
 	GSList *iter;
-	BraseroBurnCaps *self;
-
-	self = brasero_burn_caps_get_default ();
 
 	/* in this function we create the caps with the missing IO. All in the
 	 * list have something in common with flags. */
@@ -3011,7 +3081,7 @@
 			self->priv->caps_list = g_slist_sort (self->priv->caps_list,
 							      brasero_burn_caps_sort);
 
-			new_caps = brasero_caps_copy_deep (caps);
+			new_caps = brasero_caps_duplicate_deep (self, caps);
 			new_caps->flags = common;
 
 			self->priv->caps_list = g_slist_insert_sorted (self->priv->caps_list,
@@ -3054,7 +3124,7 @@
 				 * create a new caps for this type with the
 				 * substraction of flags if the other part isn't
 				 * in the list */
-				new_caps = brasero_caps_copy (caps);
+				new_caps = brasero_caps_duplicate (caps);
 				new_caps->flags = flags & (~common);
 				self->priv->caps_list = g_slist_insert_sorted (self->priv->caps_list,
 									       new_caps,
@@ -3111,7 +3181,7 @@
 			self->priv->caps_list = g_slist_sort (self->priv->caps_list,
 							      brasero_burn_caps_sort);
 
-			caps = brasero_caps_copy_deep (caps);
+			caps = brasero_caps_duplicate_deep (self, caps);
 			caps->type.subtype.img_format = common;
 
 			self->priv->caps_list = g_slist_insert_sorted (self->priv->caps_list,
@@ -3125,7 +3195,7 @@
 
 	/* Now we make sure that all these new or already 
 	 * existing caps have the proper IO Flags */
-	retval = brasero_caps_list_check_io (retval, flags);
+	retval = brasero_caps_list_check_io (self, retval, flags);
 
 	if (remaining_format != BRASERO_IMAGE_FORMAT_NONE) {
 		BraseroCaps *caps;
@@ -3143,6 +3213,7 @@
 		BRASERO_BURN_LOG_TYPE (&caps->type, "Created new caps");
 	}
 
+	g_object_unref (self);
 	return retval;
 }
 
@@ -3221,7 +3292,7 @@
 
 	/* Now we make sure that all these new or already 
 	 * existing caps have the proper IO Flags */
-	retval = brasero_caps_list_check_io (retval, flags);
+	retval = brasero_caps_list_check_io (self, retval, flags);
 
 	if (!have_the_one) {
 		BraseroCaps *caps;
@@ -3236,9 +3307,7 @@
 				BraseroCaps *iter_caps;
 
 				iter_caps = iter->data;
-				brasero_caps_replicate_links (caps, iter_caps);
-				brasero_caps_replicate_tests (caps, iter_caps);
-				brasero_caps_replicate_modifiers (caps, iter_caps);
+				brasero_caps_copy_deep (self, caps, iter_caps);
 			}
 		}
 
@@ -3251,6 +3320,9 @@
 	}
 
 	g_slist_free (encompassing);
+
+	g_object_unref (self);
+
 	return retval;
 }
 
@@ -3267,6 +3339,7 @@
 					 fs_type,
 					 BRASERO_PLUGIN_IO_NONE,
 					 "New caps required");
+
 	self = brasero_burn_caps_get_default ();
 
 	for (iter = self->priv->caps_list; iter; iter = iter->next) {
@@ -3312,9 +3385,7 @@
 				BraseroCaps *iter_caps;
 
 				iter_caps = iter->data;
-				brasero_caps_replicate_links (caps, iter_caps);
-				brasero_caps_replicate_tests (caps, iter_caps);
-				brasero_caps_replicate_modifiers (caps, iter_caps);
+				brasero_caps_copy_deep (self, caps, iter_caps);
 			}
 		}
 
@@ -3325,20 +3396,21 @@
 	}
 
 	g_slist_free (encompassing);
+
+	g_object_unref (self);
+
 	return retval;
 }
 
 static GSList *
-brasero_caps_disc_lookup_or_create (GSList *retval,
+brasero_caps_disc_lookup_or_create (BraseroBurnCaps *self,
+				    GSList *retval,
 				    BraseroMedia media)
 {
 	GSList *iter;
 	BraseroCaps *caps;
 
-	if (!default_caps)
-		brasero_burn_caps_get_default ();
-
-	for (iter = default_caps->priv->caps_list; iter; iter = iter->next) {
+	for (iter = self->priv->caps_list; iter; iter = iter->next) {
 		caps = iter->data;
 
 		if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
@@ -3361,26 +3433,31 @@
 				    caps->flags,
 				    "Created");
 
-	default_caps->priv->caps_list = g_slist_prepend (default_caps->priv->caps_list, caps);
+	self->priv->caps_list = g_slist_prepend (self->priv->caps_list, caps);
+
 	return g_slist_prepend (retval, caps);
 }
 
 GSList *
 brasero_caps_disc_new (BraseroMedia type)
 {
+	BraseroBurnCaps *self;
 	GSList *retval = NULL;
 	GSList *list;
 	GSList *iter;
 
+	self = brasero_burn_caps_get_default ();
+
 	list = brasero_media_get_all_list (type);
 	for (iter = list; iter; iter = iter->next) {
 		BraseroMedia medium;
 
 		medium = GPOINTER_TO_INT (iter->data);
-		retval = brasero_caps_disc_lookup_or_create (retval, medium);
+		retval = brasero_caps_disc_lookup_or_create (self, retval, medium);
 	}
 	g_slist_free (list);
 
+	g_object_unref (self);
 	return retval;
 }
 
@@ -3500,6 +3577,7 @@
 
 	/* Find the the BraseroCapsTest for this type; if none create it */
 	self = brasero_burn_caps_get_default ();
+
 	for (iter = self->priv->tests; iter; iter = iter->next) {
 		BraseroCapsTest *tmp;
 
@@ -3578,6 +3656,7 @@
 	retval = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->groups, name));
 	if (retval) {
 		brasero_plugin_set_group (plugin, retval);
+		g_object_unref (self);
 		return;
 	}
 
@@ -3592,6 +3671,8 @@
 		self->priv->group_id = g_hash_table_size (self->priv->groups) + 1;
 
 	brasero_plugin_set_group (plugin, g_hash_table_size (self->priv->groups) + 1);
+
+	g_object_unref (self);
 }
 
 /** 
@@ -3626,12 +3707,15 @@
 				BraseroPlugin *tmp;
 
 				tmp = plugins->data;
-				if (tmp == plugin)
+				if (tmp == plugin) {
+					g_object_unref (self);
 					return BRASERO_BURN_OK;
+				}
 			}
 		}
 	}
 
+	g_object_unref (self);
 	return BRASERO_BURN_NOT_SUPPORTED;
 }
 
@@ -3668,12 +3752,15 @@
 				BraseroPlugin *tmp;
 
 				tmp = plugins->data;
-				if (tmp == plugin)
+				if (tmp == plugin) {
+					g_object_unref (self);
 					return BRASERO_BURN_OK;
+				}
 			}
 		}
 	}
 
+	g_object_unref (self);
 	return BRASERO_BURN_NOT_SUPPORTED;
 }
 
@@ -3684,6 +3771,7 @@
 	BraseroBurnCaps *self;
 
 	self = brasero_burn_caps_get_default ();
+
 	for (iter = self->priv->caps_list; iter; iter = iter->next) {
 		BraseroTrackDataType destination;
 		BraseroCaps *caps;
@@ -3709,12 +3797,16 @@
 				BraseroPlugin *tmp;
 
 				tmp = plugins->data;
-				if (tmp == plugin)
+				if (tmp == plugin) {
+					g_object_unref (self);
 					return BRASERO_BURN_OK;
+				}
 			}
 		}
 	}
 
+	g_object_unref (self);
+
 	return BRASERO_BURN_NOT_SUPPORTED;
 }
 
@@ -3751,8 +3843,10 @@
 		caps = NULL;
 	}
 
-	if (!caps)
+	if (!caps) {
+		g_object_unref (self);
 		return BRASERO_MEDIUM_NONE;
+	}
 
 	/* check the links */
 	for (links = caps->links; links; links = links->next) {
@@ -3792,11 +3886,12 @@
 		retval |= BRASERO_MEDIUM_WRITABLE;
 	}
 
+	g_object_unref (self);
 	return retval;
 }
 
 /**
- * This function is declared in burn-basics.h
+ * This function is declared in brasero-burn-lib.h
  * It can be used to determine whether or not brasero can do any checksuming.
  */
 
@@ -3808,8 +3903,10 @@
 
 	self = brasero_burn_caps_get_default ();
 
-	if (self->priv->tests == NULL)
+	if (self->priv->tests == NULL) {
+		g_object_unref (self);
 		return FALSE;
+	}
 
 	for (iter = self->priv->tests; iter; iter = iter->next) {
 		BraseroCapsTest *tmp;
@@ -3820,11 +3917,14 @@
 			BraseroCapsLink *link;
 
 			link = links->data;
-			if (brasero_caps_link_active (link))
+			if (brasero_caps_link_active (link)) {
+				g_object_unref (self);
 				return TRUE;
+			}
 		}
 	}
 
+	g_object_unref (self);
 	return FALSE;
 }
 
@@ -3849,6 +3949,8 @@
 					    "Created %i links pointing to",
 					    g_slist_length (caps->links));
 	}
+
+	g_object_unref (self);
 }
 
 
@@ -3871,10 +3973,13 @@
 		caps = iter->data;
 
 		if (brasero_caps_is_compatible_type (caps, type)
-		&&  brasero_burn_caps_is_input (self, caps))
+		&&  brasero_burn_caps_is_input (self, caps)) {
+			g_object_unref (self);
 			return BRASERO_BURN_OK;
+		}
 	}
 
+	g_object_unref (self);
 	return BRASERO_BURN_ERR;
 }
 

Modified: trunk/libbrasero-burn/burn-caps.h
==============================================================================
--- trunk/libbrasero-burn/burn-caps.h	(original)
+++ trunk/libbrasero-burn/burn-caps.h	Wed Apr  1 12:27:39 2009
@@ -39,7 +39,6 @@
 #include "brasero-session.h"
 #include "burn-plugin.h"
 #include "burn-task.h"
-#include "burn-caps.h"
 
 G_BEGIN_DECLS
 
@@ -82,52 +81,5 @@
 					BraseroBurnSession *session,
 					GError **error);
 
-/**
- * Test the supported or compulsory flags for a given session
- */
-
-BraseroBurnResult
-brasero_burn_caps_get_flags (BraseroBurnCaps *caps,
-			     BraseroBurnSession *session,
-			     BraseroBurnFlag *supported,
-			     BraseroBurnFlag *compulsory);
-
-BraseroBurnResult
-brasero_burn_caps_get_blanking_flags (BraseroBurnCaps *caps,
-				      BraseroBurnSession *session,
-				      BraseroBurnFlag *supported,
-				      BraseroBurnFlag *compulsory);
-
-/**
- * Used to test the possibilities offered for a given session
- */
-
-BraseroBurnResult
-brasero_burn_caps_can_blank (BraseroBurnCaps *caps,
-			     BraseroBurnSession *session);
-
-BraseroBurnResult
-brasero_burn_caps_is_input_supported (BraseroBurnCaps *caps,
-				      BraseroBurnSession *session,
-				      BraseroTrackType *input,
-				      gboolean use_flags);
-
-BraseroBurnResult
-brasero_burn_caps_is_output_supported (BraseroBurnCaps *caps,
-				       BraseroBurnSession *session,
-				       BraseroTrackType *output);
-
-BraseroBurnResult
-brasero_burn_caps_is_session_supported (BraseroBurnCaps *caps,
-					BraseroBurnSession *session,
-					gboolean use_flags);
-
-BraseroMedia
-brasero_burn_caps_get_required_media_type (BraseroBurnCaps *caps,
-					   BraseroBurnSession *session);
-
-BraseroImageFormat
-brasero_burn_caps_get_default_output_format (BraseroBurnCaps *caps,
-					     BraseroBurnSession *session);
 
 #endif /* BURN_CAPS_H */

Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c	(original)
+++ trunk/src/brasero-app.c	Wed Apr  1 12:27:39 2009
@@ -44,7 +44,6 @@
 
 #include "brasero-drive.h"
 
-#include "burn-caps.h"
 #include "burn-debug.h"
 
 #include "brasero-tags.h"

Modified: trunk/src/brasero-blank-dialog.c
==============================================================================
--- trunk/src/brasero-blank-dialog.c	(original)
+++ trunk/src/brasero-blank-dialog.c	Wed Apr  1 12:27:39 2009
@@ -36,7 +36,6 @@
 #include "brasero-misc.h"
 
 #include "burn-basics.h"
-#include "burn-caps.h"
 
 #include "brasero-session.h"
 #include "brasero-burn.h"
@@ -49,7 +48,6 @@
 
 struct BraseroBlankDialogPrivate {
 	BraseroBurnSession *session;
-	BraseroBurnCaps *caps;
 
 	GtkWidget *fast;
 
@@ -119,8 +117,7 @@
 	priv = BRASERO_BLANK_DIALOG_PRIVATE (self);
 
 	/* set the options */
-	brasero_burn_caps_get_blanking_flags (priv->caps,
-					      priv->session,
+	brasero_burn_session_get_blank_flags (priv->session,
 					      &supported,
 					      &compulsory);
 
@@ -133,7 +130,7 @@
 
 	/* This must be done afterwards, once the session flags were updated */
 	brasero_tool_dialog_set_valid (BRASERO_TOOL_DIALOG (self),
-				       (brasero_burn_caps_can_blank (priv->caps, priv->session) == BRASERO_BURN_OK));
+				       (brasero_burn_session_can_blank (priv->session) == BRASERO_BURN_OK));
 }
 
 static void
@@ -311,11 +308,6 @@
 		priv->caps_sig = 0;
 	}
 
-	if (priv->caps) {
-		g_object_unref (priv->caps);
-		priv->caps = NULL;
-	}
-
 	if (priv->output_sig) {
 		g_signal_handler_disconnect (priv->session, priv->output_sig);
 		priv->output_sig = 0;
@@ -382,7 +374,6 @@
 					     G_CALLBACK (brasero_blank_dialog_output_changed),
 					     obj);
 
-	priv->caps = brasero_burn_caps_get_default ();
 	manager = brasero_plugin_manager_get_default ();
 	priv->caps_sig = g_signal_connect (manager,
 					   "caps-changed",

Modified: trunk/src/brasero-data-session.c
==============================================================================
--- trunk/src/brasero-data-session.c	(original)
+++ trunk/src/brasero-data-session.c	Wed Apr  1 12:27:39 2009
@@ -29,9 +29,6 @@
 
 #include "brasero-media-private.h"
 
-#include "burn-basics.h"
-#include "burn-caps.h"
-
 #include "scsi-device.h"
 
 #include "brasero-drive.h"

Modified: trunk/src/brasero-plugin-manager-ui.c
==============================================================================
--- trunk/src/brasero-plugin-manager-ui.c	(original)
+++ trunk/src/brasero-plugin-manager-ui.c	Wed Apr  1 12:27:39 2009
@@ -40,7 +40,6 @@
 #include "brasero-plugin-manager-ui.h"
 
 #include "burn-plugin.h"
-#include "burn-caps.h"
 #include "burn-plugin-private.h"
 #include "burn-plugin-manager.h"
 #include "brasero-plugin-option.h"
@@ -347,7 +346,6 @@
 {
 	BraseroPluginManagerUIPrivate *priv;
 	BraseroPlugin *plugin;
-	BraseroBurnCaps *caps;
 	const GSList *plugins;
 	GtkListStore *model;
 	GtkTreeIter iter;
@@ -355,8 +353,6 @@
 	priv = BRASERO_PLUGIN_MANAGER_UI_GET_PRIVATE (pm);
 	plugins = priv->plugins;
 
-	caps = brasero_burn_caps_get_default ();
-
 	model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree)));
 
 	for (; plugins; plugins = plugins->next) {
@@ -373,7 +369,6 @@
 				    PLUGIN_COLUMN, plugin,
 				    -1);
 	}
-	g_object_unref (caps);
 
 	plugin = NULL;
 	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))

Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c	(original)
+++ trunk/src/brasero-project-manager.c	Wed Apr  1 12:27:39 2009
@@ -45,7 +45,6 @@
 #include "brasero-uri-container.h"
 #include "brasero-project-type-chooser.h"
 #include "brasero-io.h"
-#include "burn-caps.h"
 #include "brasero-medium-monitor.h"
 
 #ifdef BUILD_SEARCH



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