brasero r784 - in trunk: . src



Author: philippr
Date: Wed Apr 30 11:06:57 2008
New Revision: 784
URL: http://svn.gnome.org/viewvc/brasero?rev=784&view=rev

Log:
	Adds mass file renaming to data project
	Fix #497846 â Allow modify filenames of files that will be recorded following a pattern

	* src/brasero-audio-disc.c (brasero_audio_disc_rename_songs):
	* src/brasero-data-disc.c (brasero_data_disc_mass_rename_cb),
	(brasero_data_disc_rename_activated),
	(brasero_data_disc_show_menu):
	* src/brasero-multi-song-props.c (brasero_multi_song_props_init):
	* src/brasero-project.c
	(brasero_project_check_default_burning_app):
	* src/brasero-rename.c (brasero_rename_set_show_keep_default),
	(brasero_rename_do), (brasero_rename_type_changed),
	(brasero_rename_init):
	* src/brasero-rename.h:
	* src/brasero-song-properties.c (brasero_song_props_init),
	(brasero_song_props_set_properties):

Modified:
   trunk/ChangeLog
   trunk/src/brasero-audio-disc.c
   trunk/src/brasero-data-disc.c
   trunk/src/brasero-multi-song-props.c
   trunk/src/brasero-project.c
   trunk/src/brasero-rename.c
   trunk/src/brasero-rename.h
   trunk/src/brasero-song-properties.c

Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c	(original)
+++ trunk/src/brasero-audio-disc.c	Wed Apr 30 11:06:57 2008
@@ -2919,6 +2919,7 @@
 static gboolean
 brasero_audio_disc_rename_songs (GtkTreeModel *model,
 				 GtkTreeIter *iter,
+				 GtkTreePath *treepath,
 				 const gchar *old_name,
 				 const gchar *new_name)
 {

Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c	(original)
+++ trunk/src/brasero-data-disc.c	Wed Apr 30 11:06:57 2008
@@ -68,6 +68,7 @@
 #include "brasero-disc.h"
 #include "brasero-utils.h"
 #include "brasero-disc-message.h"
+#include "brasero-rename.h"
 
 #include "burn-debug.h"
 #include "burn-basics.h"
@@ -1617,6 +1618,21 @@
 	g_list_free (list);
 }
 
+static gboolean
+brasero_data_disc_mass_rename_cb (GtkTreeModel *model,
+				  GtkTreeIter *iter,
+				  GtkTreePath *treepath,
+				  const gchar *old_name,
+				  const gchar *new_name)
+{
+	BraseroFileNode *node;
+
+	node = brasero_data_tree_model_path_to_node (BRASERO_DATA_TREE_MODEL (model), treepath);
+	return brasero_data_project_rename_node (BRASERO_DATA_PROJECT (model),
+						 node,
+						 new_name);
+}
+
 static void
 brasero_data_disc_rename_activated (BraseroDataDisc *disc)
 {
@@ -1631,15 +1647,16 @@
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree));
 
 	list = gtk_tree_selection_get_selected_rows (selection, NULL);
-	for (; list; list = g_list_remove (list, treepath)) {
+	if (g_list_length (list) == 1) {
 		BraseroFileNode *node;
 
 		treepath = list->data;
+		g_list_free (list);
 
 		node = brasero_data_tree_model_path_to_node (BRASERO_DATA_TREE_MODEL (priv->project), treepath);
 		if (!node || node->is_imported) {
 			gtk_tree_path_free (treepath);
-			continue;
+			return;
 		}
 
 		column = gtk_tree_view_get_column (GTK_TREE_VIEW (priv->tree), 0);
@@ -1655,6 +1672,43 @@
 						  TRUE);
 		gtk_tree_path_free (treepath);
 	}
+	else {
+		GtkWidget *frame;
+		GtkWidget *dialog;
+		GtkWidget *rename;
+		GtkResponseType answer;
+
+		dialog = gtk_dialog_new_with_buttons (_("File renaming"),
+						      GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (disc))),
+						      GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+						      _("_Don't rename"), GTK_RESPONSE_CANCEL,
+						      _("_Rename"), GTK_RESPONSE_APPLY,
+						      NULL);
+		gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+
+		rename = brasero_rename_new ();
+		brasero_rename_set_show_keep_default (BRASERO_RENAME (rename), FALSE);
+		gtk_widget_show (rename);
+
+		frame = brasero_utils_pack_properties (_("<b>Renaming mode</b>"), rename, NULL);
+		gtk_widget_show (frame);
+
+		gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, TRUE, TRUE, 0);
+		gtk_widget_show (dialog);
+
+		answer = gtk_dialog_run (GTK_DIALOG (dialog));
+		if (answer != GTK_RESPONSE_APPLY) {
+			gtk_widget_destroy (dialog);
+			return;
+		}
+
+		brasero_rename_do (BRASERO_RENAME (rename),
+				   gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree)),
+				   BRASERO_DATA_TREE_MODEL_NAME,
+				   brasero_data_disc_mass_rename_cb);
+
+		gtk_widget_destroy (dialog);
+	}
 }
 
 static void
@@ -1766,7 +1820,7 @@
 			gtk_widget_set_sensitive (item, TRUE);
 		item = gtk_ui_manager_get_widget (manager, "/ContextMenu/RenameData");
 		if (item)
-			gtk_widget_set_sensitive (item, FALSE);
+			gtk_widget_set_sensitive (item, TRUE);
 		item = gtk_ui_manager_get_widget (manager, "/ContextMenu/DeleteData");
 		if (item)
 			gtk_widget_set_sensitive (item, TRUE);

Modified: trunk/src/brasero-multi-song-props.c
==============================================================================
--- trunk/src/brasero-multi-song-props.c	(original)
+++ trunk/src/brasero-multi-song-props.c	Wed Apr 30 11:06:57 2008
@@ -42,7 +42,6 @@
 	GtkWidget *artist;
 	GtkWidget *composer;
 	GtkWidget *isrc;
-	GtkWidget *label;
 	GtkWidget *gap;
 };
 
@@ -186,12 +185,26 @@
 	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (object)->vbox), 0);
 	gtk_window_set_default_size (GTK_WINDOW (object), 400, 200);
 
-	table = gtk_table_new (4, 2, FALSE);
+	priv->title = brasero_rename_new ();
+	gtk_widget_show (priv->title);
+	gtk_widget_set_tooltip_text (priv->title,
+				     _("This information will be written to the disc using CD-TEXT technology. It can be read and displayed by some audio CD players."));
+
+	frame = brasero_utils_pack_properties (_("<b>Song titles</b>"), priv->title, NULL);
+	gtk_widget_show (frame);
+	gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
+						frame,
+						FALSE,
+						FALSE,
+						0);
+
+	table = gtk_table_new (3, 2, FALSE);
 	gtk_widget_show (table);
 	gtk_table_set_row_spacings (GTK_TABLE (table), 4);
 	gtk_table_set_col_spacings (GTK_TABLE (table), 6);
 
-	frame = brasero_utils_pack_properties (_("<b><big>Song information for all tracks</big></b>"), table, NULL);
+	frame = brasero_utils_pack_properties (_("<b>Additional song information</b>"), table, NULL);
 	gtk_widget_show (frame);
 	gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
 	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
@@ -200,23 +213,6 @@
 						FALSE,
 						0);
 
-	priv->label = gtk_frame_get_label_widget (GTK_FRAME (frame));
-	gtk_widget_show (priv->label);
-	gtk_label_set_single_line_mode (GTK_LABEL (priv->label), FALSE);
-	gtk_label_set_use_markup (GTK_LABEL (priv->label), TRUE);
-	gtk_label_set_line_wrap (GTK_LABEL (priv->label), TRUE);
-
-	label = gtk_label_new (_("Title:"));
-	gtk_widget_show (label);
-	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-	priv->title = brasero_rename_new ();
-	gtk_widget_show (priv->title);
-	gtk_table_attach_defaults (GTK_TABLE (table), priv->title, 1, 2, 0, 1);
-	gtk_widget_set_tooltip_text (priv->title,
-				     _("This information will be written to the disc using CD-TEXT technology. It can be read and displayed by some audio CD players."));
-
 	label = gtk_label_new (_("Artist:"));
 	gtk_widget_show (label);
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -283,7 +279,7 @@
 	box = gtk_hbox_new (FALSE, 6);
 	gtk_widget_show (box);
 
-	frame = brasero_utils_pack_properties (_("<big><b>Options</b></big>"), box, NULL);
+	frame = brasero_utils_pack_properties (_("<b>Options</b>"), box, NULL);
 	gtk_widget_show (frame);
 	gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
 	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), frame, FALSE, FALSE, 0);

Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c	(original)
+++ trunk/src/brasero-project.c	Wed Apr 30 11:06:57 2008
@@ -919,7 +919,7 @@
 
 	gtk_window_set_title (GTK_WINDOW (message), _("Default burning application"));
 	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
-						  _("This is a first time running dialog that won't be shown again. If you change your mind, you can change your choice later in the Removable Drives and Media Preferences wether or not you chose brasero."));
+						  _("This is a first time running dialog that won't be shown again. If you change your mind, you can change your choice later in the Removable Drives and Media Preferences whether or not you chose brasero."));
 
 	/* NOTE for translators the %s is the old application name */
 	if (command)

Modified: trunk/src/brasero-rename.c
==============================================================================
--- trunk/src/brasero-rename.c	(original)
+++ trunk/src/brasero-rename.c	Wed Apr 30 11:06:57 2008
@@ -48,6 +48,8 @@
 	GtkWidget *number_left_entry;
 	GtkWidget *number_right_entry;
 	guint number;
+
+	guint show_default:1;
 };
 
 #define BRASERO_RENAME_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_RENAME, BraseroRenamePrivate))
@@ -56,6 +58,37 @@
 
 G_DEFINE_TYPE (BraseroRename, brasero_rename, GTK_TYPE_VBOX);
 
+void
+brasero_rename_set_show_keep_default (BraseroRename *self,
+				      gboolean show)
+{
+	BraseroRenamePrivate *priv;
+
+	priv = BRASERO_RENAME_PRIVATE (self);
+
+	if (!show) {
+		if (!priv->show_default)
+			return;
+
+		gtk_combo_box_remove_text (GTK_COMBO_BOX (priv->combo), 0);
+
+		/* make sure there is one item active */
+		if (gtk_combo_box_get_active (GTK_COMBO_BOX (priv->combo)) == -1) {
+			gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), 0);
+			gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
+			gtk_widget_show (priv->notebook);
+		}
+	}
+	else {
+		if (priv->show_default)
+			return;
+
+		gtk_combo_box_prepend_text (GTK_COMBO_BOX (priv->combo),
+					     _("<keep current values>"));
+	}
+
+	priv->show_default = show;
+}
 
 static gchar *
 brasero_rename_insert_string (BraseroRename *self,
@@ -186,7 +219,7 @@
 			continue;
 		}
 
-		result = callback (model, &iter, name, new_name);
+		result = callback (model, &iter, treepath, name, new_name);
 
 		if (!result) {
 			if (mode == 3)
@@ -216,7 +249,7 @@
 
 	gtk_widget_show (priv->notebook);
 	gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
-				       gtk_combo_box_get_active (combo) - 1);
+				       gtk_combo_box_get_active (combo) - priv->show_default);
 }
 
 static void
@@ -232,7 +265,7 @@
 
 	priv->notebook = gtk_notebook_new ();
 	gtk_widget_show (priv->notebook);
-	gtk_box_pack_end (GTK_BOX (object), priv->notebook, FALSE, FALSE, 0);
+	gtk_box_pack_end (GTK_BOX (object), priv->notebook, FALSE, FALSE, 4);
 	gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
 
@@ -240,10 +273,11 @@
 	gtk_widget_show (priv->combo);
 	gtk_box_pack_start (GTK_BOX (object), priv->combo, FALSE, FALSE, 0);
 
+	priv->show_default = 1;
 	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("<keep current values>"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Insert a string"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Delete a string"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Substitute a string"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Insert text"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Delete text"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Substitute text"));
 	gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo), _("Number files according to a pattern"));
 
 	g_signal_connect (priv->combo,

Modified: trunk/src/brasero-rename.h
==============================================================================
--- trunk/src/brasero-rename.h	(original)
+++ trunk/src/brasero-rename.h	Wed Apr 30 11:06:57 2008
@@ -28,6 +28,7 @@
 
 typedef gboolean (*BraseroRenameCallback)	(GtkTreeModel *model,
 						 GtkTreeIter *iter,
+						 GtkTreePath *treepath,
 						 const gchar *old_name,
 						 const gchar *new_name);
 
@@ -62,6 +63,10 @@
 		   guint column_num,
 		   BraseroRenameCallback callback);
 
+void
+brasero_rename_set_show_keep_default (BraseroRename *self,
+				      gboolean show);
+
 G_END_DECLS
 
 #endif /* _BRASERO_RENAME_H_ */

Modified: trunk/src/brasero-song-properties.c
==============================================================================
--- trunk/src/brasero-song-properties.c	(original)
+++ trunk/src/brasero-song-properties.c	Wed Apr 30 11:06:57 2008
@@ -188,7 +188,7 @@
 	gtk_table_set_row_spacings (GTK_TABLE (table), 6);
 	gtk_table_set_col_spacings (GTK_TABLE (table), 6);
 
-	frame = brasero_utils_pack_properties (_("<big><b>Options</b></big>"),
+	frame = brasero_utils_pack_properties (_("<b>Options</b>"),
 					       table,
 					       NULL);
 	gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
@@ -294,7 +294,7 @@
 	gchar *string;
 	gdouble secs;
 
-	string = g_strdup_printf (_("<b><big>Song information for track %02i</big></b>"), track_num);
+	string = g_strdup_printf (_("<b>Song information for track %02i</b>"), track_num);
 	gtk_label_set_markup (GTK_LABEL (self->priv->label), string);
 	g_free (string);
 



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