brasero r1531 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1531 - in trunk: . src
- Date: Sat, 15 Nov 2008 19:47:39 +0000 (UTC)
Author: philippr
Date: Sat Nov 15 19:47:39 2008
New Revision: 1531
URL: http://svn.gnome.org/viewvc/brasero?rev=1531&view=rev
Log:
Fix #560539 â Brasero doesn\'t copy track & album info to audio CD
* src/brasero-audio-disc.c (brasero_audio_disc_init),
(brasero_audio_disc_set_row_from_metadata),
(brasero_audio_disc_result), (brasero_audio_disc_add_uri_real),
(brasero_audio_disc_add_uri), (brasero_audio_disc_get_track),
(brasero_audio_disc_set_session_contents),
(brasero_audio_disc_load_track),
(brasero_audio_disc_drag_data_received_cb),
(brasero_audio_disc_display_edited_cb),
(brasero_audio_disc_add_slices), (brasero_audio_disc_rename_songs),
(brasero_audio_disc_edit_multi_song_properties),
(brasero_audio_disc_edit_single_song_properties),
(brasero_audio_disc_edit_song_properties),
(brasero_audio_disc_clipboard_text_cb),
(brasero_audio_disc_button_pressed_cb):
* src/brasero-project.c (_read_audio_track),
(_save_audio_track_xml), (brasero_project_save_project_real):
* src/brasero-song-properties.c (brasero_song_props_title_set),
(brasero_song_props_artist_set), (brasero_song_props_composer_set),
(brasero_song_props_init), (brasero_song_props_get_properties),
(brasero_song_props_set_properties):
* src/brasero-video-disc.c (brasero_video_disc_add_uri_real),
(brasero_video_disc_rename_songs),
(brasero_video_disc_edit_song_properties_list),
(brasero_video_disc_edit_song_properties_file),
(brasero_video_disc_get_track), (brasero_video_disc_load_track):
* src/brasero-video-project.c (brasero_video_project_rename),
(brasero_video_project_set_file_information),
(brasero_video_project_add_uri):
* src/brasero-video-project.h:
* src/brasero-video-tree-model.c
(brasero_video_tree_model_get_value),
(brasero_video_tree_model_drag_data_received):
Modified:
trunk/ChangeLog
trunk/src/brasero-audio-disc.c
trunk/src/brasero-project.c
trunk/src/brasero-song-properties.c
trunk/src/brasero-video-disc.c
trunk/src/brasero-video-project.c
trunk/src/brasero-video-project.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 Nov 15 19:47:39 2008
@@ -309,6 +309,10 @@
BACKGROUND_COL,
SONG_COL,
EDITABLE_COL,
+ TITLE_SET_COL,
+ ARTIST_SET_COL,
+ COMPOSER_SET_COL,
+ ISRC_SET_COL,
NB_COL
};
@@ -385,6 +389,7 @@
/* 1 sec = 75 sectors, len is in nanosecond */
#define BRASERO_SECTORS_TO_TIME(sectors) (gint64) (sectors * GST_SECOND / 75)
#define COL_KEY "column_key"
+#define COL_KEY_SET "column_key_set"
GType
brasero_audio_disc_get_type()
@@ -632,6 +637,10 @@
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
g_signal_connect (G_OBJECT (model),
@@ -671,6 +680,7 @@
renderer = gtk_cell_renderer_text_new ();
g_object_set_data (G_OBJECT (renderer), COL_KEY, GINT_TO_POINTER (NAME_COL));
+ g_object_set_data (G_OBJECT (renderer), COL_KEY_SET, GINT_TO_POINTER (TITLE_SET_COL));
g_object_set (G_OBJECT (renderer),
"mode", GTK_CELL_RENDERER_MODE_EDITABLE,
"ellipsize-set", TRUE,
@@ -704,6 +714,7 @@
renderer = gtk_cell_renderer_text_new ();
g_object_set_data (G_OBJECT (renderer), COL_KEY, GINT_TO_POINTER (ARTIST_COL));
+ g_object_set_data (G_OBJECT (renderer), COL_KEY_SET, GINT_TO_POINTER (ARTIST_SET_COL));
g_object_set (G_OBJECT (renderer),
/* "editable", TRUE, disable this for the time being it doesn't play well with DND and double click */
/* "mode", GTK_CELL_RENDERER_MODE_EDITABLE,*/
@@ -1200,8 +1211,12 @@
{
const gchar *icon_string = BRASERO_DEFAULT_ICON;
gint64 current_length;
+ gboolean composer_set;
GtkTreeIter gap_iter;
+ gboolean artist_set;
gchar *size_string;
+ gboolean title_set;
+ gboolean isrc_set;
gint64 length;
gint64 start;
GIcon *icon;
@@ -1298,14 +1313,19 @@
SIZE_COL, size_string,
ICON_COL, icon_string,
LENGTH_COL, g_file_info_get_attribute_uint64 (info, BRASERO_IO_LEN),
- ARTIST_COL, g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST),
- COMPOSER_COL, g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER),
- ISRC_COL, g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC),
SONG_COL, TRUE,
-1);
g_free (size_string);
- if (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE)) {
+ /* Set all informations provided they were not set already */
+ gtk_tree_model_get (model, iter,
+ TITLE_SET_COL, &title_set,
+ ARTIST_SET_COL, &artist_set,
+ COMPOSER_SET_COL, &composer_set,
+ ISRC_SET_COL, &isrc_set,
+ -1);
+
+ if (!title_set && g_file_info_get_attribute_string (info, BRASERO_IO_TITLE)) {
gchar *name;
name = brasero_audio_disc_validate_utf8_name (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE));
@@ -1315,6 +1335,28 @@
g_free (name);
}
+ if (!artist_set && g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST)) {
+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
+ ARTIST_COL, g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST),
+ -1);
+ }
+ else if (!artist_set)
+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
+ ARTIST_COL, ("Unknown"),
+ -1);
+
+ if (!composer_set && g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER)) {
+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
+ COMPOSER_COL, g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER),
+ -1);
+ }
+
+ if (!isrc_set && g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC)) {
+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
+ ISRC_COL, g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC),
+ -1);
+ }
+
if (icon)
g_object_unref (icon);
@@ -1432,6 +1474,7 @@
markup = brasero_audio_disc_validate_utf8_name (name);
g_free (name);
+ /* Set a default name here */
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
NAME_COL, markup,
URI_COL, uri,
@@ -1687,6 +1730,7 @@
gint64 gap_sectors,
gint64 start,
gint64 end,
+ BraseroSongInfo *info,
GtkTreePath **path_return)
{
GtkTreeRowReference *ref;
@@ -1713,13 +1757,28 @@
markup = g_markup_escape_text (name, -1);
g_free (name);
- gtk_list_store_set (GTK_LIST_STORE (store), &iter,
- NAME_COL, markup,
- ICON_COL, "image-loading",
- URI_COL, uri,
- ARTIST_COL, _("(loading ...)"),
- SONG_COL, TRUE,
- -1);
+ if (info)
+ gtk_list_store_set (GTK_LIST_STORE (store), &iter,
+ URI_COL, uri,
+ SONG_COL, TRUE,
+ ICON_COL, "image-loading",
+ NAME_COL, info->title? info->title:markup,
+ TITLE_SET_COL, info->title? TRUE:FALSE,
+ ARTIST_COL, info->artist? info->artist:_("loading ..."),
+ ARTIST_SET_COL, info->artist? TRUE:FALSE,
+ COMPOSER_COL, info->composer? info->composer:NULL,
+ COMPOSER_SET_COL, info->composer? TRUE:FALSE,
+ ISRC_COL, info->isrc,
+ ISRC_SET_COL, info->isrc? TRUE:FALSE,
+ -1);
+ else
+ gtk_list_store_set (GTK_LIST_STORE (store), &iter,
+ NAME_COL, markup,
+ ICON_COL, "image-loading",
+ URI_COL, uri,
+ ARTIST_COL, _("(loading ...)"),
+ SONG_COL, TRUE,
+ -1);
g_free (markup);
start = start > 0 ? start:0;
@@ -1798,6 +1857,7 @@
0,
-1,
-1,
+ NULL,
&treepath);
if (treepath) {
@@ -1942,17 +2002,29 @@
song = NULL;
do {
+ gint isrc;
gint64 end;
gint64 start;
gchar *title;
gchar *artist;
+ gchar *composer;
+ gboolean isrc_set;
+ gboolean title_set;
+ gboolean artist_set;
+ gboolean composer_set;
gtk_tree_model_get (model, &iter,
URI_COL, &uri,
START_COL, &start,
END_COL, &end,
+ TITLE_SET_COL, &title_set,
+ ARTIST_SET_COL, &artist_set,
+ COMPOSER_SET_COL, &composer_set,
+ ISRC_SET_COL, &isrc_set,
NAME_COL, &title,
ARTIST_COL, &artist,
+ COMPOSER_COL, &composer,
+ ISRC_COL, &isrc,
-1);
if (!uri) {
@@ -1974,8 +2046,24 @@
song->end = end > 0 ? end:0;
info = g_new0 (BraseroSongInfo, 1);
- info->title = title;
- info->artist = artist;
+ if (title_set)
+ info->title = title;
+ else
+ g_free (title);
+
+ if (artist_set)
+ info->artist = artist;
+ else
+ g_free (artist);
+
+ if (composer_set)
+ info->composer = composer;
+ else
+ g_free (composer);
+
+ if (isrc_set)
+ info->isrc = isrc;
+
song->info = info;
track->contents.tracks = g_slist_append (track->contents.tracks, song);
@@ -2026,15 +2114,27 @@
gchar *uri;
gchar *title;
gchar *artist;
+ gchar *composer;
+ gint isrc;
gint64 end;
gint64 start;
gint64 length;
+ gboolean isrc_set;
+ gboolean title_set;
+ gboolean artist_set;
+ gboolean composer_set;
BraseroSongInfo *info;
gtk_tree_model_get (model, &iter,
URI_COL, &uri,
+ TITLE_SET_COL, &title_set,
+ ARTIST_SET_COL, &artist_set,
+ COMPOSER_SET_COL, &composer_set,
+ ISRC_SET_COL, &isrc_set,
NAME_COL, &title,
ARTIST_COL, &artist,
+ COMPOSER_COL, &composer,
+ ISRC_COL, &isrc,
LENGTH_COL, &length,
START_COL, &start,
END_COL, &end,
@@ -2050,8 +2150,24 @@
}
info = g_new0 (BraseroSongInfo, 1);
- info->title = title;
- info->artist = artist;
+
+ if (title_set)
+ info->title = title;
+ else
+ g_free (title);
+
+ if (artist_set)
+ info->artist = artist;
+ else
+ g_free (artist);
+
+ if (composer_set)
+ info->composer = composer;
+ else
+ g_free (composer);
+
+ if (isrc_set)
+ info->isrc = isrc;
track = brasero_track_new (BRASERO_TRACK_TYPE_AUDIO);
brasero_track_set_audio_source (track, uri, BRASERO_AUDIO_FORMAT_UNDEFINED);
@@ -2083,8 +2199,10 @@
BRASERO_AUDIO_DISC (disc)->priv->loading = g_slist_length (track->contents.tracks);
for (iter = track->contents.tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
+ BraseroSongInfo *info;
song = iter->data;
+ info = song->info;
brasero_audio_disc_add_uri_real (BRASERO_AUDIO_DISC (disc),
song->uri,
@@ -2092,7 +2210,9 @@
song->gap,
song->start,
song->end,
+ info,
NULL);
+
}
return BRASERO_DISC_OK;
@@ -2437,6 +2557,7 @@
0,
-1,
-1,
+ NULL,
&treepath);
if (success == BRASERO_DISC_OK) {
pos ++;
@@ -2558,15 +2679,19 @@
{
GtkTreePath *treepath;
GtkTreeModel *model;
+ gint col_set_num;
GtkTreeIter row;
gint col_num;
col_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), COL_KEY));
+ col_set_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), COL_KEY_SET));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
treepath = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &row, treepath);
gtk_list_store_set (GTK_LIST_STORE (model), &row,
- col_num, text, -1);
+ col_num, text,
+ col_set_num, TRUE,
+ -1);
disc->priv->editing = 0;
}
@@ -2656,6 +2781,11 @@
gint64 length;
GSList *iter;
+ gboolean title_set;
+ gboolean artist_set;
+ gboolean composer_set;
+ gboolean isrc_set;
+
gint64 start;
gint64 end;
@@ -2676,10 +2806,14 @@
gtk_tree_model_get (model, parent,
NAME_COL, &name,
+ TITLE_SET_COL, &title_set,
ICON_COL, &icon_string,
ARTIST_COL, &artist,
+ ARTIST_SET_COL, &artist_set,
COMPOSER_COL, &composer,
+ COMPOSER_SET_COL, &composer_set,
ISRC_COL, &isrc,
+ ISRC_SET_COL, &isrc_set,
URI_COL, &uri,
LENGTH_COL, &length,
START_COL, &start,
@@ -2706,10 +2840,14 @@
gtk_list_store_set (GTK_LIST_STORE (model), &row,
URI_COL, uri,
NAME_COL, name,
+ TITLE_SET_COL, title_set,
ICON_COL, icon_string,
ARTIST_COL, artist,
+ ARTIST_SET_COL, artist_set,
COMPOSER_COL, composer,
+ COMPOSER_SET_COL, composer_set,
ISRC_COL, isrc,
+ ISRC_SET_COL, isrc_set,
SONG_COL, TRUE,
START_COL, slice->start,
END_COL, slice->end,
@@ -2938,126 +3076,184 @@
{
gtk_list_store_set (GTK_LIST_STORE (model), iter,
NAME_COL, new_name,
+ TITLE_SET_COL, TRUE,
-1);
return TRUE;
}
static void
-brasero_audio_disc_edit_song_properties (BraseroAudioDisc *disc,
- GList *list)
+brasero_audio_disc_edit_multi_song_properties (BraseroAudioDisc *disc,
+ GList *list)
{
- gint64 end;
- gint64 start;
+ gint isrc;
+ gint64 gap;
+ GList *copy;
GList *item;
- gint song_num;
- gint track_num;
GtkWidget *props;
GtkWidget *toplevel;
GtkTreeModel *model;
- GtkTreePath *treepath;
+ gchar *artist = NULL;
GtkResponseType result;
-
- if (!g_list_length (list))
- return;
+ gchar *composer = NULL;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
-
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (disc));
- /* count the number of selected songs */
- song_num = 0;
- for (item = list; item; item = item->next) {
- GtkTreePath *tmp;
- GtkTreeIter iter;
- gboolean is_song;
-
- tmp = item->data;
- gtk_tree_model_get_iter (model, &iter, tmp);
- gtk_tree_model_get (model, &iter,
- SONG_COL, &is_song,
- -1);
-
- if (is_song)
- song_num ++;
- }
+ props = brasero_multi_song_props_new ();
+ gtk_window_set_transient_for (GTK_WINDOW (props),
+ GTK_WINDOW (toplevel));
+ gtk_window_set_modal (GTK_WINDOW (props), TRUE);
+ gtk_window_set_position (GTK_WINDOW (props),
+ GTK_WIN_POS_CENTER_ON_PARENT);
- if (!song_num)
+ gtk_widget_show (GTK_WIDGET (props));
+ result = gtk_dialog_run (GTK_DIALOG (props));
+ gtk_widget_hide (GTK_WIDGET (props));
+ if (result != GTK_RESPONSE_ACCEPT) {
+ gtk_widget_destroy (props);
return;
+ }
- if (song_num == 1) {
- gint isrc;
- gint64 gap;
- gint64 length;
- gboolean is_song;
- gboolean success;
- gchar *title;
- gchar *artist;
- gchar *composer;
- gchar *track_num_str;
+ brasero_multi_song_props_set_rename_callback (BRASERO_MULTI_SONG_PROPS (props),
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (disc->priv->tree)),
+ NAME_COL,
+ brasero_audio_disc_rename_songs);
+
+ brasero_multi_song_props_get_properties (BRASERO_MULTI_SONG_PROPS (props),
+ &artist,
+ &composer,
+ &isrc,
+ &gap);
+
+ /* start by the end in case we add silences since then the next
+ * treepaths will be wrong */
+ copy = g_list_copy (list);
+ copy = g_list_reverse (copy);
+ for (item = copy; item; item = item->next) {
+ GtkTreePath *treepath;
GtkTreeIter iter;
- GtkTreeIter gap_iter;
-
- props = brasero_song_props_new ();
-
- treepath = list->data;
- success = gtk_tree_model_get_iter (model, &iter, treepath);
+ gboolean is_song;
- if (!success)
- goto end;
+ treepath = item->data;
+ if (!gtk_tree_model_get_iter (model, &iter, treepath))
+ continue;
gtk_tree_model_get (model, &iter,
SONG_COL, &is_song,
-1);
+
if (!is_song)
- goto end;
+ continue;
- gtk_tree_model_get (model, &iter,
- NAME_COL, &title,
- ARTIST_COL, &artist,
- COMPOSER_COL, &composer,
- TRACK_NUM_COL, &track_num_str,
- ISRC_COL, &isrc,
- END_COL, &end,
- START_COL, &start,
- LENGTH_COL, &length,
- -1);
+ if (artist)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ ARTIST_COL, artist,
+ ARTIST_SET_COL, TRUE,
+ -1);
- if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
- gtk_tree_model_get (model, &gap_iter,
- LENGTH_COL, &gap,
+ if (composer)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ COMPOSER_COL, composer,
+ COMPOSER_SET_COL, TRUE,
-1);
- else
- gap = 0;
- if (track_num_str) {
- track_num = (gint) g_strtod (track_num_str + 6 /* (ignore markup) */, NULL);
- g_free (track_num_str);
- }
- else
- track_num = 0;
+ if (isrc > 0)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ ISRC_COL, isrc,
+ ISRC_SET_COL, TRUE,
+ -1);
- brasero_song_props_set_properties (BRASERO_SONG_PROPS (props),
- track_num,
- artist,
- title,
- composer,
- isrc,
- length,
- start,
- end,
- gap);
- if (artist)
- g_free (artist);
- if (title)
- g_free (title);
- if (composer)
- g_free (composer);
+ if (gap > -1)
+ brasero_audio_disc_add_gap (disc, &iter, gap);
}
- else {
- treepath = NULL;
- props = brasero_multi_song_props_new ();
+ g_list_free (copy);
+ g_free (artist);
+ g_free (composer);
+
+ gtk_widget_destroy (props);
+}
+
+static void
+brasero_audio_disc_edit_single_song_properties (BraseroAudioDisc *disc,
+ GtkTreePath *treepath)
+{
+ gint64 gap;
+ gint isrc;
+ gint64 end;
+ gint64 start;
+ gint track_num;
+ GtkWidget *props;
+ gchar *length_str;
+ GtkWidget *toplevel;
+ GtkTreeModel *model;
+ GtkResponseType result;
+ gint64 length;
+ gboolean is_song;
+ gboolean success;
+ gchar *title;
+ gchar *artist;
+ gchar *composer;
+ GtkTreeIter iter;
+ gchar *track_num_str;
+ GtkTreeIter gap_iter;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
+ success = gtk_tree_model_get_iter (model, &iter, treepath);
+ if (!success)
+ return;
+
+ gtk_tree_model_get (model, &iter,
+ SONG_COL, &is_song,
+ -1);
+ if (!is_song)
+ return;
+
+ /* get all information */
+ gtk_tree_model_get (model, &iter,
+ NAME_COL, &title,
+ ARTIST_COL, &artist,
+ COMPOSER_COL, &composer,
+ TRACK_NUM_COL, &track_num_str,
+ ISRC_COL, &isrc,
+ END_COL, &end,
+ START_COL, &start,
+ LENGTH_COL, &length,
+ -1);
+
+ if (brasero_audio_disc_has_gap (disc, &iter, &gap_iter))
+ gtk_tree_model_get (model, &gap_iter,
+ LENGTH_COL, &gap,
+ -1);
+ else
+ gap = 0;
+
+ if (track_num_str) {
+ track_num = (gint) g_strtod (track_num_str + 6 /* (ignore markup) */, NULL);
+ g_free (track_num_str);
}
+ else
+ track_num = 0;
+ /* set up dialog */
+ props = brasero_song_props_new ();
+ brasero_song_props_set_properties (BRASERO_SONG_PROPS (props),
+ track_num,
+ artist,
+ title,
+ composer,
+ isrc,
+ length,
+ start,
+ end,
+ gap);
+ if (artist)
+ g_free (artist);
+ if (title)
+ g_free (title);
+ if (composer)
+ g_free (composer);
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (disc));
gtk_window_set_transient_for (GTK_WINDOW (props),
GTK_WINDOW (toplevel));
gtk_window_set_modal (GTK_WINDOW (props), TRUE);
@@ -3067,123 +3263,118 @@
gtk_widget_show (GTK_WIDGET (props));
result = gtk_dialog_run (GTK_DIALOG (props));
gtk_widget_hide (GTK_WIDGET (props));
- if (result != GTK_RESPONSE_ACCEPT)
- goto end;
+ if (result != GTK_RESPONSE_ACCEPT) {
+ gtk_widget_destroy (props);
+ return;
+ }
- if (treepath) {
- gint isrc;
- gint64 gap;
- gchar *title;
- gchar *markup;
- gchar *artist;
- gchar *composer;
- gchar *length_str;
- GtkTreeIter iter;
+ disc->priv->sectors -= BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (start, end));
+ brasero_song_props_get_properties (BRASERO_SONG_PROPS (props),
+ &artist,
+ &title,
+ &composer,
+ &isrc,
+ &start,
+ &end,
+ &gap);
- disc->priv->sectors -= BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (start, end));
- brasero_song_props_get_properties (BRASERO_SONG_PROPS (props),
- &artist,
- &title,
- &composer,
- &isrc,
- &start,
- &end,
- &gap);
+ length_str = brasero_utils_get_time_string (BRASERO_AUDIO_TRACK_LENGTH (start, end), TRUE, FALSE);
- markup = g_markup_escape_text (title, -1);
- length_str = brasero_utils_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,
+ START_COL, start,
+ END_COL, end,
+ SIZE_COL, length_str,
+ -1);
+ g_free (length_str);
- gtk_tree_model_get_iter (model, &iter, treepath);
+ if (title) {
+ gchar *markup;
+
+ markup = g_markup_escape_text (title, -1);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
NAME_COL, markup,
+ TITLE_SET_COL, TRUE,
+ -1);
+ g_free (markup);
+ }
+
+ if (artist)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
ARTIST_COL, artist,
+ ARTIST_SET_COL, TRUE,
+ -1);
+
+ if (composer)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COMPOSER_COL, composer,
+ COMPOSER_SET_COL, TRUE,
+ -1);
+
+ if (isrc)
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
ISRC_COL, isrc,
- START_COL, start,
- END_COL, end,
- SIZE_COL, length_str,
+ ISRC_SET_COL, TRUE,
-1);
- g_free (length_str);
- g_free (markup);
- if (end - start + BRASERO_SECTORS_TO_TIME (gap) < BRASERO_MIN_AUDIO_TRACK_LENGTH)
- brasero_audio_disc_short_track_dialog (disc);
+ if (end - start + BRASERO_SECTORS_TO_TIME (gap) < BRASERO_MIN_AUDIO_TRACK_LENGTH)
+ brasero_audio_disc_short_track_dialog (disc);
- if (gap)
- brasero_audio_disc_add_gap (disc, &iter, gap);
+ if (gap)
+ brasero_audio_disc_add_gap (disc, &iter, gap);
- disc->priv->sectors += BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (start, end));
- brasero_audio_disc_size_changed (disc);
+ disc->priv->sectors += BRASERO_DURATION_TO_SECTORS (BRASERO_AUDIO_TRACK_LENGTH (start, end));
+ brasero_audio_disc_size_changed (disc);
- g_free (title);
- g_free (artist);
- g_free (composer);
- }
- else {
- gint isrc;
- gint64 gap;
- GList *copy;
- gchar *artist = NULL;
- gchar *composer = NULL;
-
- brasero_multi_song_props_set_rename_callback (BRASERO_MULTI_SONG_PROPS (props),
- gtk_tree_view_get_selection (GTK_TREE_VIEW (disc->priv->tree)),
- NAME_COL,
- brasero_audio_disc_rename_songs);
-
- brasero_multi_song_props_get_properties (BRASERO_MULTI_SONG_PROPS (props),
- &artist,
- &composer,
- &isrc,
- &gap);
-
- /* start by the end in case we add silences since then the next
- * treepaths will be wrong */
- copy = g_list_copy (list);
- copy = g_list_reverse (copy);
- for (item = copy; item; item = item->next) {
- GtkTreePath *treepath;
- GtkTreeIter iter;
- gboolean is_song;
+ g_free (title);
+ g_free (artist);
+ g_free (composer);
+ gtk_widget_destroy (props);
+}
- treepath = item->data;
- if (!gtk_tree_model_get_iter (model, &iter, treepath))
- continue;
+static void
+brasero_audio_disc_edit_song_properties (BraseroAudioDisc *disc,
+ GList *list)
+{
+ GList *item;
+ gint song_num;
+ GtkTreeModel *model;
+ GList *real_list = NULL;
- gtk_tree_model_get (model, &iter,
- SONG_COL, &is_song,
- -1);
+ if (!g_list_length (list))
+ return;
- if (!is_song)
- continue;
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (disc->priv->tree));
- if (artist)
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- ARTIST_COL, artist,
- -1);
+ /* count the number of selected songs */
+ song_num = 0;
+ for (item = list; item; item = item->next) {
+ GtkTreePath *tmp;
+ GtkTreeIter iter;
+ gboolean is_song;
- if (composer)
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- COMPOSER_COL, composer,
- -1);
+ tmp = item->data;
- if (isrc > 0)
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- ISRC_COL, isrc,
- -1);
+ gtk_tree_model_get_iter (model, &iter, tmp);
+ gtk_tree_model_get (model, &iter,
+ SONG_COL, &is_song,
+ -1);
- if (gap > -1)
- brasero_audio_disc_add_gap (disc, &iter, gap);
+ if (is_song) {
+ song_num ++;
+ real_list = g_list_prepend (real_list, tmp);
}
-
- g_list_free (copy);
- g_free (artist);
- g_free (composer);
}
-end:
+ if (!song_num)
+ return;
- gtk_widget_destroy (props);
+ if (song_num == 1)
+ brasero_audio_disc_edit_single_song_properties (disc, real_list->data);
+ else
+ brasero_audio_disc_edit_multi_song_properties (disc, real_list);
+
+ g_list_free (real_list);
}
static void
@@ -3242,6 +3433,7 @@
0,
-1,
-1,
+ NULL,
NULL);
g_free (uri);
}
@@ -3371,9 +3563,10 @@
* part */
selection = gtk_tree_view_get_selection (tree);
gtk_tree_selection_unselect_all (selection);
+ return FALSE;
}
- if (!result || !treepath)
+ if (!result)
return FALSE;
if (disc->priv->selected_path)
Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c (original)
+++ trunk/src/brasero-project.c Sat Nov 15 19:47:39 2008
@@ -1846,6 +1846,75 @@
song->end = (gint64) g_ascii_strtoull (end, NULL, 10);
g_free (end);
}
+ else if (!xmlStrcmp (uris->name, (const xmlChar *) "title")) {
+ xmlChar *title;
+
+ title = xmlNodeListGetString (project,
+ uris->xmlChildrenNode,
+ 1);
+ if (!title)
+ goto error;
+
+ if (!song->info)
+ song->info = g_new0 (BraseroSongInfo, 1);
+
+ if (song->info->title)
+ g_free (song->info->title);
+
+ song->info->title = g_uri_unescape_string ((char *) title, NULL);
+ g_free (title);
+ }
+ else if (!xmlStrcmp (uris->name, (const xmlChar *) "artist")) {
+ xmlChar *artist;
+
+ artist = xmlNodeListGetString (project,
+ uris->xmlChildrenNode,
+ 1);
+ if (!artist)
+ goto error;
+
+ if (!song->info)
+ song->info = g_new0 (BraseroSongInfo, 1);
+
+ if (song->info->artist)
+ g_free (song->info->artist);
+
+ song->info->artist = g_uri_unescape_string ((char *) artist, NULL);
+ g_free (artist);
+ }
+ else if (!xmlStrcmp (uris->name, (const xmlChar *) "composer")) {
+ xmlChar *composer;
+
+ composer = xmlNodeListGetString (project,
+ uris->xmlChildrenNode,
+ 1);
+ if (!composer)
+ goto error;
+
+ if (!song->info)
+ song->info = g_new0 (BraseroSongInfo, 1);
+
+ if (song->info->composer)
+ g_free (song->info->composer);
+
+ song->info->composer = g_uri_unescape_string ((char *) composer, NULL);
+ g_free (composer);
+ }
+ else if (!xmlStrcmp (uris->name, (const xmlChar *) "isrc")) {
+ gchar *isrc;
+
+ isrc = (gchar *) xmlNodeListGetString (project,
+ uris->xmlChildrenNode,
+ 1);
+ if (!isrc)
+ goto error;
+
+ if (!song->info)
+ song->info = g_new0 (BraseroSongInfo, 1);
+
+ song->info->isrc = (gint) g_ascii_strtod (isrc, NULL);
+ g_free (isrc);
+ }
else if (uris->type == XML_ELEMENT_NODE)
goto error;
@@ -2277,11 +2346,15 @@
for (iter = track->contents.tracks; iter; iter = iter->next) {
BraseroDiscSong *song;
+ BraseroSongInfo *info;
xmlChar *escaped;
gchar *start;
+ gchar *isrc;
gchar *end;
song = iter->data;
+ info = song->info;
+
escaped = (unsigned char *) g_uri_escape_string (song->uri, NULL, FALSE);
success = xmlTextWriterWriteElement (project,
(xmlChar *) "uri",
@@ -2323,6 +2396,53 @@
g_free (end);
if (success == -1)
return FALSE;
+
+ if (!info)
+ continue;
+
+ if (info->title) {
+ escaped = (unsigned char *) g_uri_escape_string (info->title, NULL, FALSE);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "title",
+ escaped);
+ g_free (escaped);
+
+ if (success == -1)
+ return FALSE;
+ }
+
+ if (info->artist) {
+ escaped = (unsigned char *) g_uri_escape_string (info->artist, NULL, FALSE);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "artist",
+ escaped);
+ g_free (escaped);
+
+ if (success == -1)
+ return FALSE;
+ }
+
+ if (info->composer) {
+ escaped = (unsigned char *) g_uri_escape_string (info->composer, NULL, FALSE);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "composer",
+ escaped);
+ g_free (escaped);
+
+ if (success == -1)
+ return FALSE;
+ }
+
+ if (info->isrc) {
+ isrc = g_strdup_printf ("%d", info->isrc);
+ success = xmlTextWriterWriteElement (project,
+ (xmlChar *) "isrc",
+ (xmlChar *) isrc);
+
+ g_free (isrc);
+ if (success == -1)
+ return FALSE;
+ }
}
return TRUE;
@@ -2720,6 +2840,7 @@
BraseroProjectSave save_type)
{
BraseroDiscResult result;
+ BraseroProjectType type;
BraseroDiscTrack track;
g_return_val_if_fail (uri != NULL || project->priv->project != NULL, FALSE);
@@ -2743,9 +2864,20 @@
return FALSE;
}
+ if (track.type == BRASERO_DISC_TRACK_AUDIO)
+ type = BRASERO_PROJECT_TYPE_AUDIO;
+ else if (track.type == BRASERO_DISC_TRACK_DATA)
+ type = BRASERO_PROJECT_TYPE_DATA;
+ else if (track.type == BRASERO_DISC_TRACK_VIDEO)
+ type = BRASERO_PROJECT_TYPE_VIDEO;
+ else {
+ brasero_track_clear (&track);
+ return BRASERO_PROJECT_TYPE_INVALID;
+ }
+
if (save_type == BRASERO_PROJECT_SAVE_XML
|| track.type == BRASERO_DISC_TRACK_DATA) {
- brasero_project_set_uri (project, uri, track.type);
+ brasero_project_set_uri (project, uri, type);
if (!brasero_project_save_project_xml (project,
uri ? uri : project->priv->project,
&track,
Modified: trunk/src/brasero-song-properties.c
==============================================================================
--- trunk/src/brasero-song-properties.c (original)
+++ trunk/src/brasero-song-properties.c Sat Nov 15 19:47:39 2008
@@ -62,6 +62,10 @@
GtkWidget *gap;
GtkWidget *gap_label;
+
+ guint title_set:1;
+ guint artist_set:1;
+ guint composer_set:1;
};
static GObjectClass *parent_class = NULL;
@@ -120,6 +124,27 @@
}
static void
+brasero_song_props_title_set (GtkEntry *entry,
+ BraseroSongProps *self)
+{
+ self->priv->title_set = TRUE;
+}
+
+static void
+brasero_song_props_artist_set (GtkEntry *entry,
+ BraseroSongProps *self)
+{
+ self->priv->artist_set = TRUE;
+}
+
+static void
+brasero_song_props_composer_set (GtkEntry *entry,
+ BraseroSongProps *self)
+{
+ self->priv->composer_set = TRUE;
+}
+
+static void
brasero_song_props_init (BraseroSongProps *obj)
{
gchar *title_str;
@@ -153,6 +178,10 @@
label = gtk_label_new (_("Title:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
obj->priv->title = gtk_entry_new ();
+ g_signal_connect (obj->priv->title,
+ "changed",
+ G_CALLBACK (brasero_song_props_title_set),
+ obj);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach_defaults (GTK_TABLE (table), obj->priv->title, 1, 2, 0, 1);
gtk_widget_set_tooltip_text (obj->priv->title,
@@ -161,6 +190,10 @@
label = gtk_label_new (_("Artist:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
obj->priv->artist = gtk_entry_new ();
+ g_signal_connect (obj->priv->artist,
+ "changed",
+ G_CALLBACK (brasero_song_props_artist_set),
+ obj);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach_defaults (GTK_TABLE (table), obj->priv->artist, 1, 2, 1, 2);
gtk_widget_set_tooltip_text (obj->priv->artist,
@@ -169,6 +202,10 @@
label = gtk_label_new (_("Composer:\t"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
obj->priv->composer = gtk_entry_new ();
+ g_signal_connect (obj->priv->composer,
+ "changed",
+ G_CALLBACK (brasero_song_props_composer_set),
+ obj);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach_defaults (GTK_TABLE (table), obj->priv->composer, 1, 2, 2, 3);
gtk_widget_set_tooltip_text (obj->priv->composer,
@@ -276,12 +313,26 @@
gint64 *end,
gint64 *gap)
{
- if (artist)
- *artist = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->artist));
- if (title)
- *title = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->title));
- if (composer)
- *composer = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->composer));
+ if (artist) {
+ if (self->priv->artist_set)
+ *artist = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->artist));
+ else
+ *artist = NULL;
+ }
+
+ if (title) {
+ if (self->priv->title_set)
+ *title = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->title));
+ else
+ *title = NULL;
+ }
+
+ if (composer) {
+ if (self->priv->composer_set)
+ *composer = brasero_song_props_get_entry_value (GTK_ENTRY (self->priv->composer));
+ else
+ *composer = NULL;
+ }
if (isrc) {
const gchar *string;
@@ -369,6 +420,10 @@
self);
brasero_song_props_update_length (self);
+
+ self->priv->title_set = FALSE;
+ self->priv->artist_set = FALSE;
+ self->priv->composer_set = FALSE;
}
static void
Modified: trunk/src/brasero-video-disc.c
==============================================================================
--- trunk/src/brasero-video-disc.c (original)
+++ trunk/src/brasero-video-disc.c Sat Nov 15 19:47:39 2008
@@ -344,6 +344,7 @@
file = brasero_video_project_add_uri (project,
uri,
+ NULL,
sibling,
start,
end);
@@ -491,10 +492,10 @@
if (!file)
return FALSE;
- if (file->name)
- g_free (file->name);
+ if (file->info->title)
+ g_free (file->info->title);
- file->name = g_strdup (new_name);
+ file->info->title = g_strdup (new_name);
return TRUE;
}
@@ -502,8 +503,8 @@
brasero_video_disc_edit_song_properties_list (BraseroVideoDisc *self,
GList *list)
{
- GList *item;
gint isrc;
+ GList *item;
GList *copy;
GtkWidget *props;
GtkWidget *toplevel;
@@ -587,8 +588,12 @@
brasero_video_disc_edit_song_properties_file (BraseroVideoDisc *self,
BraseroVideoFile *file)
{
+ gint isrc;
gint64 end;
gint64 start;
+ gchar *title;
+ gchar *artist;
+ gchar *composer;
GtkWidget *props;
GtkWidget *toplevel;
GtkTreeModel *model;
@@ -597,7 +602,6 @@
priv = BRASERO_VIDEO_DISC_PRIVATE (self);
-
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree));
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
@@ -625,24 +629,51 @@
if (result != GTK_RESPONSE_ACCEPT)
goto end;
- brasero_song_info_free (file->info);
- file->info = g_new0 (BraseroSongInfo, 1);
-
brasero_song_props_get_properties (BRASERO_SONG_PROPS (props),
- &file->info->artist,
- &file->info->title,
- &file->info->composer,
- &file->info->isrc,
+ &artist,
+ &title,
+ &composer,
+ &isrc,
&start,
&end,
NULL);
+ if (title) {
+ if (file->info->title)
+ g_free (file->info->title);
+
+ file->info->title = title;
+ file->title_set = TRUE;
+ }
+
+ if (artist) {
+ if (file->info->artist)
+ g_free (file->info->artist);
+
+ file->info->artist = artist;
+ file->artist_set = TRUE;
+ }
+
+ if (composer) {
+ if (file->info->composer)
+ g_free (file->info->composer);
+
+ file->info->composer = composer;
+ file->composer_set = TRUE;
+ }
+
+ if (isrc) {
+ file->info->isrc = isrc;
+ file->isrc_set = TRUE;
+ }
+
brasero_video_project_resize_file (BRASERO_VIDEO_PROJECT (model), file, start, end);
end:
gtk_widget_destroy (props);
}
+
static void
brasero_video_disc_edit_information_cb (GtkAction *action,
BraseroVideoDisc *self)
@@ -1387,6 +1418,7 @@
song->start = brasero_track_get_audio_start (track);
song->end = brasero_track_get_audio_end (track);
song->info = brasero_song_info_copy (brasero_track_get_audio_info (track));
+
disc_track->contents.tracks = g_slist_append (disc_track->contents.tracks, song);
}
@@ -1420,6 +1452,7 @@
brasero_video_project_add_uri (BRASERO_VIDEO_PROJECT (project),
song->uri,
+ song->info,
NULL,
song->start,
song->end);
Modified: trunk/src/brasero-video-project.c
==============================================================================
--- trunk/src/brasero-video-project.c (original)
+++ trunk/src/brasero-video-project.c Sat Nov 15 19:47:39 2008
@@ -208,10 +208,12 @@
gchar *tmp;
BraseroVideoProjectClass *klass;
- tmp = file->name;
- file->name = g_strdup (name);
+ tmp = file->info->title;
+ file->info->title = g_strdup (name);
g_free (tmp);
+ file->title_set = TRUE;
+
klass = BRASERO_VIDEO_PROJECT_GET_CLASS (self);
if (klass->node_changed)
klass->node_changed (self, file);
@@ -476,7 +478,6 @@
{
guint64 len;
GdkPixbuf *snapshot;
- BraseroSongInfo *song;
BraseroVideoProjectPrivate *priv;
priv = BRASERO_VIDEO_PROJECT_PRIVATE (self);
@@ -519,12 +520,32 @@
file->end = len;
/* Get the song info */
- song = g_new0 (BraseroSongInfo, 1);
- song->title = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE));
- song->artist = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST));
- song->composer = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER));
- song->isrc = g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC);
- file->info = song;
+ if (!file->info)
+ file->info = g_new0 (BraseroSongInfo, 1);
+
+ if (!file->title_set) {
+ if (file->info->title)
+ g_free (file->info->title);
+
+ file->info->title = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_TITLE));
+ }
+
+ if (!file->artist_set) {
+ if (file->info->artist)
+ g_free (file->info->artist);
+
+ file->info->artist = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_ARTIST));
+ }
+
+ if (!file->composer_set) {
+ if (file->info->composer)
+ g_free (file->info->composer);
+
+ file->info->composer = g_strdup (g_file_info_get_attribute_string (info, BRASERO_IO_COMPOSER));
+ }
+
+ if (!file->isrc_set)
+ file->info->isrc = g_file_info_get_attribute_int32 (info, BRASERO_IO_ISRC);
#ifdef BUILD_INOTIFY
@@ -718,6 +739,7 @@
BraseroVideoFile *
brasero_video_project_add_uri (BraseroVideoProject *self,
const gchar *uri,
+ BraseroSongInfo *info,
BraseroVideoFile *sibling,
gint64 start,
gint64 end)
@@ -735,6 +757,21 @@
file = g_new0 (BraseroVideoFile, 1);
file->uri = g_strdup (uri);
+ if (info) {
+ file->info = brasero_song_info_copy (info);
+
+ if (info->isrc)
+ file->isrc_set = TRUE;
+ if (info->title)
+ file->title_set = TRUE;
+ if (info->artist)
+ file->artist_set = TRUE;
+ if (info->composer)
+ file->composer_set = TRUE;
+ }
+ else
+ file->info = g_new0 (BraseroSongInfo, 1);
+
if (start > -1)
file->start = start;
Modified: trunk/src/brasero-video-project.h
==============================================================================
--- trunk/src/brasero-video-project.h (original)
+++ trunk/src/brasero-video-project.h Sat Nov 15 19:47:39 2008
@@ -53,7 +53,6 @@
BraseroVideoFile *prev;
BraseroVideoFile *next;
- gchar *name;
gchar *uri;
BraseroSongInfo *info;
@@ -67,6 +66,11 @@
guint is_loading:1;
guint is_reloading:1;
guint is_monitored:1;
+
+ guint isrc_set:1;
+ guint title_set:1;
+ guint artist_set:1;
+ guint composer_set:1;
};
struct _BraseroVideoProjectClass
@@ -148,6 +152,7 @@
BraseroVideoFile *
brasero_video_project_add_uri (BraseroVideoProject *project,
const gchar *uri,
+ BraseroSongInfo *info,
BraseroVideoFile *sibling,
gint64 start,
gint64 end);
Modified: trunk/src/brasero-video-tree-model.c
==============================================================================
--- trunk/src/brasero-video-tree-model.c (original)
+++ trunk/src/brasero-video-tree-model.c Sat Nov 15 19:47:39 2008
@@ -135,9 +135,7 @@
case BRASERO_VIDEO_TREE_MODEL_NAME:
g_value_init (value, G_TYPE_STRING);
- if (file->name)
- g_value_set_string (value, file->name);
- else if (file->info && file->info->title)
+ if (file->info && file->info->title)
g_value_set_string (value, file->info->title);
else {
gchar *name;
@@ -456,6 +454,7 @@
/* Add the URIs to the project */
brasero_video_project_add_uri (BRASERO_VIDEO_PROJECT (self),
uris [i],
+ NULL,
sibling,
-1,
-1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]