brasero r1980 - in trunk: . src



Author: philippr
Date: Sat Feb 21 10:00:44 2009
New Revision: 1980
URL: http://svn.gnome.org/viewvc/brasero?rev=1980&view=rev

Log:
2009-02-21  Philippe Rouquier  <ykw localhost localdomain>

	Some more code cleanup: remove unneeded functions

	* src/brasero-data-tree-model.c
	(brasero_data_tree_model_get_value):
	* src/brasero-dest-selection.c
	(brasero_dest_selection_format_medium_string):
	* src/brasero-drive-properties.c
	(brasero_drive_properties_set_tmpdir_info):
	* src/brasero-project.c (brasero_project_get_sectors_string),
	(brasero_project_update_project_size), (_wait_for_ready_state):
	* src/brasero-utils.c:
	* src/brasero-utils.h:

Modified:
   trunk/ChangeLog
   trunk/src/brasero-data-tree-model.c
   trunk/src/brasero-dest-selection.c
   trunk/src/brasero-drive-properties.c
   trunk/src/brasero-project.c
   trunk/src/brasero-utils.c
   trunk/src/brasero-utils.h

Modified: trunk/src/brasero-data-tree-model.c
==============================================================================
--- trunk/src/brasero-data-tree-model.c	(original)
+++ trunk/src/brasero-data-tree-model.c	Sat Feb 21 10:00:44 2009
@@ -597,7 +597,7 @@
 		else {
 			gchar *text;
 
-			text = brasero_utils_get_size_string (BRASERO_FILE_NODE_SECTORS (node) * 2048, TRUE, TRUE);
+			text = g_format_size_for_display (BRASERO_FILE_NODE_SECTORS (node) * 2048);
 			g_value_set_string (value, text);
 			g_free (text);
 		}

Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c	(original)
+++ trunk/src/brasero-dest-selection.c	Sat Feb 21 10:00:44 2009
@@ -390,10 +390,10 @@
 					     BraseroMedium *medium)
 {
 	gchar *label;
-	gint64 size = 0;
 	gchar *medium_name;
 	gchar *size_string;
 	BraseroMedia media;
+	gint64 size_bytes = 0;
 	BraseroBurnFlag flags;
 	BraseroTrackType input = { 0, };
 	BraseroDestSelectionPrivate *priv;
@@ -449,12 +449,12 @@
 	|| ((flags & BRASERO_BURN_FLAG_BLANK_BEFORE_WRITE)
 	&&  brasero_burn_caps_can_blank (priv->caps, priv->session) == BRASERO_BURN_OK)) {
 		brasero_medium_get_capacity (medium,
-					     &size,
+					     &size_bytes,
 					     NULL);
 	}
 	else if (flags & (BRASERO_BURN_FLAG_MERGE|BRASERO_BURN_FLAG_APPEND)) {
 		brasero_medium_get_free_space (medium,
-					       &size,
+					       &size_bytes,
 					       NULL);
 	}
 	else if (media & BRASERO_MEDIUM_CLOSED) {
@@ -466,12 +466,12 @@
 		}
 
 		brasero_medium_get_capacity (medium,
-					     &size,
+					     &size_bytes,
 					     NULL);
 	}
 	else {
 		brasero_medium_get_capacity (medium,
-					     &size,
+					     &size_bytes,
 					     NULL);
 	}
 
@@ -479,11 +479,11 @@
 	if (input.type == BRASERO_TRACK_TYPE_AUDIO
 	|| (input.type == BRASERO_TRACK_TYPE_DISC
 	&& (input.subtype.media & BRASERO_MEDIUM_HAS_AUDIO)))
-		size_string = brasero_utils_get_time_string_from_size (size,
-								       TRUE,
-								       TRUE);
+		brasero_units_get_time_string (BRASERO_BYTES_TO_DURATION (size_bytes),
+					       TRUE,
+					       TRUE);
 	else
-		size_string = g_format_size_for_display (size);
+		size_string = g_format_size_for_display (size_bytes);
 
 	/* NOTE for translators: the first %s is the medium name, the second %s
 	 * is its available free space. "Free" here is the free space available. */

Modified: trunk/src/brasero-drive-properties.c
==============================================================================
--- trunk/src/brasero-drive-properties.c	(original)
+++ trunk/src/brasero-drive-properties.c	Sat Feb 21 10:00:44 2009
@@ -159,7 +159,7 @@
 	vol_size = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
 	g_object_unref (info);
 
-	string = brasero_utils_get_size_string (vol_size, TRUE, TRUE);
+	string = g_format_size_for_display (vol_size);
 	gtk_label_set_text (GTK_LABEL (priv->tmpdir_size), string);
 	g_free (string);
 }

Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c	(original)
+++ trunk/src/brasero-project.c	Sat Feb 21 10:00:44 2009
@@ -46,6 +46,8 @@
 
 #include <gconf/gconf-client.h>
 
+#include <gst/gst.h>
+
 #ifdef BUILD_PLAYLIST
 #include <totem-pl-parser.h>
 #endif
@@ -576,6 +578,22 @@
 }
 
 /********************************** size ***************************************/
+gchar *
+brasero_project_get_sectors_string (gint64 sectors,
+				    gboolean time_format)
+{
+	gint64 size_bytes;
+
+	if (time_format) {
+		size_bytes = sectors * GST_SECOND / 75;
+		return brasero_units_get_time_string (size_bytes, TRUE, FALSE);
+	}
+	else {
+		size_bytes = sectors * 2048;
+		return g_format_size_for_display (size_bytes);
+	}
+}
+
 static void
 brasero_project_update_project_size (BraseroProject *project,
 				     guint64 sectors)
@@ -592,10 +610,8 @@
 
 	gtk_statusbar_pop (GTK_STATUSBAR (status), project->priv->status_ctx);
 
-	string = brasero_utils_get_sectors_string (sectors,
-						   !BRASERO_IS_DATA_DISC (project->priv->current),
-						   TRUE,
-						   FALSE);
+	string = brasero_project_get_sectors_string (sectors,
+						     !BRASERO_IS_DATA_DISC (project->priv->current));
 	if (project->priv->merging) {
 		gchar *medium_string;
 		BraseroMedium *medium;
@@ -741,10 +757,8 @@
 			g_free (string);
 		}
 
-		string = brasero_utils_get_sectors_string (project->priv->sectors,
-							   !BRASERO_IS_DATA_DISC (project->priv->current),
-							   TRUE,
-							   FALSE);
+		string = brasero_project_get_sectors_string (project->priv->sectors,
+							     !BRASERO_IS_DATA_DISC (project->priv->current));
 
 		size_str = g_strdup_printf (_("Project estimated size: %s"), string);
 		g_free (string);

Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c	(original)
+++ trunk/src/brasero-utils.c	Sat Feb 21 10:00:44 2009
@@ -182,94 +182,6 @@
 	G_UNLOCK (stringsH);
 }
 
-gchar *
-brasero_utils_get_time_string_from_size (gint64 size,
-					 gboolean with_unit,
-					 gboolean round)
-{
-	guint64 time = 0;
-
-	time = BRASERO_BYTES_TO_DURATION (size);
-	return brasero_units_get_time_string (time, with_unit, round);
-}
-
-enum {
-	BRASERO_UTILS_NO_UNIT,
-	BRASERO_UTILS_KO,
-	BRASERO_UTILS_MO,
-	BRASERO_UTILS_GO
-};
-
-gchar *
-brasero_utils_get_size_string (gint64 dsize,
-			       gboolean with_unit,
-			       gboolean round)
-{
-	int unit;
-	int size;
-	int remain = 0;
-
-	if (with_unit)
-		return g_format_size_for_display (dsize);
-
-	if (dsize < 1024) {
-		unit = BRASERO_UTILS_NO_UNIT;
-		size = (int) dsize;
-		goto end;
-	}
-
-	size = (int) (dsize / 1024);
-	if (size < 1024) {
-		unit = BRASERO_UTILS_KO;
-		goto end;
-	}
-
-	size = (int) (size / 1024);
-	if (size < 1024) {
-		unit = BRASERO_UTILS_MO;
-		goto end;
-	}
-
-	remain = (size % 1024) / 100;
-	size = size / 1024;
-	unit = BRASERO_UTILS_GO;
-
-      end:
-
-	if (round && size > 10) {
-		gint remains;
-
-		remains = size % 10;
-		size -= remains;
-	}
-
-	if (remain)
-		return g_strdup_printf ("%i.%i",
-					size,
-					remain);
-	else
-		return g_strdup_printf ("%i",
-					size);
-}
-
-gchar *
-brasero_utils_get_sectors_string (gint64 sectors,
-				  gboolean time_format,
-				  gboolean with_unit,
-				  gboolean round)
-{
-	gint64 size;
-
-	if (time_format) {
-		size = sectors * GST_SECOND / 75;
-		return brasero_units_get_time_string (size, with_unit, round);
-	}
-	else {
-		size = sectors * 2048;
-		return brasero_utils_get_size_string (size, with_unit, round);
-	}
-}
-
 GtkWidget *
 brasero_utils_pack_properties_list (const gchar *title, GSList *list)
 {

Modified: trunk/src/brasero-utils.h
==============================================================================
--- trunk/src/brasero-utils.h	(original)
+++ trunk/src/brasero-utils.h	Sat Feb 21 10:00:44 2009
@@ -56,19 +56,6 @@
 
 GQuark brasero_error_quark (void);
 
-gchar *brasero_utils_get_time_string_from_size (gint64 time,
-						gboolean with_unit,
-						gboolean round);
-
-gchar *brasero_utils_get_size_string (gint64 size,
-				      gboolean with_unit,
-				      gboolean round);
-gchar *
-brasero_utils_get_sectors_string (gint64 sectors,
-				  gboolean time_format,
-				  gboolean with_unit,
-				  gboolean round);
-
 gchar *
 brasero_utils_register_string (const gchar *string);
 void



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