[brasero] Second preparatory step for having brasero integrate with PackageKit
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Second preparatory step for having brasero integrate with PackageKit
- Date: Sun, 1 Nov 2009 21:00:46 +0000 (UTC)
commit 1261d6f85b64b46dd206b9c1213afaf0b861a22c
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Wed Oct 28 16:07:36 2009 +0100
Second preparatory step for having brasero integrate with PackageKit
For all tests done on a BraseroBurnSession object let the possibility to ignore errors related to a plugin missing an application, a library or a gstreamer plugin
Add also another flag that lets a plugin signal that he is missing such things
Some additional code cleanups and update
Make sure we checked that the BraseroBurnSession is ready in brasero-project.c before engaging into any operation
libbrasero-burn/brasero-burn.c | 21 ++-
libbrasero-burn/brasero-caps-burn.c | 10 +-
libbrasero-burn/brasero-caps-session.c | 271 +++++++++++++++-----------
libbrasero-burn/brasero-plugin-information.h | 8 +-
libbrasero-burn/brasero-plugin-private.h | 6 +
libbrasero-burn/brasero-plugin.h | 4 +-
libbrasero-burn/brasero-session-cfg.c | 21 +--
libbrasero-burn/brasero-session-helper.h | 2 +-
libbrasero-burn/brasero-session.c | 65 ++++++-
libbrasero-burn/brasero-session.h | 20 ++-
libbrasero-burn/brasero-status-dialog.c | 10 +-
libbrasero-burn/burn-basics.c | 4 +-
libbrasero-burn/burn-caps.c | 38 ++++-
libbrasero-burn/burn-caps.h | 7 +-
libbrasero-burn/burn-plugin-manager.c | 50 ++++--
libbrasero-burn/burn-plugin-manager.h | 7 +
libbrasero-burn/burn-plugin.c | 65 +++++--
src/brasero-plugin-manager-ui.c | 6 +-
src/brasero-project.c | 24 ++-
19 files changed, 443 insertions(+), 196 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn.c b/libbrasero-burn/brasero-burn.c
index 4d6b449..6c0b82d 100644
--- a/libbrasero-burn/brasero-burn.c
+++ b/libbrasero-burn/brasero-burn.c
@@ -814,12 +814,17 @@ brasero_burn_lock_dest_media (BraseroBurn *burn,
goto end;
}
- /* make sure that media is supported and can be written to */
- /* make sure that media is supported.
- * Since we did not check the flags and
- * and since they might change check if the
- * session is supported without the flags */
- result = brasero_burn_session_can_burn (priv->session, FALSE);
+ /* Make sure that media is supported and
+ * can be written to */
+
+ /* NOTE: Since we did not check the flags
+ * and since they might change, check if the
+ * session is supported without the flags.
+ * We use quite a strict checking though as
+ * from now on we require plugins to be
+ * ready. */
+ brasero_burn_session_set_check_flags (priv->session, 0);
+ result = brasero_burn_session_supported (priv->session);
if (result != BRASERO_BURN_OK) {
BRASERO_BURN_LOG ("Inserted media is not supported");
result = BRASERO_BURN_NEED_RELOAD;
@@ -1698,7 +1703,7 @@ brasero_burn_check_session_consistency (BraseroBurn *burn,
&supported,
&compulsory);
else
- result = brasero_caps_session_get_file_flags (input,
+ result = brasero_caps_session_get_image_flags (input,
output,
&supported,
&compulsory);
@@ -1726,7 +1731,7 @@ brasero_burn_check_session_consistency (BraseroBurn *burn,
&supported,
&compulsory);
else
- result = brasero_caps_session_get_file_flags (input,
+ result = brasero_caps_session_get_image_flags (input,
output,
&supported,
&compulsory);
diff --git a/libbrasero-burn/brasero-caps-burn.c b/libbrasero-burn/brasero-caps-burn.c
index ded708c..b9a16a9 100644
--- a/libbrasero-burn/brasero-caps-burn.c
+++ b/libbrasero-burn/brasero-caps-burn.c
@@ -121,7 +121,7 @@ brasero_caps_link_find_plugin (BraseroCapsLink *link,
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
if (output->type == BRASERO_TRACK_TYPE_DISC) {
@@ -449,7 +449,7 @@ brasero_caps_add_processing_plugins_to_task (BraseroBurnSession *session,
GType type;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
brasero_plugin_get_process_flags (plugin, &flags);
@@ -812,7 +812,7 @@ brasero_burn_caps_new_checksuming_task (BraseroBurnCaps *self,
BraseroPlugin *plugin;
plugin = plugins->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
/* note for checksuming task there is no group possible */
@@ -891,7 +891,7 @@ brasero_burn_caps_new_checksuming_task (BraseroBurnCaps *self,
plugin = plugins->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
if (!candidate_plugin)
@@ -975,7 +975,7 @@ brasero_burn_caps_new_blanking_task (BraseroBurnCaps *self,
plugin = plugins->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
if (!brasero_plugin_check_blank_flags (plugin, media, flags))
diff --git a/libbrasero-burn/brasero-caps-session.c b/libbrasero-burn/brasero-caps-session.c
index 54c5884..a721897 100644
--- a/libbrasero-burn/brasero-caps-session.c
+++ b/libbrasero-burn/brasero-caps-session.c
@@ -58,6 +58,7 @@
static BraseroBurnResult
brasero_burn_caps_get_blanking_flags_real (BraseroBurnCaps *caps,
+ BraseroSessionCheckFlags support_flags,
BraseroMedia media,
BraseroBurnFlag session_flags,
BraseroBurnFlag *supported,
@@ -65,6 +66,7 @@ brasero_burn_caps_get_blanking_flags_real (BraseroBurnCaps *caps,
{
GSList *iter;
gboolean supported_media;
+ BraseroPluginActiveFlags plugin_flags;
BraseroBurnFlag supported_flags = BRASERO_BURN_FLAG_NONE;
BraseroBurnFlag compulsory_flags = BRASERO_BURN_FLAG_ALL;
@@ -78,6 +80,8 @@ brasero_burn_caps_get_blanking_flags_real (BraseroBurnCaps *caps,
return BRASERO_BURN_NOT_SUPPORTED;
}
+ plugin_flags = (support_flags & BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS)? BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS:0;
+
supported_media = FALSE;
for (iter = caps->priv->caps_list; iter; iter = iter->next) {
BraseroCaps *caps;
@@ -109,7 +113,7 @@ brasero_burn_caps_get_blanking_flags_real (BraseroBurnCaps *caps,
BraseroBurnFlag compulsory_plugin;
plugin = plugins->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
if (!brasero_plugin_get_blank_flags (plugin,
@@ -196,6 +200,7 @@ brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
self = brasero_burn_caps_get_default ();
result = brasero_burn_caps_get_blanking_flags_real (self,
+ brasero_burn_session_get_check_flags (session),
media,
session_flags,
supported,
@@ -207,10 +212,12 @@ brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
static BraseroBurnResult
brasero_burn_caps_can_blank_real (BraseroBurnCaps *self,
+ BraseroSessionCheckFlags support_flags,
BraseroMedia media,
BraseroBurnFlag flags)
{
GSList *iter;
+ BraseroPluginActiveFlags plugin_flags;
BRASERO_BURN_LOG_DISC_TYPE (media, "Testing blanking caps for");
if (media == BRASERO_MEDIUM_NONE) {
@@ -228,6 +235,7 @@ brasero_burn_caps_can_blank_real (BraseroBurnCaps *self,
return BRASERO_BURN_NOT_SUPPORTED;
}
+ plugin_flags = (support_flags & BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS)? BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS:0;
for (iter = self->priv->caps_list; iter; iter = iter->next) {
BraseroCaps *caps;
GSList *links;
@@ -236,7 +244,7 @@ brasero_burn_caps_can_blank_real (BraseroBurnCaps *self,
if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
continue;
- if ((media & caps->type.subtype.media) != media)
+ if ((media & brasero_track_type_get_medium_type (&caps->type)) != media)
continue;
BRASERO_BURN_LOG_TYPE (&caps->type, "Searching links for caps");
@@ -259,7 +267,7 @@ brasero_burn_caps_can_blank_real (BraseroBurnCaps *self,
BraseroPlugin *plugin;
plugin = plugins->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
if (brasero_plugin_check_blank_flags (plugin, media, flags)) {
@@ -296,6 +304,7 @@ brasero_burn_session_can_blank (BraseroBurnSession *session)
BraseroBurnFlag flags;
BraseroBurnCaps *self;
BraseroBurnResult result;
+ BraseroSessionCheckFlags support_flags;
self = brasero_burn_caps_get_default ();
@@ -309,7 +318,11 @@ brasero_burn_session_can_blank (BraseroBurnSession *session)
}
flags = brasero_burn_session_get_flags (session);
- result = brasero_burn_caps_can_blank_real (self, media, flags);
+ support_flags = brasero_burn_session_get_check_flags (session);
+ result = brasero_burn_caps_can_blank_real (self,
+ support_flags,
+ media,
+ flags);
g_object_unref (self);
return result;
@@ -317,6 +330,7 @@ brasero_burn_session_can_blank (BraseroBurnSession *session)
static void
brasero_caps_link_get_record_flags (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags,
BraseroMedia media,
BraseroBurnFlag session_flags,
BraseroBurnFlag *supported,
@@ -335,7 +349,7 @@ brasero_caps_link_get_record_flags (BraseroCapsLink *link,
BraseroBurnFlag plugin_compulsory;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
result = brasero_plugin_get_record_flags (plugin,
@@ -355,6 +369,7 @@ brasero_caps_link_get_record_flags (BraseroCapsLink *link,
static void
brasero_caps_link_get_data_flags (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags,
BraseroMedia media,
BraseroBurnFlag session_flags,
BraseroBurnFlag *supported)
@@ -369,7 +384,7 @@ brasero_caps_link_get_data_flags (BraseroCapsLink *link,
BraseroBurnFlag plugin_compulsory;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
result = brasero_plugin_get_image_flags (plugin,
@@ -383,6 +398,7 @@ brasero_caps_link_get_data_flags (BraseroCapsLink *link,
static gboolean
brasero_caps_link_check_data_flags (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags,
BraseroBurnFlag session_flags,
BraseroMedia media)
{
@@ -403,7 +419,7 @@ brasero_caps_link_check_data_flags (BraseroCapsLink *link,
BraseroPlugin *plugin;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
result = brasero_plugin_check_image_flags (plugin,
@@ -418,6 +434,7 @@ brasero_caps_link_check_data_flags (BraseroCapsLink *link,
static gboolean
brasero_caps_link_check_record_flags (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags,
BraseroBurnFlag session_flags,
BraseroMedia media)
{
@@ -436,7 +453,7 @@ brasero_caps_link_check_record_flags (BraseroCapsLink *link,
BraseroPlugin *plugin;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
result = brasero_plugin_check_record_flags (plugin,
@@ -451,6 +468,7 @@ brasero_caps_link_check_record_flags (BraseroCapsLink *link,
static gboolean
brasero_caps_link_check_media_restrictions (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags,
BraseroMedia media)
{
GSList *iter;
@@ -461,7 +479,7 @@ brasero_caps_link_check_media_restrictions (BraseroCapsLink *link,
BraseroPlugin *plugin;
plugin = iter->data;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, plugin_flags))
continue;
result = brasero_plugin_check_media_restrictions (plugin, media);
@@ -475,12 +493,13 @@ brasero_caps_link_check_media_restrictions (BraseroCapsLink *link,
static gboolean
brasero_caps_find_link (BraseroCaps *caps,
BraseroBurnFlag session_flags,
- gboolean use_flags,
+ BraseroSessionCheckFlags support_flags,
BraseroMedia media,
BraseroTrackType *input,
BraseroPluginIOFlag io_flags)
{
GSList *iter;
+ BraseroPluginActiveFlags plugin_check_flags = 0;
BRASERO_BURN_LOG_WITH_TYPE (&caps->type, BRASERO_PLUGIN_IO_NONE, "find_link");
@@ -496,6 +515,8 @@ brasero_caps_find_link (BraseroCaps *caps,
* input
*/
+ plugin_check_flags = ((support_flags & BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS)? BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS:0);
+
for (iter = caps->links; iter; iter = iter->next) {
BraseroCapsLink *link;
gboolean result;
@@ -506,25 +527,25 @@ brasero_caps_find_link (BraseroCaps *caps,
continue;
/* check that the link has some active plugin */
- if (!brasero_caps_link_active (link))
+ if (!brasero_caps_link_active (link, plugin_check_flags))
continue;
/* since this link contains recorders, check that at least one
* of them can handle the record flags */
- if (use_flags
- && caps->type.type == BRASERO_TRACK_TYPE_DISC
- && !brasero_caps_link_check_record_flags (link, session_flags, media))
+ if ((support_flags & BRASERO_SESSION_CHECK_USE_FLAGS)
+ && brasero_track_type_get_has_medium (&caps->type)
+ && !brasero_caps_link_check_record_flags (link, plugin_check_flags, session_flags, media))
continue;
/* first see if that's the perfect fit:
* - it must have the same caps (type + subtype)
* - it must have the proper IO */
if (link->caps->type.type == BRASERO_TRACK_TYPE_DATA) {
- if (use_flags
- && !brasero_caps_link_check_data_flags (link, session_flags, media))
+ if ((support_flags & BRASERO_SESSION_CHECK_USE_FLAGS)
+ && !brasero_caps_link_check_data_flags (link, plugin_check_flags, session_flags, media))
continue;
}
- else if (!brasero_caps_link_check_media_restrictions (link, media))
+ else if (!brasero_caps_link_check_media_restrictions (link, plugin_check_flags, media))
continue;
if ((link->caps->flags & BRASERO_PLUGIN_IO_ACCEPT_FILE)
@@ -541,12 +562,24 @@ brasero_caps_find_link (BraseroCaps *caps,
/* try to see where the inputs of this caps leads to */
result = brasero_caps_find_link (link->caps,
session_flags,
- use_flags,
+ support_flags,
media,
input,
io_flags);
- if (result)
+ if (result) {
+ if (support_flags & BRASERO_SESSION_CHECK_SIGNAL_PLUGIN_ERRORS) {
+ BraseroPlugin *plugin;
+
+ /* If we are supposed to report/signal that the plugin
+ * could be used but only if some more elements are
+ * installed */
+ plugin = brasero_caps_link_need_download (link);
+ if (plugin)
+ brasero_plugin_need_download (plugin);
+ }
+
return TRUE;
+ }
}
return FALSE;
@@ -555,7 +588,7 @@ brasero_caps_find_link (BraseroCaps *caps,
static gboolean
brasero_caps_try_output (BraseroBurnCaps *self,
BraseroBurnFlag session_flags,
- gboolean use_flags,
+ BraseroSessionCheckFlags support_flags,
BraseroTrackType *output,
BraseroTrackType *input,
BraseroPluginIOFlag flags)
@@ -577,7 +610,7 @@ brasero_caps_try_output (BraseroBurnCaps *self,
return brasero_caps_find_link (caps,
session_flags,
- use_flags,
+ support_flags,
media,
input,
flags);
@@ -588,20 +621,21 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
BraseroBurnSession *session,
BraseroTrackType *output,
BraseroTrackType *input,
- BraseroPluginIOFlag io_flags,
- gboolean use_flags)
+ BraseroPluginIOFlag io_flags)
{
gboolean result;
BraseroMedia media;
BraseroCaps *last_caps;
+ BraseroSessionCheckFlags support_flags;
BraseroBurnFlag session_flags = BRASERO_BURN_FLAG_NONE;
- if (use_flags)
+ support_flags = brasero_burn_session_get_check_flags (session);
+ if (support_flags & BRASERO_SESSION_CHECK_USE_FLAGS)
session_flags = brasero_burn_session_get_flags (session);
result = brasero_caps_try_output (self,
session_flags,
- use_flags,
+ support_flags,
output,
input,
io_flags);
@@ -618,7 +652,7 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
* handle this flag (means that the plugin should erase and
* then write on its own. Basically that works only with
* overwrite formatted discs, DVD+RW, ...) */
- if (output->type != BRASERO_TRACK_TYPE_DISC)
+ if (!brasero_track_type_get_has_medium (output))
return FALSE;
/* output is a disc try with initial blanking */
@@ -627,7 +661,8 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
/* apparently nothing can be done to reach our goal. Maybe that
* 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))
+ if (((support_flags & BRASERO_SESSION_CHECK_USE_FLAGS)
+ && !(session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE))
|| brasero_burn_session_can_blank (session) != BRASERO_BURN_OK)
return FALSE;
@@ -641,7 +676,7 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
BRASERO_MEDIUM_HAS_DATA|
BRASERO_MEDIUM_HAS_AUDIO);
media |= BRASERO_MEDIUM_BLANK;
- output->subtype.media = media;
+ brasero_track_type_set_medium_type (output, media);
last_caps = brasero_burn_caps_find_start_caps (self, output);
if (!last_caps)
@@ -649,7 +684,7 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
return brasero_caps_find_link (last_caps,
session_flags,
- use_flags,
+ support_flags,
media,
input,
io_flags);
@@ -675,34 +710,30 @@ brasero_caps_try_output_with_blanking (BraseroBurnCaps *self,
BraseroBurnResult
brasero_burn_session_input_supported (BraseroBurnSession *session,
- BraseroTrackType *input,
- gboolean use_flags)
+ BraseroTrackType *input)
{
gboolean result;
BraseroBurnCaps *self;
BraseroTrackType output;
BraseroPluginIOFlag io_flags;
+ BraseroSessionCheckFlags support_flags;
- if (use_flags) {
+ result = brasero_burn_session_get_output_type (session, &output);
+ if (result != BRASERO_BURN_OK)
+ BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
+
+ BRASERO_BURN_LOG_TYPE (input, "Checking support for input");
+ BRASERO_BURN_LOG_TYPE (&output, "and output");
+
+ support_flags = brasero_burn_session_get_check_flags (session);
+ if (support_flags & BRASERO_SESSION_CHECK_USE_FLAGS) {
result = brasero_check_flags_for_drive (brasero_burn_session_get_burner (session),
brasero_burn_session_get_flags (session));
if (!result)
BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
- }
- self = brasero_burn_caps_get_default ();
- if (!brasero_burn_session_is_dest_file (session)) {
- output.type = BRASERO_TRACK_TYPE_DISC;
- output.subtype.media = brasero_burn_session_get_dest_media (session);
-
- /* NOTE: for the special case where a disc could be rewritten
- * and cannot be handled as such but needs prior blanking, we
- * handle that situation in previous function.*/
- }
- else {
- output.type = BRASERO_TRACK_TYPE_IMAGE;
- output.subtype.img_format = brasero_burn_session_get_output_format (session);
+ BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
}
if (BRASERO_BURN_SESSION_NO_TMP_FILE (session))
@@ -710,18 +741,12 @@ brasero_burn_session_input_supported (BraseroBurnSession *session,
else
io_flags = BRASERO_PLUGIN_IO_ACCEPT_FILE;
- BRASERO_BURN_LOG_TYPE (input, "Checking support for input");
- BRASERO_BURN_LOG_TYPE (&output, "and output");
-
- if (use_flags)
- BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
-
+ self = brasero_burn_caps_get_default ();
result = brasero_caps_try_output_with_blanking (self,
session,
&output,
input,
- io_flags,
- use_flags);
+ io_flags);
g_object_unref (self);
if (!result) {
@@ -776,8 +801,7 @@ brasero_burn_session_output_supported (BraseroBurnSession *session,
session,
output,
&input,
- io_flags,
- TRUE);
+ io_flags);
g_object_unref (self);
@@ -797,8 +821,7 @@ brasero_burn_session_output_supported (BraseroBurnSession *session,
static BraseroBurnResult
brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
BraseroBurnSession *session,
- BraseroTrackType *tmp_type,
- gboolean use_flags)
+ BraseroTrackType *tmp_type)
{
GSList *iter;
gboolean supported;
@@ -807,6 +830,7 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
BraseroTrackType output;
BraseroImageFormat format;
BraseroBurnFlag session_flags;
+ BraseroSessionCheckFlags support_flags;
BRASERO_BURN_LOG ("Checking disc copy support with same source and destination");
@@ -817,7 +841,8 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
brasero_burn_session_get_input_type (session, &input);
BRASERO_BURN_LOG_TYPE (&input, "input");
- if (use_flags) {
+ support_flags = brasero_burn_session_get_check_flags (session);
+ if (support_flags & BRASERO_SESSION_CHECK_USE_FLAGS) {
/* NOTE: DAO can be a problem. So just in case remove it. It is
* not really useful in this context. What we want here is to
* know whether a medium can be used given the input; only 1
@@ -843,7 +868,7 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
BRASERO_BURN_LOG_TYPE (&output, "Testing stream type");
supported = brasero_caps_try_output (self,
session_flags,
- use_flags,
+ support_flags,
&output,
&input,
BRASERO_PLUGIN_IO_ACCEPT_FILE);
@@ -874,7 +899,7 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
continue;
result = brasero_caps_find_link (caps,
- use_flags,
+ support_flags,
session_flags,
caps->type.subtype.media,
&output,
@@ -911,7 +936,7 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
* image */
supported = brasero_caps_try_output (self,
session_flags,
- use_flags,
+ support_flags,
&output,
&input,
BRASERO_PLUGIN_IO_ACCEPT_FILE);
@@ -945,7 +970,7 @@ brasero_burn_caps_is_session_supported_same_src_dest (BraseroBurnCaps *self,
continue;
result = brasero_caps_find_link (caps,
- use_flags,
+ support_flags,
session_flags,
caps->type.subtype.media,
&output,
@@ -979,23 +1004,21 @@ brasero_burn_session_get_tmp_image_type_same_src_dest (BraseroBurnSession *sessi
self = brasero_burn_caps_get_default ();
result = brasero_burn_caps_is_session_supported_same_src_dest (self,
session,
- image_type,
- TRUE);
+ image_type);
g_object_unref (self);
return result;
}
/**
- * brasero_burn_session_can_burn:
+ * brasero_burn_session_supported:
* @session: a #BraseroBurnSession
- * @use_flags: a #gboolean
+ * @flags: a #BraseroSessionCheckFlags
*
* Given the various parameters stored in @session, this
* function checks whether the data contained in @session
* can be burnt to the medium in the #BraseroDrive (set
* through brasero_burn_session_set_burner ()).
- * If @use_flags is set to TRUE the flags are taken into
- * account, otherwise they are not.
+ * If @flags determine the behavior of this function.
*
* Return value: a #BraseroBurnResult.
* BRASERO_BURN_OK if it is possible.
@@ -1003,34 +1026,44 @@ brasero_burn_session_get_tmp_image_type_same_src_dest (BraseroBurnSession *sessi
**/
BraseroBurnResult
-brasero_burn_session_can_burn (BraseroBurnSession *session,
- gboolean use_flags)
+brasero_burn_session_supported (BraseroBurnSession *session)
{
gboolean result;
BraseroBurnCaps *self;
BraseroTrackType input;
BraseroTrackType output;
BraseroPluginIOFlag io_flags;
-
- self = brasero_burn_caps_get_default ();
+ BraseroSessionCheckFlags support_flags;
/* Special case */
if (brasero_burn_session_same_src_dest_drive (session)) {
BraseroBurnResult res;
- res = brasero_burn_caps_is_session_supported_same_src_dest (self, session, NULL, use_flags);
+ self = brasero_burn_caps_get_default ();
+ res = brasero_burn_caps_is_session_supported_same_src_dest (self, session, NULL);
g_object_unref (self);
+
return res;
}
- if (use_flags) {
+ result = brasero_burn_session_get_output_type (session, &output);
+ if (result != BRASERO_BURN_OK)
+ BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
+
+ brasero_burn_session_get_input_type (session, &input);
+
+ BRASERO_BURN_LOG_TYPE (&output, "Checking support for session. Ouput is ");
+ BRASERO_BURN_LOG_TYPE (&input, "and input is ");
+
+ support_flags = brasero_burn_session_get_check_flags (session);
+ if (support_flags & BRASERO_SESSION_CHECK_USE_FLAGS) {
result = brasero_check_flags_for_drive (brasero_burn_session_get_burner (session),
brasero_burn_session_get_flags (session));
- if (!result) {
- g_object_unref (self);
+ if (!result)
BRASERO_BURN_CAPS_NOT_SUPPORTED_LOG_RES (session);
- }
+
+ BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
}
/* Here flags don't matter as we don't record anything.
@@ -1041,38 +1074,16 @@ brasero_burn_session_can_burn (BraseroBurnSession *session,
else
io_flags = BRASERO_PLUGIN_IO_ACCEPT_FILE;
- brasero_burn_session_get_input_type (session, &input);
-
- if (!brasero_burn_session_is_dest_file (session)) {
- output.type = BRASERO_TRACK_TYPE_DISC;
- output.subtype.media = brasero_burn_session_get_dest_media (session);
-
- /* NOTE: for the special case where a disc could be rewritten
- * and cannot be handled as such but needs prior blanking, we
- * handle that situation in previous function.*/
- }
- else {
- output.type = BRASERO_TRACK_TYPE_IMAGE;
- output.subtype.img_format = brasero_burn_session_get_output_format (session);
- }
-
- BRASERO_BURN_LOG_TYPE (&output, "Checking support for session output");
- BRASERO_BURN_LOG_TYPE (&input, "and input");
-
- if (use_flags)
- BRASERO_BURN_LOG_FLAGS (brasero_burn_session_get_flags (session), "with flags");
-
+ self = brasero_burn_caps_get_default ();
result = brasero_caps_try_output_with_blanking (self,
session,
&output,
&input,
- io_flags,
- use_flags);
-
+ io_flags);
g_object_unref (self);
if (!result) {
- BRASERO_BURN_LOG_TYPE (&output, "Output not supported");
+ BRASERO_BURN_LOG_TYPE (&output, "Session not supported");
return BRASERO_BURN_NOT_SUPPORTED;
}
@@ -1080,6 +1091,27 @@ brasero_burn_session_can_burn (BraseroBurnSession *session,
}
/**
+ * brasero_burn_session_can_burn:
+ * @session: a #BraseroBurnSession
+ * @use_flags: a #gboolean
+ *
+ * This is now just a wrapper around brasero_burn_session_supported ().
+ *
+ * Deprecated since 2.29.2
+ *
+ * Return value: a #BraseroBurnResult.
+ * BRASERO_BURN_OK if it is possible.
+ * BRASERO_BURN_ERR otherwise.
+ **/
+
+BraseroBurnResult
+brasero_burn_session_can_burn (BraseroBurnSession *session,
+ gboolean use_flags)
+{
+ return brasero_burn_session_supported (session);
+}
+
+/**
* brasero_burn_session_get_required_media_type:
* @session: a #BraseroBurnSession
*
@@ -1303,6 +1335,7 @@ brasero_burn_session_get_default_output_format (BraseroBurnSession *session)
static BraseroPluginIOFlag
brasero_caps_get_flags (BraseroCaps *caps,
+ BraseroSessionCheckFlags check_flags,
BraseroBurnFlag session_flags,
BraseroMedia media,
BraseroTrackType *input,
@@ -1311,8 +1344,11 @@ brasero_caps_get_flags (BraseroCaps *caps,
BraseroBurnFlag *compulsory)
{
GSList *iter;
+ BraseroPluginActiveFlags plugin_flags;
BraseroPluginIOFlag retval = BRASERO_PLUGIN_IO_NONE;
+ plugin_flags = (check_flags & BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS)? BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS:0;
+
/* First we must know if this link leads somewhere. It must
* accept the already existing flags. If it does, see if it
* accepts the input and if not, if one of its ancestors does */
@@ -1329,13 +1365,14 @@ brasero_caps_get_flags (BraseroCaps *caps,
continue;
/* check that the link has some active plugin */
- if (!brasero_caps_link_active (link))
+ if (!brasero_caps_link_active (link, plugin_flags))
continue;
- if (caps->type.type == BRASERO_TRACK_TYPE_DISC) {
+ if (brasero_track_type_get_has_medium (&caps->type)) {
BraseroBurnFlag tmp;
brasero_caps_link_get_record_flags (link,
+ plugin_flags,
media,
session_flags,
&rec_supported,
@@ -1348,10 +1385,11 @@ brasero_caps_get_flags (BraseroCaps *caps,
continue;
}
- if (link->caps->type.type == BRASERO_TRACK_TYPE_DATA) {
+ if (brasero_track_type_get_has_data (&link->caps->type)) {
BraseroBurnFlag tmp;
brasero_caps_link_get_data_flags (link,
+ plugin_flags,
media,
session_flags,
&data_supported);
@@ -1364,7 +1402,7 @@ brasero_caps_get_flags (BraseroCaps *caps,
if ((tmp & data_supported) != tmp)
continue;
}
- else if (!brasero_caps_link_check_media_restrictions (link, media))
+ else if (!brasero_caps_link_check_media_restrictions (link, plugin_flags, media))
continue;
/* see if that's the perfect fit */
@@ -1390,6 +1428,7 @@ brasero_caps_get_flags (BraseroCaps *caps,
/* try to see where the inputs of this caps leads to */
io_flags = brasero_caps_get_flags (link->caps,
+ check_flags,
session_flags,
media,
input,
@@ -1476,6 +1515,7 @@ brasero_burn_caps_flags_update_for_drive (BraseroBurnSession *session,
static BraseroBurnResult
brasero_caps_get_flags_for_disc (BraseroBurnCaps *self,
+ BraseroSessionCheckFlags check_flags,
BraseroBurnFlag session_flags,
BraseroMedia media,
BraseroTrackType *input,
@@ -1489,8 +1529,8 @@ brasero_caps_get_flags_for_disc (BraseroBurnCaps *self,
BraseroCaps *caps;
/* create the output to find first caps */
- output.type = BRASERO_TRACK_TYPE_DISC;
- output.subtype.media = media;
+ brasero_track_type_set_has_medium (&output);
+ brasero_track_type_set_medium_type (&output, media);
caps = brasero_burn_caps_find_start_caps (self, &output);
if (!caps) {
@@ -1503,6 +1543,7 @@ brasero_caps_get_flags_for_disc (BraseroBurnCaps *self,
"FLAGS: trying caps");
io_flags = brasero_caps_get_flags (caps,
+ check_flags,
session_flags,
media,
input,
@@ -1549,6 +1590,7 @@ brasero_caps_get_flags_for_disc (BraseroBurnCaps *self,
static BraseroBurnResult
brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
+ BraseroBurnSession *session,
BraseroMedia media,
BraseroBurnFlag session_flags,
BraseroTrackType *input,
@@ -1557,9 +1599,12 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
{
BraseroBurnResult result;
gboolean can_blank = FALSE;
+ BraseroSessionCheckFlags check_flags;
/* See if medium is supported out of the box */
+ check_flags = brasero_burn_session_get_check_flags (session);
result = brasero_caps_get_flags_for_disc (self,
+ check_flags,
session_flags,
media,
input,
@@ -1569,7 +1614,7 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
/* see if we can add BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE. Add it when:
* - media can be blanked, it has audio or data and we're not merging
* - media is not formatted and it can be blanked/formatted */
- if (brasero_burn_caps_can_blank_real (self, media, session_flags) == BRASERO_BURN_OK)
+ if (brasero_burn_caps_can_blank_real (self, check_flags, media, session_flags) == BRASERO_BURN_OK)
can_blank = TRUE;
else if (session_flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
return BRASERO_BURN_NOT_SUPPORTED;
@@ -1610,6 +1655,7 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
BRASERO_MEDIUM_HAS_AUDIO);
media |= BRASERO_MEDIUM_BLANK;
result = brasero_caps_get_flags_for_disc (self,
+ check_flags,
session_flags,
media,
input,
@@ -1637,6 +1683,7 @@ brasero_burn_caps_get_flags_for_medium (BraseroBurnCaps *self,
/* need to add blanking flags */
brasero_burn_caps_get_blanking_flags_real (self,
+ check_flags,
media,
session_flags,
&blank_supported,
@@ -1752,6 +1799,7 @@ brasero_burn_caps_get_flags_same_src_dest_for_types (BraseroBurnCaps *self,
compulsory = BRASERO_BURN_FLAG_NONE;
result = brasero_caps_get_flags_for_disc (self,
+ brasero_burn_session_get_check_flags (session),
session_flags,
caps->type.subtype.media,
output,
@@ -1883,7 +1931,7 @@ brasero_burn_caps_get_flags_same_src_dest (BraseroBurnCaps *self,
* This is meant to use as internal API
*/
BraseroBurnResult
-brasero_caps_session_get_file_flags (BraseroTrackType *input,
+brasero_caps_session_get_image_flags (BraseroTrackType *input,
BraseroTrackType *output,
BraseroBurnFlag *supported,
BraseroBurnFlag *compulsory)
@@ -1955,7 +2003,7 @@ brasero_burn_session_get_burn_flags (BraseroBurnSession *session,
output = brasero_track_type_new ();
brasero_burn_session_get_output_type (session, output);
- brasero_caps_session_get_file_flags (input, output, supported, compulsory);
+ brasero_caps_session_get_image_flags (input, output, supported, compulsory);
brasero_track_type_free (output);
brasero_track_type_free (input);
@@ -2020,6 +2068,7 @@ brasero_burn_session_get_burn_flags (BraseroBurnSession *session,
/* Let's get flags for recording */
media = brasero_burn_session_get_dest_media (session);
result = brasero_burn_caps_get_flags_for_medium (self,
+ session,
media,
session_flags,
input,
diff --git a/libbrasero-burn/brasero-plugin-information.h b/libbrasero-burn/brasero-plugin-information.h
index 8603779..5862c20 100644
--- a/libbrasero-burn/brasero-plugin-information.h
+++ b/libbrasero-burn/brasero-plugin-information.h
@@ -42,8 +42,14 @@ G_BEGIN_DECLS
void
brasero_plugin_set_active (BraseroPlugin *plugin, gboolean active);
+typedef enum {
+ BRASERO_PLUGIN_ACTIVE_NONE,
+ BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS,
+} BraseroPluginActiveFlags;
+
gboolean
-brasero_plugin_get_active (BraseroPlugin *plugin);
+brasero_plugin_get_active (BraseroPlugin *plugin,
+ BraseroPluginActiveFlags flags);
const gchar *
brasero_plugin_get_name (BraseroPlugin *plugin);
diff --git a/libbrasero-burn/brasero-plugin-private.h b/libbrasero-burn/brasero-plugin-private.h
index 60d7fb4..8203756 100644
--- a/libbrasero-burn/brasero-plugin-private.h
+++ b/libbrasero-burn/brasero-plugin-private.h
@@ -85,6 +85,12 @@ gboolean
brasero_plugin_check_media_restrictions (BraseroPlugin *plugin,
BraseroMedia media);
+void
+brasero_plugin_check_plugin_ready (BraseroPlugin *plugin);
+
+void
+brasero_plugin_need_download (BraseroPlugin *plugin);
+
G_END_DECLS
#endif
diff --git a/libbrasero-burn/brasero-plugin.h b/libbrasero-burn/brasero-plugin.h
index 5b0cb12..2338079 100644
--- a/libbrasero-burn/brasero-plugin.h
+++ b/libbrasero-burn/brasero-plugin.h
@@ -51,8 +51,10 @@ struct _BraseroPluginClass {
GTypeModuleClass parent_class;
/* Signals */
+ void (* errors) (BraseroPlugin *plugin);
void (* loaded) (BraseroPlugin *plugin);
- void (* activated) (BraseroPlugin *plugin);
+ void (* activated) (BraseroPlugin *plugin,
+ gboolean active);
};
struct _BraseroPlugin {
diff --git a/libbrasero-burn/brasero-session-cfg.c b/libbrasero-burn/brasero-session-cfg.c
index 7557c1b..87e0b49 100644
--- a/libbrasero-burn/brasero-session-cfg.c
+++ b/libbrasero-burn/brasero-session-cfg.c
@@ -1152,9 +1152,7 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
brasero_track_type_set_stream_format (source,
BRASERO_METADATA_INFO|
brasero_track_type_get_stream_format (source));
- result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
- source,
- FALSE);
+ result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self), source);
if (result == BRASERO_BURN_OK) {
priv->CD_TEXT_modified = FALSE;
@@ -1168,13 +1166,11 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
brasero_track_type_set_stream_format (source,
(~BRASERO_METADATA_INFO) &
brasero_track_type_get_stream_format (source));
- result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
- source,
- FALSE);
+ result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self), source);
}
}
else {
- result = brasero_burn_session_can_burn (BRASERO_BURN_SESSION (self), FALSE);
+ result = brasero_burn_session_supported (BRASERO_BURN_SESSION (self));
if (result != BRASERO_BURN_OK
&& (brasero_track_type_get_stream_format (source) & BRASERO_METADATA_INFO)) {
@@ -1186,9 +1182,8 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
(~BRASERO_METADATA_INFO) &
brasero_track_type_get_stream_format (source));
- result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self),
- source,
- FALSE);
+ result = brasero_burn_session_input_supported (BRASERO_BURN_SESSION (self), source);
+
BRASERO_BURN_LOG ("Tested support without Metadata information (result %d)", result);
if (result == BRASERO_BURN_OK) {
priv->CD_TEXT_modified = TRUE;
@@ -1218,7 +1213,7 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
tmp_type = brasero_track_type_new ();
- /* NOTE: this is the same as brasero_burn_session_can_burn () */
+ /* NOTE: this is the same as brasero_burn_session_supported () */
result = brasero_burn_session_get_tmp_image_type_same_src_dest (BRASERO_BURN_SESSION (self), tmp_type);
if (result == BRASERO_BURN_OK) {
if (brasero_track_type_get_has_image (tmp_type)) {
@@ -1243,7 +1238,7 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
BRASERO_BURN_LOG ("Temporary image type %i", format);
}
else {
- result = brasero_burn_session_can_burn (BRASERO_BURN_SESSION (self), FALSE);
+ result = brasero_burn_session_supported (BRASERO_BURN_SESSION (self));
format = brasero_burn_session_get_output_format (BRASERO_BURN_SESSION (self));
priv->CD_TEXT_modified = (format & (BRASERO_IMAGE_FORMAT_CDRDAO|BRASERO_IMAGE_FORMAT_CUE)) == 0;
}
@@ -1251,7 +1246,7 @@ brasero_session_cfg_update (BraseroSessionCfg *self)
else {
/* Don't use flags as they'll be adapted later. */
priv->CD_TEXT_modified = FALSE;
- result = brasero_burn_session_can_burn (BRASERO_BURN_SESSION (self), FALSE);
+ result = brasero_burn_session_supported (BRASERO_BURN_SESSION (self));
}
if (result != BRASERO_BURN_OK) {
diff --git a/libbrasero-burn/brasero-session-helper.h b/libbrasero-burn/brasero-session-helper.h
index 67c5bb4..8551f9a 100644
--- a/libbrasero-burn/brasero-session-helper.h
+++ b/libbrasero-burn/brasero-session-helper.h
@@ -46,7 +46,7 @@ G_BEGIN_DECLS
*/
BraseroBurnResult
-brasero_caps_session_get_file_flags (BraseroTrackType *input,
+brasero_caps_session_get_image_flags (BraseroTrackType *input,
BraseroTrackType *output,
BraseroBurnFlag *supported,
BraseroBurnFlag *compulsory);
diff --git a/libbrasero-burn/brasero-session.c b/libbrasero-burn/brasero-session.c
index fb88549..3bb978c 100644
--- a/libbrasero-burn/brasero-session.c
+++ b/libbrasero-burn/brasero-session.c
@@ -110,6 +110,8 @@ struct _BraseroBurnSessionPrivate {
guint dest_added_sig;
guint dest_removed_sig;
+ BraseroSessionCheckFlags check_flags;
+
GSList *tracks;
GSList *pile_tracks;
};
@@ -246,6 +248,61 @@ brasero_burn_session_free_tracks (BraseroBurnSession *self)
}
}
+/**
+ * brasero_burn_session_set_check_flags:
+ * @session: a #BraseroBurnSession.
+ * @flags: a #BraseroSessionCheckFlags
+ *
+ * For the following functions:
+ * brasero_burn_session_get_flags ()
+ * brasero_burn_session_supported ()
+ * brasero_burn_session_input_supported ()
+ * brasero_burn_session_output_supported ()
+ * brasero_burn_session_can_blank ()
+ * brasero_burn_session_get_blank_flags ()
+ * this function sets a few parameters describing
+ * how tests/checks should be performed.
+ */
+
+void
+brasero_burn_session_set_check_flags (BraseroBurnSession *session,
+ BraseroSessionCheckFlags flags)
+{
+ BraseroBurnSessionPrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_BURN_SESSION (session));
+
+ priv = BRASERO_BURN_SESSION_PRIVATE (session);
+ priv->check_flags = flags;
+}
+
+/**
+ * brasero_burn_session_get_check_flags:
+ * @session: a #BraseroBurnSession.
+ *
+ * For the following functions:
+ * brasero_burn_session_get_flags ()
+ * brasero_burn_session_supported ()
+ * brasero_burn_session_input_supported ()
+ * brasero_burn_session_output_supported ()
+ * brasero_burn_session_can_blank ()
+ * brasero_burn_session_get_blank_flags ()
+ * this function gets a few parameters describing
+ * how tests/checks should be performed.
+ *
+ * Returns: #BraseroSessionCheckFlags
+ */
+
+BraseroSessionCheckFlags
+brasero_burn_session_get_check_flags (BraseroBurnSession *session)
+{
+ BraseroBurnSessionPrivate *priv;
+
+ g_return_val_if_fail (BRASERO_IS_BURN_SESSION (session), BRASERO_SESSION_CHECK_NONE);
+
+ priv = BRASERO_BURN_SESSION_PRIVATE (session);
+ return priv->check_flags;
+}
/**
* brasero_burn_session_add_track:
@@ -808,12 +865,12 @@ brasero_burn_session_get_output_type (BraseroBurnSession *self,
return BRASERO_BURN_NOT_READY;
if (brasero_drive_is_fake (priv->settings->burner)) {
- output->type = BRASERO_TRACK_TYPE_IMAGE;
- output->subtype.img_format = brasero_burn_session_get_output_format (self);
+ brasero_track_type_set_has_image (output);
+ brasero_track_type_set_image_format (output, brasero_burn_session_get_output_format (self));
}
else {
- output->type = BRASERO_TRACK_TYPE_DISC;
- output->subtype.media = brasero_medium_get_status (brasero_drive_get_medium (priv->settings->burner));
+ brasero_track_type_set_has_medium (output);
+ brasero_track_type_set_medium_type (output, brasero_medium_get_status (brasero_drive_get_medium (priv->settings->burner)));
}
return BRASERO_BURN_OK;
diff --git a/libbrasero-burn/brasero-session.h b/libbrasero-burn/brasero-session.h
index c87207b..90cede7 100644
--- a/libbrasero-burn/brasero-session.h
+++ b/libbrasero-burn/brasero-session.h
@@ -248,17 +248,29 @@ brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
* Used to test the possibilities offered for a given session
*/
+typedef enum {
+ BRASERO_SESSION_CHECK_NONE = 0,
+ BRASERO_SESSION_CHECK_USE_FLAGS,
+ BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS,
+ BRASERO_SESSION_CHECK_SIGNAL_PLUGIN_ERRORS
+} BraseroSessionCheckFlags;
+
+void
+brasero_burn_session_set_check_flags (BraseroBurnSession *session,
+ BraseroSessionCheckFlags flags);
+
+BraseroSessionCheckFlags
+brasero_burn_session_get_check_flags (BraseroBurnSession *session);
+
BraseroBurnResult
brasero_burn_session_can_blank (BraseroBurnSession *session);
BraseroBurnResult
-brasero_burn_session_can_burn (BraseroBurnSession *session,
- gboolean use_flags);
+brasero_burn_session_supported (BraseroBurnSession *session);
BraseroBurnResult
brasero_burn_session_input_supported (BraseroBurnSession *session,
- BraseroTrackType *input,
- gboolean use_flags);
+ BraseroTrackType *input);
BraseroBurnResult
brasero_burn_session_output_supported (BraseroBurnSession *session,
diff --git a/libbrasero-burn/brasero-status-dialog.c b/libbrasero-burn/brasero-status-dialog.c
index da669cd..896ba49 100644
--- a/libbrasero-burn/brasero-status-dialog.c
+++ b/libbrasero-burn/brasero-status-dialog.c
@@ -47,6 +47,7 @@
#include "brasero-enums.h"
#include "brasero-session.h"
#include "brasero-status-dialog.h"
+#include "burn-plugin-manager.h"
typedef struct _BraseroStatusDialogPrivate BraseroStatusDialogPrivate;
struct _BraseroStatusDialogPrivate
@@ -140,6 +141,12 @@ brasero_status_dialog_update (BraseroStatusDialog *self,
g_free (string);
}
+static void
+brasero_status_dialog_session_ready (BraseroStatusDialog *dialog)
+{
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+}
+
static gboolean
brasero_status_dialog_wait_for_ready_state (BraseroStatusDialog *dialog)
{
@@ -153,7 +160,7 @@ brasero_status_dialog_wait_for_ready_state (BraseroStatusDialog *dialog)
result = brasero_burn_session_get_status (priv->session, status);
if (result != BRASERO_BURN_NOT_READY) {
- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+ brasero_status_dialog_session_ready (dialog);
brasero_status_free (status);
priv->id = 0;
return FALSE;
@@ -300,6 +307,7 @@ brasero_status_dialog_wait_for_session (BraseroStatusDialog *dialog)
status = brasero_status_new ();
result = brasero_burn_session_get_status (priv->session, status);
if (result != BRASERO_BURN_NOT_READY) {
+ brasero_status_dialog_session_ready (dialog);
brasero_status_free (status);
return;
}
diff --git a/libbrasero-burn/burn-basics.c b/libbrasero-burn/burn-basics.c
index c59077e..0001127 100644
--- a/libbrasero-burn/burn-basics.c
+++ b/libbrasero-burn/burn-basics.c
@@ -340,7 +340,7 @@ brasero_burn_library_can_checksum (void)
BraseroCapsLink *link;
link = links->data;
- if (brasero_caps_link_active (link)) {
+ if (brasero_caps_link_active (link, 0)) {
g_object_unref (self);
return TRUE;
}
@@ -436,7 +436,7 @@ brasero_burn_library_get_media_capabilities (BraseroMedia media)
BraseroPlugin *plugin;
plugin = plugins->data;
- if (brasero_plugin_get_active (plugin)) {
+ if (brasero_plugin_get_active (plugin, BRASERO_PLUGIN_ACTIVE_NONE)) {
/* this link is valid */
active = TRUE;
break;
diff --git a/libbrasero-burn/burn-caps.c b/libbrasero-burn/burn-caps.c
index 89c33d4..0da71db 100644
--- a/libbrasero-burn/burn-caps.c
+++ b/libbrasero-burn/burn-caps.c
@@ -68,7 +68,8 @@ brasero_caps_link_free (BraseroCapsLink *link)
}
gboolean
-brasero_caps_link_active (BraseroCapsLink *link)
+brasero_caps_link_active (BraseroCapsLink *link,
+ BraseroPluginActiveFlags plugin_flags)
{
GSList *iter;
@@ -78,13 +79,44 @@ brasero_caps_link_active (BraseroCapsLink *link)
BraseroPlugin *plugin;
plugin = iter->data;
- if (brasero_plugin_get_active (plugin))
+ if (brasero_plugin_get_active (plugin, plugin_flags))
return TRUE;
}
return FALSE;
}
+BraseroPlugin *
+brasero_caps_link_need_download (BraseroCapsLink *link)
+{
+ GSList *iter;
+ BraseroPlugin *plugin_ret = NULL;
+
+ /* See if for link to be active, we need to
+ * download additional apps/libs/.... */
+ for (iter = link->plugins; iter; iter = iter->next) {
+ BraseroPlugin *plugin;
+
+ plugin = iter->data;
+
+ /* If a plugin can be used without any
+ * error then that means that the link
+ * can be followed without additional
+ * download. */
+ if (brasero_plugin_get_active (plugin, BRASERO_PLUGIN_ACTIVE_NONE))
+ return NULL;
+
+ if (brasero_plugin_get_active (plugin, BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS)) {
+ if (!plugin_ret)
+ plugin_ret = plugin;
+ else if (brasero_plugin_get_priority (plugin) > brasero_plugin_get_priority (plugin_ret))
+ plugin_ret = plugin;
+ }
+ }
+
+ return plugin_ret;
+}
+
static void
brasero_caps_test_free (BraseroCapsTest *caps)
{
@@ -115,7 +147,7 @@ brasero_caps_has_active_input (BraseroCaps *caps,
if (link->caps != input)
continue;
- if (brasero_caps_link_active (link))
+ if (brasero_caps_link_active (link, BRASERO_PLUGIN_ACTIVE_NONE))
return TRUE;
}
diff --git a/libbrasero-burn/burn-caps.h b/libbrasero-burn/burn-caps.h
index ee72065..7cf93e7 100644
--- a/libbrasero-burn/burn-caps.h
+++ b/libbrasero-burn/burn-caps.h
@@ -38,6 +38,7 @@
#include "brasero-track-type.h"
#include "brasero-track-type-private.h"
#include "brasero-plugin.h"
+#include "brasero-plugin-information.h"
#include "brasero-plugin-registration.h"
G_BEGIN_DECLS
@@ -93,8 +94,12 @@ GType brasero_burn_caps_get_type (void);
BraseroBurnCaps *brasero_burn_caps_get_default (void);
+BraseroPlugin *
+brasero_caps_link_need_download (BraseroCapsLink *link);
+
gboolean
-brasero_caps_link_active (BraseroCapsLink *link);
+brasero_caps_link_active (BraseroCapsLink *link,
+ BraseroPluginActiveFlags check_flags);
gboolean
brasero_burn_caps_is_input (BraseroBurnCaps *self,
diff --git a/libbrasero-burn/burn-plugin-manager.c b/libbrasero-burn/burn-plugin-manager.c
index 9950c06..d4106c6 100644
--- a/libbrasero-burn/burn-plugin-manager.c
+++ b/libbrasero-burn/burn-plugin-manager.c
@@ -74,6 +74,7 @@ G_DEFINE_TYPE (BraseroPluginManager, brasero_plugin_manager, G_TYPE_OBJECT);
enum
{
+ PLUGIN_ERROR_SIGNAL,
CAPS_CHANGED_SIGNAL,
LAST_SIGNAL
};
@@ -194,15 +195,11 @@ brasero_plugin_manager_set_plugins_state (BraseroPluginManager *self)
plugin = iter->data;
- /* Skip plugins with a problem */
- if (brasero_plugin_get_gtype (plugin) == G_TYPE_NONE)
- continue;
-
if (brasero_plugin_get_compulsory (plugin)) {
brasero_plugin_set_active (plugin, TRUE);
- BRASERO_BURN_LOG ("Setting plugin %s %s",
+ BRASERO_BURN_LOG ("Plugin set to active. %s is %s",
brasero_plugin_get_name (plugin),
- brasero_plugin_get_active (plugin)? "active":"inactive");
+ brasero_plugin_get_active (plugin, 0)? "active":"inactive");
continue;
}
@@ -234,7 +231,7 @@ brasero_plugin_manager_set_plugins_state (BraseroPluginManager *self)
BRASERO_BURN_LOG ("Setting plugin %s %s",
brasero_plugin_get_name (plugin),
- brasero_plugin_get_active (plugin)? "active":"inactive");
+ brasero_plugin_get_active (plugin, 0)? "active":"inactive");
}
g_slist_foreach (names, (GFunc) g_free, NULL);
@@ -276,7 +273,7 @@ brasero_plugin_manager_plugin_state_changed (BraseroPlugin *plugin,
if (brasero_plugin_get_gtype (plugin) == G_TYPE_NONE)
continue;
- if (!brasero_plugin_get_active (plugin))
+ if (!brasero_plugin_get_active (plugin, 0))
continue;
if (brasero_plugin_can_burn (plugin) == BRASERO_BURN_OK
@@ -332,6 +329,19 @@ brasero_plugin_manager_plugin_state_changed (BraseroPlugin *plugin,
0);
}
+static void
+brasero_plugin_manager_plugin_error (BraseroPlugin *plugin,
+ BraseroPluginManager *manager)
+{
+ BraseroPluginManagerPrivate *priv;
+
+ priv = BRASERO_PLUGIN_MANAGER_PRIVATE (manager);
+ g_signal_emit (manager,
+ caps_signals [PLUGIN_ERROR_SIGNAL],
+ 0,
+ plugin);
+}
+
#if 0
/**
@@ -494,11 +504,15 @@ brasero_plugin_manager_init (BraseroPluginManager *self)
BRASERO_BURN_LOG ("Load failure, no GType was returned %s",
brasero_plugin_get_error (plugin));
}
- else
- g_signal_connect (plugin,
- "activated",
- G_CALLBACK (brasero_plugin_manager_plugin_state_changed),
- self);
+
+ g_signal_connect (plugin,
+ "errors",
+ G_CALLBACK (brasero_plugin_manager_plugin_error),
+ self);
+ g_signal_connect (plugin,
+ "activated",
+ G_CALLBACK (brasero_plugin_manager_plugin_state_changed),
+ self);
g_assert (brasero_plugin_get_name (plugin));
priv->plugins = g_slist_prepend (priv->plugins, plugin);
@@ -550,6 +564,16 @@ brasero_plugin_manager_class_init (BraseroPluginManagerClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ caps_signals [PLUGIN_ERROR_SIGNAL] =
+ g_signal_new ("plugin_error",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ BRASERO_TYPE_PLUGIN);
}
BraseroPluginManager *
diff --git a/libbrasero-burn/burn-plugin-manager.h b/libbrasero-burn/burn-plugin-manager.h
index 510e947..4e46708 100644
--- a/libbrasero-burn/burn-plugin-manager.h
+++ b/libbrasero-burn/burn-plugin-manager.h
@@ -35,6 +35,8 @@
#include <glib-object.h>
#include <gmodule.h>
+#include "brasero-plugin.h"
+
G_BEGIN_DECLS
#define BRASERO_TYPE_PLUGIN_MANAGER (brasero_plugin_manager_get_type ())
@@ -50,6 +52,11 @@ typedef struct _BraseroPluginManager BraseroPluginManager;
struct _BraseroPluginManagerClass
{
GObjectClass parent_class;
+
+ /* <Signals>*/
+ void (*caps_changed) (BraseroPluginManager *manager);
+ void (*plugin_error) (BraseroPluginManager *manager,
+ BraseroPlugin *plugin);
};
struct _BraseroPluginManager
diff --git a/libbrasero-burn/burn-plugin.c b/libbrasero-burn/burn-plugin.c
index 40f0768..53ba8e9 100644
--- a/libbrasero-burn/burn-plugin.c
+++ b/libbrasero-burn/burn-plugin.c
@@ -136,6 +136,7 @@ enum
{
LOADED_SIGNAL,
ACTIVATED_SIGNAL,
+ ERRORS_SIGNAL,
LAST_SIGNAL
};
@@ -185,13 +186,6 @@ brasero_plugin_test_gstreamer_plugin (BraseroPlugin *plugin,
}
void
-brasero_plugin_test_library (BraseroPlugin *plugin,
- const gchar *name)
-{
-
-}
-
-void
brasero_plugin_test_app (BraseroPlugin *plugin,
const gchar *name)
{
@@ -268,10 +262,10 @@ brasero_plugin_set_active (BraseroPlugin *self, gboolean active)
priv = BRASERO_PLUGIN_PRIVATE (self);
- was_active = brasero_plugin_get_active (self);
+ was_active = brasero_plugin_get_active (self, BRASERO_PLUGIN_ACTIVE_NONE);
priv->active = active;
- now_active = brasero_plugin_get_active (self);
+ now_active = brasero_plugin_get_active (self, BRASERO_PLUGIN_ACTIVE_NONE);
if (was_active == now_active)
return;
@@ -286,18 +280,24 @@ brasero_plugin_set_active (BraseroPlugin *self, gboolean active)
}
gboolean
-brasero_plugin_get_active (BraseroPlugin *self)
+brasero_plugin_get_active (BraseroPlugin *plugin,
+ BraseroPluginActiveFlags flags)
{
BraseroPluginPrivate *priv;
- priv = BRASERO_PLUGIN_PRIVATE (self);
+ priv = BRASERO_PLUGIN_PRIVATE (plugin);
- if (priv->priority < 0)
+ if (priv->type == G_TYPE_NONE)
return FALSE;
- if (priv->type == G_TYPE_NONE)
+ if (priv->priority < 0)
return FALSE;
+ if (priv->errors) {
+ if ((flags & BRASERO_PLUGIN_ACTIVE_IGNORE_ERRORS) == 0)
+ return FALSE;
+ }
+
return priv->active;
}
@@ -727,7 +727,6 @@ brasero_plugin_get_all_flags (GSList *flags_list,
flags = brasero_plugin_get_flags (flags_list, media);
if (!flags) {
-
if (supported_retval)
*supported_retval = BRASERO_BURN_FLAG_NONE;
if (compulsory_retval)
@@ -1141,14 +1140,36 @@ brasero_plugin_priority_changed (GConfClient *client,
else
priv->priority = gconf_value_get_int (value);
- is_active = brasero_plugin_get_active (self);
+ is_active = brasero_plugin_get_active (self, BRASERO_PLUGIN_ACTIVE_NONE);
g_object_notify (G_OBJECT (self), "priority");
- if (is_active != brasero_plugin_get_active (self))
+ if (is_active != brasero_plugin_get_active (self, BRASERO_PLUGIN_ACTIVE_NONE))
g_signal_emit (self,
plugin_signals [ACTIVATED_SIGNAL],
0,
- brasero_plugin_get_active (self));
+ is_active);
+}
+
+/**
+ * brasero_plugin_need_download:
+ * @plugin: a #BraseroPlugin.
+ *
+ * This is mostly used internally and sends a
+ * signal to report that a plugin needs additional
+ * applications/libraries/... to work.
+ *
+ **/
+
+void
+brasero_plugin_need_download (BraseroPlugin *plugin)
+{
+ BraseroPluginPrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_PLUGIN (plugin));
+ priv = BRASERO_PLUGIN_PRIVATE (plugin);
+ g_signal_emit (plugin,
+ plugin_signals [ERRORS_SIGNAL],
+ 0);
}
typedef void (* BraseroPluginCheckConfig) (BraseroPlugin *plugin);
@@ -1441,6 +1462,16 @@ brasero_plugin_class_init (BraseroPluginClass *klass)
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
+
+ plugin_signals [ERRORS_SIGNAL] =
+ g_signal_new ("errors",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET (BraseroPluginClass, errors),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0,
+ G_TYPE_NONE);
}
BraseroPlugin *
diff --git a/src/brasero-plugin-manager-ui.c b/src/brasero-plugin-manager-ui.c
index 5370d33..58c6193 100644
--- a/src/brasero-plugin-manager-ui.c
+++ b/src/brasero-plugin-manager-ui.c
@@ -364,7 +364,7 @@ plugin_manager_ui_populate_lists (BraseroPluginManagerUI *pm)
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
- ACTIVE_COLUMN, brasero_plugin_get_active (plugin),
+ ACTIVE_COLUMN, brasero_plugin_get_active (plugin, 0),
AVAILABLE_COLUMN, brasero_plugin_get_gtype (plugin) != G_TYPE_NONE && !brasero_plugin_get_compulsory (plugin),
PLUGIN_COLUMN, plugin,
-1);
@@ -417,7 +417,7 @@ plugin_manager_ui_set_active (GtkTreeIter *iter,
/* set new value */
gtk_list_store_set (GTK_LIST_STORE (model),
iter,
- ACTIVE_COLUMN, brasero_plugin_get_active (plugin),
+ ACTIVE_COLUMN, brasero_plugin_get_active (plugin, 0),
AVAILABLE_COLUMN, brasero_plugin_get_gtype (plugin) != G_TYPE_NONE && !brasero_plugin_get_compulsory (plugin),
-1);
@@ -607,7 +607,7 @@ create_tree_popup_menu (BraseroPluginManagerUI *pm)
gtk_widget_set_sensitive (item,
brasero_plugin_get_gtype (plugin) != G_TYPE_NONE && !brasero_plugin_get_compulsory (plugin));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
- brasero_plugin_get_active (plugin));
+ brasero_plugin_get_active (plugin, 0));
g_signal_connect (item, "toggled",
G_CALLBACK (enable_plugin_menu_cb), pm);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
diff --git a/src/brasero-project.c b/src/brasero-project.c
index f9d8c28..4dd1f6f 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -67,6 +67,7 @@
#include "brasero-video-options.h"
#include "brasero-drive-properties.h"
#include "brasero-image-properties.h"
+#include "burn-plugin-manager.h"
#include "brasero-project-type-chooser.h"
#include "brasero-app.h"
@@ -1297,16 +1298,16 @@ brasero_project_check_status (BraseroProject *project)
if (result == BRASERO_BURN_ERR) {
/* At the moment the only error possible is an empty project */
- if (BRASERO_IS_AUDIO_DISC (project->priv->current))
- brasero_project_no_song_dialog (project);
- else
- brasero_project_no_file_dialog (project);
+ if (BRASERO_IS_AUDIO_DISC (project->priv->current))
+ brasero_project_no_song_dialog (project);
+ else
+ brasero_project_no_file_dialog (project);
- return BRASERO_BURN_ERR;
- }
+ return BRASERO_BURN_ERR;
+ }
- if (result == BRASERO_BURN_OK)
- return BRASERO_BURN_OK;
+ if (result == BRASERO_BURN_OK)
+ return BRASERO_BURN_OK;
dialog = brasero_status_dialog_new (BRASERO_BURN_SESSION (project->priv->session),
gtk_widget_get_toplevel (GTK_WIDGET (project)));
@@ -1478,6 +1479,10 @@ brasero_project_burn (BraseroProject *project)
gboolean res = FALSE;
BraseroDisc *current_disc;
+ /* Check that we are ready */
+ if (brasero_project_check_status (project) != BRASERO_BURN_OK)
+ return;
+
if (!brasero_burn_session_is_dest_file (BRASERO_BURN_SESSION (project->priv->session)))
res = brasero_project_drive_properties (project);
else
@@ -1609,6 +1614,9 @@ brasero_project_new_session (BraseroProject *project,
else
project->priv->session = brasero_session_cfg_new ();
+ brasero_burn_session_set_check_flags (BRASERO_BURN_SESSION (project->priv->session),
+ BRASERO_SESSION_CHECK_IGNORE_PLUGIN_ERRORS);
+
/* NOTE: "is-valid" is emitted whenever there is a change in the
* contents of the session. So no need to connect to track-added, ... */
g_signal_connect (project->priv->session,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]