brasero r1457 - in trunk: . src



Author: philippr
Date: Sun Nov  2 14:02:48 2008
New Revision: 1457
URL: http://svn.gnome.org/viewvc/brasero?rev=1457&view=rev

Log:
	Some more code cleanup removed some function that shouldn\'t be declared
	in burn-caps.h

	* src/brasero-app.c (brasero_caps_changed_cb), (brasero_app_init):
	* src/brasero-data-session.c (brasero_data_session_is_valid_multi):
	* src/burn-basics.h:
	* src/burn-caps.c (brasero_media_capabilities),
	(brasero_burn_library_can_checksum):
	* src/burn-caps.h:
	* src/burn-media.h:


Modified:
   trunk/ChangeLog
   trunk/src/brasero-app.c
   trunk/src/brasero-data-session.c
   trunk/src/burn-basics.h
   trunk/src/burn-caps.c
   trunk/src/burn-caps.h
   trunk/src/burn-media.h

Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c	(original)
+++ trunk/src/brasero-app.c	Sun Nov  2 14:02:48 2008
@@ -618,20 +618,16 @@
 			 BraseroApp *app)
 {
 	BraseroAppPrivate *priv;
-	BraseroBurnCaps *caps;
 	GtkWidget *widget;
 
 	priv = BRASERO_APP_PRIVATE (app);
 
-	caps = brasero_burn_caps_get_default ();
 	widget = gtk_ui_manager_get_widget (priv->manager, "/menubar/ToolMenu/Check");
 
-	if (!brasero_burn_caps_can_checksum (caps))
+	if (!brasero_burn_library_can_checksum ())
 		gtk_widget_set_sensitive (widget, FALSE);
 	else
 		gtk_widget_set_sensitive (widget, TRUE);
-
-	g_object_unref (caps);
 }
 
 static void
@@ -640,7 +636,6 @@
 	GtkWidget *hbox;
 	GtkWidget *menubar;
 	GError *error = NULL;
-	BraseroBurnCaps *caps;
 	BraseroAppPrivate *priv;
 	GtkAccelGroup *accel_group;
 	GtkActionGroup *action_group;
@@ -722,14 +717,12 @@
 	gtk_ui_manager_ensure_update (priv->manager);
 
 	/* check if we can use checksums (we need plugins enabled) */
-	caps = brasero_burn_caps_get_default ();
-	if (!brasero_burn_caps_can_checksum (caps)) {
+	if (!brasero_burn_library_can_checksum ()) {
 		GtkWidget *widget;
 
 		widget = gtk_ui_manager_get_widget (priv->manager, "/menubar/ToolMenu/Check");
 		gtk_widget_set_sensitive (widget, FALSE);
 	}
-	g_object_unref (caps);
 
 	plugin_manager = brasero_plugin_manager_get_default ();
 	g_signal_connect (plugin_manager,

Modified: trunk/src/brasero-data-session.c
==============================================================================
--- trunk/src/brasero-data-session.c	(original)
+++ trunk/src/brasero-data-session.c	Sun Nov  2 14:02:48 2008
@@ -382,14 +382,10 @@
 brasero_data_session_is_valid_multi (BraseroMedium *medium)
 {
 	BraseroMedia media;
-	BraseroBurnCaps *caps;
 	BraseroMedia media_status;
 
 	media = brasero_medium_get_status (medium);
-
-	caps = brasero_burn_caps_get_default ();
-	media_status = brasero_burn_caps_media_capabilities (caps, media);
-	g_object_unref (caps);
+	media_status = brasero_media_capabilities (media);
 
 	return (media_status & BRASERO_MEDIUM_WRITABLE) &&
 	       (media & BRASERO_MEDIUM_HAS_DATA) &&

Modified: trunk/src/burn-basics.h
==============================================================================
--- trunk/src/burn-basics.h	(original)
+++ trunk/src/burn-basics.h	Sun Nov  2 14:02:48 2008
@@ -180,6 +180,9 @@
 GSList *
 brasero_burn_library_get_plugins_list (void);
 
+gboolean
+brasero_burn_library_can_checksum (void);
+
 void
 brasero_burn_library_shutdown (void);
 

Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c	(original)
+++ trunk/src/burn-caps.c	Sun Nov  2 14:02:48 2008
@@ -212,11 +212,6 @@
 	return BRASERO_BURN_ERR;
 }
 
-/**
- * returns the flags that must be used (compulsory),
- * and the flags that can be used (supported).
- */
-
 static gboolean
 brasero_caps_is_compatible_type (const BraseroCaps *caps,
 				 const BraseroTrackType *type)
@@ -267,80 +262,6 @@
 	return TRUE;
 }
 
-/**
- * Used to test what the library can do based on the medium type.
- * Returns BRASERO_MEDIUM_WRITABLE if the disc can be written
- * and / or BRASERO_MEDIUM_REWRITABLE if the disc can be erased.
- */
-
-BraseroMedia
-brasero_burn_caps_media_capabilities (BraseroBurnCaps *self,
-				      BraseroMedia media)
-{
-	GSList *iter;
-	GSList *links;
-	BraseroMedia retval;
-	BraseroCaps *caps = NULL;
-
-	retval = BRASERO_MEDIUM_NONE;
-	BRASERO_BURN_LOG_DISC_TYPE (media, "checking media caps for");
-
-	/* we're only interested in DISC caps. There should be only one caps fitting */
-	for (iter = self->priv->caps_list; iter; iter = iter->next) {
-		caps = iter->data;
-		if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
-			continue;
-
-		if ((media & caps->type.subtype.media) == media)
-			break;
-
-		caps = NULL;
-	}
-
-	if (!caps)
-		return BRASERO_MEDIUM_NONE;
-
-	/* check the links */
-	for (links = caps->links; links; links = links->next) {
-		GSList *plugins;
-		gboolean active;
-		BraseroCapsLink *link;
-
-		link = links->data;
-
-		/* this link must have at least one active plugin to be valid
-		 * plugins are not sorted but in this case we don't need them
-		 * to be. we just need one active if another is with a better
-		 * priority all the better. */
-		active = FALSE;
-		for (plugins = link->plugins; plugins; plugins = plugins->next) {
-			BraseroPlugin *plugin;
-
-			plugin = plugins->data;
-			if (brasero_plugin_get_active (plugin)) {
-				/* this link is valid */
-				active = TRUE;
-				break;
-			}
-		}
-
-		if (!active)
-			continue;
-
-		if (!link->caps) {
-			/* means that it can be blanked */
-			retval |= BRASERO_MEDIUM_REWRITABLE;
-			continue;
-		}
-
-		/* means it can be written. NOTE: if this disc has already some
-		 * data on it, it even means it can be appended */
-		retval |= BRASERO_MEDIUM_WRITABLE;
-	}
-
-	return retval;
-}
-
 static BraseroCaps *
 brasero_caps_find_start_caps (BraseroTrackType *output)
 {
@@ -3763,10 +3684,95 @@
 	return BRASERO_BURN_NOT_SUPPORTED;
 }
 
+/**
+ * Used to test what the library can do based on the medium type.
+ * Returns BRASERO_MEDIUM_WRITABLE if the disc can be written
+ * and / or BRASERO_MEDIUM_REWRITABLE if the disc can be erased.
+ * Declared in burn-media.h.
+ */
+
+BraseroMedia
+brasero_media_capabilities (BraseroMedia media)
+{
+	GSList *iter;
+	GSList *links;
+	BraseroMedia retval;
+	BraseroBurnCaps *self;
+	BraseroCaps *caps = NULL;
+
+	self = brasero_burn_caps_get_default ();
+
+	retval = BRASERO_MEDIUM_NONE;
+	BRASERO_BURN_LOG_DISC_TYPE (media, "checking media caps for");
+
+	/* we're only interested in DISC caps. There should be only one caps fitting */
+	for (iter = self->priv->caps_list; iter; iter = iter->next) {
+		caps = iter->data;
+		if (caps->type.type != BRASERO_TRACK_TYPE_DISC)
+			continue;
+
+		if ((media & caps->type.subtype.media) == media)
+			break;
+
+		caps = NULL;
+	}
+
+	if (!caps)
+		return BRASERO_MEDIUM_NONE;
+
+	/* check the links */
+	for (links = caps->links; links; links = links->next) {
+		GSList *plugins;
+		gboolean active;
+		BraseroCapsLink *link;
+
+		link = links->data;
+
+		/* this link must have at least one active plugin to be valid
+		 * plugins are not sorted but in this case we don't need them
+		 * to be. we just need one active if another is with a better
+		 * priority all the better. */
+		active = FALSE;
+		for (plugins = link->plugins; plugins; plugins = plugins->next) {
+			BraseroPlugin *plugin;
+
+			plugin = plugins->data;
+			if (brasero_plugin_get_active (plugin)) {
+				/* this link is valid */
+				active = TRUE;
+				break;
+			}
+		}
+
+		if (!active)
+			continue;
+
+		if (!link->caps) {
+			/* means that it can be blanked */
+			retval |= BRASERO_MEDIUM_REWRITABLE;
+			continue;
+		}
+
+		/* means it can be written. NOTE: if this disc has already some
+		 * data on it, it even means it can be appended */
+		retval |= BRASERO_MEDIUM_WRITABLE;
+	}
+
+	return retval;
+}
+
+/**
+ * This function is declared in burn-basics.h
+ * It can be used to determine whether or not brasero can do any checksuming.
+ */
+
 gboolean
-brasero_burn_caps_can_checksum (BraseroBurnCaps *self)
+brasero_burn_library_can_checksum (void)
 {
 	GSList *iter;
+	BraseroBurnCaps *self;
+
+	self = brasero_burn_caps_get_default ();
 
 	if (self->priv->tests == NULL)
 		return FALSE;

Modified: trunk/src/burn-caps.h
==============================================================================
--- trunk/src/burn-caps.h	(original)
+++ trunk/src/burn-caps.h	Sun Nov  2 14:02:48 2008
@@ -62,17 +62,6 @@
 BraseroBurnCaps *brasero_burn_caps_get_default ();
 
 /**
- *
- */
-
-BraseroMedia
-brasero_burn_caps_media_capabilities (BraseroBurnCaps *caps,
-				      BraseroMedia media);
-
-gboolean
-brasero_burn_caps_can_checksum (BraseroBurnCaps *caps);
-
-/**
  * Returns a GSList * of BraseroTask * for a given session
  */
 
@@ -90,6 +79,22 @@
 					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
  */
 
@@ -123,20 +128,4 @@
 brasero_burn_caps_get_default_output_format (BraseroBurnCaps *caps,
 					     BraseroBurnSession *session);
 
-/**
- * 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);
-
 #endif /* BURN_CAPS_H */

Modified: trunk/src/burn-media.h
==============================================================================
--- trunk/src/burn-media.h	(original)
+++ trunk/src/burn-media.h	Sun Nov  2 14:02:48 2008
@@ -168,6 +168,9 @@
 GSList *
 brasero_media_get_all_list (BraseroMedia type);
 
+BraseroMedia
+brasero_media_capabilities (BraseroMedia media);
+
 G_END_DECLS
 
 #endif /* _BURN_MEDIA_H */



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