brasero r1979 - in trunk: . src



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

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

	Code cleanup: remove a duplicate function

	* src/brasero-audio-disc.c (brasero_audio_disc_add_gap),
	(brasero_audio_disc_set_row_from_metadata),
	(brasero_audio_disc_add_uri_real), (brasero_audio_disc_merge_gaps),
	(brasero_audio_disc_add_slices),
	(brasero_audio_disc_edit_single_song_properties):
	* src/brasero-jacket-edit.c (brasero_jacket_edit_set_audio_tracks):
	* src/brasero-player.c (brasero_player_update_position):
	* src/brasero-playlist.c (brasero_playlist_parse_result):
	* src/brasero-project-manager.c
	(brasero_project_manager_set_statusbar):
	* src/brasero-project.c
	(brasero_project_save_audio_project_plain_text):
	* src/brasero-song-properties.c (brasero_song_props_update_length),
	(brasero_song_props_gap_changed_cb):
	* src/brasero-split-dialog.c (brasero_split_dialog_cut),
	(brasero_split_dialog_remove_range),
	(brasero_split_dialog_merge_clicked_cb):
	* src/brasero-tray.c (brasero_tray_icon_set_tooltip):
	* src/brasero-utils.c (brasero_utils_get_time_string_from_size),
	(brasero_utils_get_sectors_string):
	* src/brasero-utils.h:
	* src/brasero-video-tree-model.c
	(brasero_video_tree_model_get_value):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-audio-disc.c
   trunk/src/brasero-jacket-edit.c
   trunk/src/brasero-player.c
   trunk/src/brasero-playlist.c
   trunk/src/brasero-project-manager.c
   trunk/src/brasero-project.c
   trunk/src/brasero-song-properties.c
   trunk/src/brasero-split-dialog.c
   trunk/src/brasero-tray.c
   trunk/src/brasero-utils.c
   trunk/src/brasero-utils.h
   trunk/src/brasero-video-tree-model.c

Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c	(original)
+++ trunk/src/brasero-audio-disc.c	Sat Feb 21 09:37:00 2009
@@ -1023,7 +1023,7 @@
 			g_free (string);
 		}
 
-		size = brasero_utils_get_time_string (gap, TRUE, FALSE);
+		size = brasero_units_get_time_string (gap, TRUE, FALSE);
 		gtk_list_store_set (GTK_LIST_STORE (model), &gap_iter,
 				    SIZE_COL, size,
 				    LENGTH_COL, gap,
@@ -1289,7 +1289,7 @@
 		brasero_audio_disc_size_changed (disc);
 	}
 
-	size_string = brasero_utils_get_time_string (length, TRUE, FALSE);
+	size_string = brasero_units_get_time_string (length, TRUE, FALSE);
 	gtk_list_store_set (GTK_LIST_STORE (model), iter,
 			    SIZE_COL, size_string,
 			    ICON_COL, icon_string,
@@ -1747,7 +1747,7 @@
 		disc->priv->sectors += BRASERO_DURATION_TO_SECTORS (length);
 		brasero_audio_disc_size_changed (disc);
 
-		string = brasero_utils_get_time_string (length, TRUE, FALSE);
+		string = brasero_units_get_time_string (length, TRUE, FALSE);
 		gtk_list_store_set (GTK_LIST_STORE (store), &iter,
 				    START_COL, start,
 				    END_COL, end,
@@ -2316,7 +2316,7 @@
 			    -1);
 
 	length_pos += length_iter;
-	size = brasero_utils_get_time_string (length_pos, TRUE, FALSE);
+	size = brasero_units_get_time_string (length_pos, TRUE, FALSE);
 	gtk_list_store_set (GTK_LIST_STORE (model), pos,
 			    SIZE_COL, size,
 			    LENGTH_COL, length_pos,
@@ -2824,7 +2824,7 @@
 			    -1);
 	disc->priv->sectors -= BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (start, end));
 
-	string = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (slice->start, slice->end), TRUE, FALSE); 
+	string = brasero_units_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (slice->start, slice->end), TRUE, FALSE); 
 	gtk_list_store_set (GTK_LIST_STORE (model), parent,
 			    LENGTH_SET_COL, TRUE,
 			    START_COL, slice->start,
@@ -2840,7 +2840,7 @@
 		gtk_list_store_insert_after (GTK_LIST_STORE (model), &row, parent);
 		gtk_tree_model_iter_next (model, parent);
 
-		string = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (slice->start, slice->end), TRUE, FALSE); 
+		string = brasero_units_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (slice->start, slice->end), TRUE, FALSE); 
 		gtk_list_store_set (GTK_LIST_STORE (model), &row,
 				    URI_COL, uri,
 				    NAME_COL, name,
@@ -3282,7 +3282,7 @@
 					   &end,
 					   &gap);
 
-	length_str = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end), TRUE, FALSE);
+	length_str = brasero_units_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end), TRUE, FALSE);
 
 	gtk_tree_model_get_iter (model, &iter, treepath);
 	gtk_list_store_set (GTK_LIST_STORE (model), &iter,

Modified: trunk/src/brasero-jacket-edit.c
==============================================================================
--- trunk/src/brasero-jacket-edit.c	(original)
+++ trunk/src/brasero-jacket-edit.c	Sat Feb 21 09:37:00 2009
@@ -829,7 +829,7 @@
 
 			BRASERO_JACKET_EDIT_INSERT_TAGGED_TEXT (buffer, "\t\t", "Subtitle", &start);
 
-			time = brasero_utils_get_time_string (brasero_track_get_audio_end (track) -
+			time = brasero_units_get_time_string (brasero_track_get_audio_end (track) -
 							      brasero_track_get_audio_start (track),
 							      TRUE,
 							      FALSE);

Modified: trunk/src/brasero-player.c
==============================================================================
--- trunk/src/brasero-player.c	(original)
+++ trunk/src/brasero-player.c	Sat Feb 21 09:37:00 2009
@@ -255,10 +255,10 @@
 		return;
 
 	adjustment = gtk_range_get_adjustment (GTK_RANGE (player->priv->progress));
-	len_string = brasero_utils_get_time_string (player->priv->end - player->priv->start, FALSE, FALSE);
+	len_string = brasero_units_get_time_string (player->priv->end - player->priv->start, FALSE, FALSE);
 
 	value = gtk_range_get_value (GTK_RANGE (player->priv->progress));
-	pos_string = brasero_utils_get_time_string (value, FALSE, FALSE);
+	pos_string = brasero_units_get_time_string (value, FALSE, FALSE);
 
 	/**
 	 * Translators: this is the position being played in the stream. The 

Modified: trunk/src/brasero-playlist.c
==============================================================================
--- trunk/src/brasero-playlist.c	(original)
+++ trunk/src/brasero-playlist.c	Sat Feb 21 09:37:00 2009
@@ -889,7 +889,7 @@
 		genre = g_file_info_get_attribute_string (info, BRASERO_IO_GENRE);
 
 		if (len > 0)
-			len_string = brasero_utils_get_time_string (len, TRUE, FALSE);
+			len_string = brasero_units_get_time_string (len, TRUE, FALSE);
 		else
 			len_string = NULL;
 
@@ -921,7 +921,7 @@
 			    -1);
 
   	if (total_length > 0)
-		len_string = brasero_utils_get_time_string (total_length, TRUE, FALSE);
+		len_string = brasero_units_get_time_string (total_length, TRUE, FALSE);
 	else
 		len_string = NULL;
 

Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c	(original)
+++ trunk/src/brasero-project-manager.c	Sat Feb 21 09:37:00 2009
@@ -250,7 +250,7 @@
 		gchar *size_string;
 
 		if (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO)
-			size_string = brasero_utils_get_time_string (files_size, TRUE, FALSE);
+			size_string = brasero_units_get_time_string (files_size, TRUE, FALSE);
 		else if (manager->priv->type == BRASERO_PROJECT_TYPE_DATA)
 			size_string = g_format_size_for_display (files_size);
 		else
@@ -265,7 +265,7 @@
 		gchar *size_string = NULL;
 
 		if (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO) {
-			size_string = brasero_utils_get_time_string (files_size, TRUE, FALSE);
+			size_string = brasero_units_get_time_string (files_size, TRUE, FALSE);
 			status_string = g_strdup_printf (ngettext ("%d file is supported (%s)", "%d files are supported (%s)", valid_num),
 							 valid_num,
 							 size_string);

Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c	(original)
+++ trunk/src/brasero-project.c	Sat Feb 21 09:37:00 2009
@@ -2206,7 +2206,7 @@
 		if (written != strlen (info->title))
 			goto error;
 
-		time = brasero_utils_get_time_string (song->end - song->start, TRUE, FALSE);
+		time = brasero_units_get_time_string (song->end - song->start, TRUE, FALSE);
 		if (time) {
 			written = fwrite ("\t", 1, 1, file);
 			if (written != 1)

Modified: trunk/src/brasero-song-properties.c
==============================================================================
--- trunk/src/brasero-song-properties.c	(original)
+++ trunk/src/brasero-song-properties.c	Sat Feb 21 09:37:00 2009
@@ -75,7 +75,7 @@
 	start = brasero_time_button_get_value (BRASERO_TIME_BUTTON (self->priv->start));
 	gap = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->gap)) * GST_SECOND;
 
-	length_str = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end + gap), TRUE, FALSE);
+	length_str = brasero_units_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end + gap), TRUE, FALSE);
 	gtk_label_set_markup (GTK_LABEL (self->priv->length), length_str);
 	g_free (length_str);
 }
@@ -111,7 +111,7 @@
 	start = brasero_time_button_get_value (BRASERO_TIME_BUTTON (self->priv->start));
 	gap = gtk_spin_button_get_value (GTK_SPIN_BUTTON (self->priv->gap)) * GST_SECOND;
 
-	length_str = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end + gap), TRUE, FALSE);
+	length_str = brasero_units_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end + gap), TRUE, FALSE);
 	gtk_label_set_markup (GTK_LABEL (self->priv->length), length_str);
 	g_free (length_str);
 }

Modified: trunk/src/brasero-split-dialog.c
==============================================================================
--- trunk/src/brasero-split-dialog.c	(original)
+++ trunk/src/brasero-split-dialog.c	Sat Feb 21 09:37:00 2009
@@ -220,9 +220,9 @@
 		&& !brasero_split_dialog_size_error (self))
 			return FALSE;
 
-		length_str = brasero_utils_get_time_string (pos - priv->start, TRUE, FALSE);
-		start_str = brasero_utils_get_time_string (priv->start, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (pos, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (pos - priv->start, TRUE, FALSE);
+		start_str = brasero_units_get_time_string (priv->start, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (pos, TRUE, FALSE);
 
 		gtk_list_store_append (priv->model, &iter);
 		gtk_list_store_set (priv->model, &iter,
@@ -238,9 +238,9 @@
 		g_free (end_str);
 
 		pos ++;
-		length_str = brasero_utils_get_time_string (end - pos, TRUE, FALSE);
-		start_str = brasero_utils_get_time_string (pos, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (end, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (end - pos, TRUE, FALSE);
+		start_str = brasero_units_get_time_string (pos, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (end, TRUE, FALSE);
 		
 		gtk_list_store_append (priv->model, &iter);
 		gtk_list_store_set (priv->model, &iter,
@@ -326,8 +326,8 @@
 	}
 	else {
 		/* we are in the middle of an existing slice */
-		length_str = brasero_utils_get_time_string (pos - slice.start, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (pos, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (pos - slice.start, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (pos, TRUE, FALSE);
 
 		gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model),
 								&child,
@@ -349,9 +349,9 @@
 	/* create a new one */
 	gtk_list_store_append (priv->model, &child);
 
-	length_str = brasero_utils_get_time_string (slice.end - pos, TRUE, FALSE);
-	start_str = brasero_utils_get_time_string (pos, TRUE, FALSE);
-	end_str = brasero_utils_get_time_string (slice.end, TRUE, FALSE);
+	length_str = brasero_units_get_time_string (slice.end - pos, TRUE, FALSE);
+	start_str = brasero_units_get_time_string (pos, TRUE, FALSE);
+	end_str = brasero_units_get_time_string (slice.end, TRUE, FALSE);
 
 	gtk_list_store_set (priv->model, &child,
 			    START_COL, pos,
@@ -412,9 +412,9 @@
 		&& !brasero_split_dialog_size_error (self))
 			end = length - BRASERO_MIN_AUDIO_TRACK_LENGTH;
 
-		length_str = brasero_utils_get_time_string (start - priv->start, TRUE, FALSE);
-		start_str = brasero_utils_get_time_string (priv->start, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (start, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (start - priv->start, TRUE, FALSE);
+		start_str = brasero_units_get_time_string (priv->start, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (start, TRUE, FALSE);
 
 		gtk_list_store_append (priv->model, &iter);
 		gtk_list_store_set (priv->model, &iter,
@@ -432,9 +432,9 @@
 		if (end == length)
 			return;
 
-		length_str = brasero_utils_get_time_string (length - end, TRUE, FALSE);
-		start_str = brasero_utils_get_time_string (end, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (length, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (length - end, TRUE, FALSE);
+		start_str = brasero_units_get_time_string (end, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (length, TRUE, FALSE);
 		
 		gtk_list_store_append (priv->model, &iter);
 		gtk_list_store_set (priv->model, &iter,
@@ -482,8 +482,8 @@
 				&& !brasero_split_dialog_size_error (self))
 					end = track_end - BRASERO_MIN_AUDIO_TRACK_LENGTH;
 
-				start_str = brasero_utils_get_time_string (end, TRUE, FALSE);
-				length_str = brasero_utils_get_time_string (track_end - end, TRUE, FALSE);
+				start_str = brasero_units_get_time_string (end, TRUE, FALSE);
+				length_str = brasero_units_get_time_string (track_end - end, TRUE, FALSE);
 				gtk_list_store_set (priv->model, &child,
 						    START_COL, end,
 						    START_STR_COL, start_str,
@@ -506,8 +506,8 @@
 			&& !brasero_split_dialog_size_error (self))
 				start = track_start + BRASERO_MIN_AUDIO_TRACK_LENGTH;
 
-			start_str = brasero_utils_get_time_string (start, TRUE, FALSE);
-			length_str = brasero_utils_get_time_string (start - track_start, TRUE, FALSE);
+			start_str = brasero_units_get_time_string (start, TRUE, FALSE);
+			length_str = brasero_units_get_time_string (start - track_start, TRUE, FALSE);
 			gtk_list_store_set (priv->model, &child,
 					    END_COL, start,
 					    END_STR_COL, start_str,
@@ -534,9 +534,9 @@
 
 			gtk_list_store_append (priv->model, &child);
 
-			length_str = brasero_utils_get_time_string (track_end - end, TRUE, FALSE);
-			start_str = brasero_utils_get_time_string (end, TRUE, FALSE);
-			end_str = brasero_utils_get_time_string (track_end, TRUE, FALSE);
+			length_str = brasero_units_get_time_string (track_end - end, TRUE, FALSE);
+			start_str = brasero_units_get_time_string (end, TRUE, FALSE);
+			end_str = brasero_units_get_time_string (track_end, TRUE, FALSE);
 
 			gtk_list_store_set (priv->model, &child,
 					    START_COL, end,
@@ -569,8 +569,8 @@
 			&& !brasero_split_dialog_size_error (self))
 				end = track_end - BRASERO_MIN_AUDIO_TRACK_LENGTH;
 
-			start_str = brasero_utils_get_time_string (end, TRUE, FALSE);
-			length_str = brasero_utils_get_time_string (track_end - end, TRUE, FALSE);
+			start_str = brasero_units_get_time_string (end, TRUE, FALSE);
+			length_str = brasero_units_get_time_string (track_end - end, TRUE, FALSE);
 			gtk_list_store_set (priv->model, &child,
 					    START_COL, end,
 					    START_STR_COL, start_str,
@@ -862,9 +862,9 @@
 
 		} while (gtk_tree_selection_iter_is_selected (selection, &next));
 
-		length_str = brasero_utils_get_time_string (end - start, TRUE, FALSE);
-		start_str = brasero_utils_get_time_string (start, TRUE, FALSE);
-		end_str = brasero_utils_get_time_string (end, TRUE, FALSE);
+		length_str = brasero_units_get_time_string (end - start, TRUE, FALSE);
+		start_str = brasero_units_get_time_string (start, TRUE, FALSE);
+		end_str = brasero_units_get_time_string (end, TRUE, FALSE);
 
 		gtk_list_store_set (priv->model, &child,
 				    START_COL, (gint64) start,

Modified: trunk/src/brasero-tray.c
==============================================================================
--- trunk/src/brasero-tray.c	(original)
+++ trunk/src/brasero-tray.c	Sat Feb 21 09:37:00 2009
@@ -251,7 +251,7 @@
 	if (remaining > 0) {
 		gchar *remaining_string;
 
-		remaining_string = brasero_utils_get_time_string ((double) remaining * 1000000000, TRUE, FALSE);
+		remaining_string = brasero_units_get_time_string ((double) remaining * 1000000000, TRUE, FALSE);
 		text = g_strdup_printf (_("%s, %02i%% done, %s remaining"),
 					action_string,
 					tray->priv->percent,

Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c	(original)
+++ trunk/src/brasero-utils.c	Sat Feb 21 09:37:00 2009
@@ -183,64 +183,6 @@
 }
 
 gchar *
-brasero_utils_get_time_string (guint64 time,
-			       gboolean with_unit,
-			       gboolean round)
-{
-	gint64 second, minute, hour;
-
-	time /= 1000000000;
-	hour = time / 3600;
-	time = time % 3600;
-	minute = time / 60;
-
-	if (round) {
-		if ((time % 60) > 30)
-			minute ++;
-
-		second = 0;
-	}
-	else
-		second = time % 60;
-
-	if (hour) {
-		if (with_unit) {
-			if (hour && minute && second)
-				return g_strdup_printf ("%lli h %02lli min %02lli",
-							 hour,
-							 minute,
-							 second);
-			else if (hour && minute)
-				return g_strdup_printf ("%lli h %02lli",
-							 hour,
-							 minute);
-			else
-				return g_strdup_printf ("%lli h",hour);
-		}
-		else if (hour && minute && second)
-			return g_strdup_printf ("%lli:%02lli:%02lli",
-						 hour,
-						 minute,
-						 second);
-		else if (hour && minute)
-			return g_strdup_printf ("%lli:%02lli", hour, minute);
-	}
-
-	if (with_unit) {
-		if (!second)
-			/* Translators: %lli is a duration expressed in minutes */
-			return g_strdup_printf (_("%lli min"), minute);
-		else
-			/* Translators: the first %lli is the number of minutes
-			 * and the second one is the number of seconds.
-			 * The whole string expresses a duration */
-			return g_strdup_printf (_("%lli:%02lli min"), minute, second);
-	}
-	else
-		return g_strdup_printf ("%lli:%02lli", minute, second);
-}
-
-gchar *
 brasero_utils_get_time_string_from_size (gint64 size,
 					 gboolean with_unit,
 					 gboolean round)
@@ -248,7 +190,7 @@
 	guint64 time = 0;
 
 	time = BRASERO_BYTES_TO_DURATION (size);
-	return brasero_utils_get_time_string (time, with_unit, round);
+	return brasero_units_get_time_string (time, with_unit, round);
 }
 
 enum {
@@ -320,7 +262,7 @@
 
 	if (time_format) {
 		size = sectors * GST_SECOND / 75;
-		return brasero_utils_get_time_string (size, with_unit, round);
+		return brasero_units_get_time_string (size, with_unit, round);
 	}
 	else {
 		size = sectors * 2048;

Modified: trunk/src/brasero-utils.h
==============================================================================
--- trunk/src/brasero-utils.h	(original)
+++ trunk/src/brasero-utils.h	Sat Feb 21 09:37:00 2009
@@ -56,10 +56,6 @@
 
 GQuark brasero_error_quark (void);
 
-gchar *brasero_utils_get_time_string (guint64 time,
-				      gboolean with_unit,
-				      gboolean round);
-
 gchar *brasero_utils_get_time_string_from_size (gint64 time,
 						gboolean with_unit,
 						gboolean round);

Modified: trunk/src/brasero-video-tree-model.c
==============================================================================
--- trunk/src/brasero-video-tree-model.c	(original)
+++ trunk/src/brasero-video-tree-model.c	Sat Feb 21 09:37:00 2009
@@ -186,7 +186,7 @@
 		g_value_init (value, G_TYPE_STRING);
 
 		if (!file->is_loading) {
-			text = brasero_utils_get_time_string (file->end - file->start, TRUE, FALSE);
+			text = brasero_units_get_time_string (file->end - file->start, TRUE, FALSE);
 			g_value_set_string (value, text);
 			g_free (text);
 		}



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