[easytag/wip/gerror: 7/8] Report successful writing in UI, not in tag code
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gerror: 7/8] Report successful writing in UI, not in tag code
- Date: Mon, 29 Sep 2014 17:06:44 +0000 (UTC)
commit 827e4ed7cf379ec2acbdb679b7853e02de45af90
Author: David King <amigadave amigadave com>
Date: Mon Sep 29 16:52:40 2014 +0100
Report successful writing in UI, not in tag code
Remove several Log_Print() calls in the tagging code, and instead report
the successful writing of a tag in the UI.
src/easytag.c | 4 +++-
src/et_core.c | 8 +-------
src/tags/flac_tag.c | 7 -------
src/tags/id3_tag.c | 17 ++++++-----------
src/tags/id3v24_tag.c | 10 ----------
src/tags/ogg_header.c | 15 ---------------
src/tags/ogg_tag.c | 7 +------
7 files changed, 11 insertions(+), 57 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index f4fd4be..35212a8 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -893,8 +893,10 @@ Write_File_Tag (ET_File *ETFile, gboolean hide_msgbox)
if (ET_Save_File_Tag_To_HD (ETFile, &error))
{
+ msg = g_strdup_printf (_("Wrote tag of ‘%s’"), basename_utf8);
et_application_window_status_bar_message (ET_APPLICATION_WINDOW (MainWindow),
- _("Tag(s) written"), TRUE);
+ msg, TRUE);
+ g_free (msg);
g_free (basename_utf8);
return TRUE;
}
diff --git a/src/et_core.c b/src/et_core.c
index 841552c..e53ded8 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -3592,13 +3592,7 @@ ET_Save_File_Tag_To_HD (ET_File *ETFile, GError **error)
}
else
{
- if (*error == NULL)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_UNKNOWN,
- _("Error writing tag type ‘%d’ to file ‘%s’: %s"),
- ETFileDescription->TagType, cur_filename_utf8,
- g_strerror (EIO));
- }
+ g_assert (error == NULL || *error != NULL);
return FALSE;
}
diff --git a/src/tags/flac_tag.c b/src/tags/flac_tag.c
index 965688a..837aea2 100644
--- a/src/tags/flac_tag.c
+++ b/src/tags/flac_tag.c
@@ -824,7 +824,6 @@ flac_tag_write_file_tag (ET_File *ETFile, GError **error)
const File_Tag *FileTag;
const gchar *filename;
const gchar *filename_utf8;
- gchar *basename_utf8;
const gchar *flac_error_msg;
FLAC__Metadata_Chain *chain;
FLAC__Metadata_Iterator *iter;
@@ -1131,12 +1130,6 @@ flac_tag_write_file_tag (ET_File *ETFile, GError **error)
filename_utf8, flac_error_msg);
return FALSE;
}
- else
- {
- basename_utf8 = g_path_get_basename(filename_utf8);
- Log_Print (LOG_OK, _("Wrote tag of ‘%s’"), basename_utf8);
- g_free(basename_utf8);
- }
FLAC__metadata_chain_delete(chain);
diff --git a/src/tags/id3_tag.c b/src/tags/id3_tag.c
index a11e57c..e986471 100644
--- a/src/tags/id3_tag.c
+++ b/src/tags/id3_tag.c
@@ -592,7 +592,7 @@ id3tag_write_file_v23tag (ET_File *ETFile, GError **error)
/* Check error messages */
if (error_strip_id3v1 == ID3E_NoError && error_strip_id3v2 == ID3E_NoError)
{
- Log_Print (LOG_OK, _("Removed tag of ‘%s’"), basename_utf8);
+ g_debug (_("Removed tag of ‘%s’"), basename_utf8);
}
else
{
@@ -732,12 +732,6 @@ id3tag_write_file_v23tag (ET_File *ETFile, GError **error)
success = FALSE;
}
}
-
- if (success)
- {
- Log_Print (LOG_OK, _("Updated tag of ‘%s’"), basename_utf8);
- }
-
}
/* Free allocated data */
@@ -1051,10 +1045,11 @@ out:
string1 = filename_to_display(string);
- if (string1)
- Log_Print(LOG_OK,"OK");
- else
- Log_Print(LOG_ERROR,"KO");
+ /* TODO: Set a GError instead. */
+ if (!string1)
+ {
+ g_warning ("%s", "Error converting ID3 tag field encoding");
+ }
}
g_free(string);
diff --git a/src/tags/id3v24_tag.c b/src/tags/id3v24_tag.c
index d334af7..776da6f 100644
--- a/src/tags/id3v24_tag.c
+++ b/src/tags/id3v24_tag.c
@@ -876,8 +876,6 @@ id3tag_write_file_v24tag (ET_File *ETFile, GError **error)
{
const File_Tag *FileTag;
const gchar *filename;
- const gchar *filename_utf8;
- gchar *basename_utf8;
struct id3_tag *v1tag, *v2tag;
struct id3_frame *frame;
union id3_field *field;
@@ -892,7 +890,6 @@ id3tag_write_file_v24tag (ET_File *ETFile, GError **error)
FileTag = (File_Tag *)ETFile->FileTag->data;
filename = ((File_Name *)ETFile->FileNameCur->data)->value;
- filename_utf8 = ((File_Name *)ETFile->FileNameCur->data)->value_utf8;
v1tag = v2tag = NULL;
@@ -1148,13 +1145,6 @@ id3tag_write_file_v24tag (ET_File *ETFile, GError **error)
if (v2tag)
id3_tag_delete(v2tag);
- if (success)
- {
- basename_utf8 = g_path_get_basename(filename_utf8);
- Log_Print (LOG_OK, _("Updated tag of ‘%s’"), basename_utf8);
- g_free(basename_utf8);
- }
-
return success;
}
diff --git a/src/tags/ogg_header.c b/src/tags/ogg_header.c
index e44e2f3..2d3512e 100644
--- a/src/tags/ogg_header.c
+++ b/src/tags/ogg_header.c
@@ -253,22 +253,7 @@ ogg_header_read_file_info (const gchar *filename,
}
duration = ov_time_total(&vf,-1); // (s) Total time.
- //g_print("play time: %ld s\n",(long)ov_time_total(&vf,-1));
- //g_print("serialnumber: %ld\n",(long)ov_serialnumber(&vf,-1));
- //g_print("compressed length: %ld bytes\n",(long)(ov_raw_total(&vf,-1)));
- /***{
- // Test for displaying comments
- vorbis_comment *vc = ov_comment(&vf,-1);
- Log_Print(LOG_OK,">>> %s",filename_utf8);
- Log_Print(LOG_OK,"Nbr comments : %d",vc->comments);
- Log_Print(LOG_OK,"Vendor : %s",vc->vendor);
- char **ptr = vc->user_comments;
- while(*ptr){
- Log_Print(LOG_OK,"> %s",*ptr);
- ++ptr;
- }
- }***/
ov_clear(&vf); // This close also the file
}else
{
diff --git a/src/tags/ogg_tag.c b/src/tags/ogg_tag.c
index cd8a3b3..63b5318 100644
--- a/src/tags/ogg_tag.c
+++ b/src/tags/ogg_tag.c
@@ -821,7 +821,6 @@ ogg_tag_write_file_tag (ET_File *ETFile, GError **error)
const File_Tag *FileTag;
const gchar *filename;
const gchar *filename_utf8;
- gchar *basename_utf8;
GFile *file;
GFileInputStream *istream;
vcedit_state *state;
@@ -1174,11 +1173,7 @@ ogg_tag_write_file_tag (ET_File *ETFile, GError **error)
}
else
{
- basename_utf8 = g_path_get_basename(filename_utf8);
- Log_Print (LOG_OK, _("Wrote tag of ‘%s’"), basename_utf8);
- g_free (basename_utf8);
-
- vcedit_clear(state);
+ vcedit_clear (state);
}
g_assert (error == NULL || *error == NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]